tests: never source test-defs.sh directly, source test-lib.sh instead
[automake.git] / t / aclocal6.sh
blobdc6b38db38233e48e8279c2edafb15dbfa177545
1 #! /bin/sh
2 # Copyright (C) 2003-2012 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 # Make sure aclocal.m4 is rebuilt whenever a configure
18 # dependency changes. Test for acinclude.m4 and VPATH too.
20 . ./defs || exit 1
22 cat >> configure.ac << 'END'
23 SOME_DEFS
24 AC_CONFIG_FILES([sub/Makefile])
25 AC_OUTPUT
26 END
28 cat > Makefile.am << 'END'
29 SUBDIRS = sub
30 ACLOCAL_AMFLAGS = -I m4
31 END
33 mkdir sub
34 : > sub/Makefile.am
36 mkdir m4
37 echo 'AC_DEFUN([SOME_DEFS], [])' > m4/somedefs.m4
38 echo 'AC_DEFUN([MORE_DEFS], [AC_SUBST([GREPME])])' > m4/moredefs.m4
40 $ACLOCAL -I m4
41 $AUTOCONF
42 $AUTOMAKE --copy --add-missing
44 mkdir build
45 cd build
47 ../configure
48 $MAKE
50 # Modified configure dependencies must be newer than config.status.
51 $sleep
52 # Update an aclocal.m4 dependency, then make sure all Makefiles
53 # are updated, even from a sub-directory.
54 echo 'AC_DEFUN([SOME_DEFS], [MORE_DEFS])' > ../m4/somedefs.m4
55 # Because aclocal will run again, it should also pick up acinclude.m4.
56 echo 'AC_SUBST([METOO])' > ../acinclude.m4
58 cd sub
59 $MAKE
60 cd ..
61 grep GREPME Makefile
62 grep GREPME sub/Makefile
63 grep GREPME sub/Makefile
64 grep METOO Makefile
65 grep METOO sub/Makefile
66 grep METOO sub/Makefile
68 # Make sure configure dependencies are distributed.
69 $MAKE distdir
70 test -f $me-1.0/m4/moredefs.m4
71 test -f $me-1.0/m4/somedefs.m4
72 test -f $me-1.0/acinclude.m4