maint: Document how to handle assignment exemption
[automake.git] / t / aclocal-amflags.sh
blob09e34583f3007045add00b19f44cea896656517e
1 #! /bin/sh
2 # Copyright (C) 2012-2017 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Check that the obsolescent idiom of setting $(ACLOCAL_AMFLAGS) in
18 # Makefile.am still works. Remove this test once support for this
19 # obsolescent idiom is removed.
21 . test-init.sh
23 cat >> configure.ac <<'END'
24 MACRO_FOO || AS_EXIT([1])
25 AC_OUTPUT
26 END
28 mkdir m4_1 m4_2
29 cat > m4_1/foo.m4 <<'END'
30 AC_DEFUN([MACRO_FOO], [: > foo])
31 END
32 cat > m4_2/bar.m4 <<'END'
33 AC_DEFUN([MACRO_BAR], [: > bar])
34 END
36 cat > Makefile.am <<'END'
37 ACLOCAL_AMFLAGS = -I m4_2 --verbose
38 check-local:
39 test ! -r foo
40 test -f bar
41 DISTCLEANFILES = bar
42 END
44 $ACLOCAL -I m4_1 >output 2>&1 || { cat output; exit 1; }
45 cat output
46 grep 'found macro' output && exit 1 # Sanity check.
47 $AUTOCONF
48 $AUTOMAKE
50 ./configure
51 test -f foo
52 rm -f foo
54 # ACLOCAL_AMFLAGS is used in rebuild rules, so trigger them.
55 $sleep
57 sed 's/MACRO_FOO/MACRO_BAR/' configure.ac > t
58 mv -f t configure.ac
60 run_make -M Makefile
61 grep "^aclocal.*:.*found macro.*MACRO_BAR.*m4_2/bar\.m4" output
62 grep "macro.*MACRO_FOO" output && exit 1
63 test ! -r foo
64 test -f bar
66 $MAKE distcheck