tests: expose automake bug#14560
[platform/upstream/automake.git] / t / aclocal-remake-misc.sh
1 #! /bin/sh
2 # Copyright (C) 2003-2013 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Make sure aclocal.m4 is rebuilt whenever a configure
18 # dependency changes.  Test for acinclude.m4 and VPATH too.
19
20 . test-init.sh
21
22 cat >> configure.ac << 'END'
23 SOME_DEFS
24 AC_CONFIG_FILES([sub/Makefile])
25 AC_CONFIG_MACRO_DIR([m4])
26 AC_OUTPUT
27 END
28
29 cat > Makefile.am << 'END'
30 SUBDIRS = sub
31 END
32
33 mkdir sub
34 : > sub/Makefile.am
35
36 mkdir m4
37 echo 'AC_DEFUN([SOME_DEFS], [])' > m4/somedefs.m4
38 echo 'AC_DEFUN([MORE_DEFS], [AC_SUBST([GREPME])])' > m4/moredefs.m4
39
40 $ACLOCAL
41 $AUTOCONF
42 $AUTOMAKE --copy --add-missing
43
44 mkdir build
45 cd build
46
47 ../configure
48 $MAKE
49
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
57
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
67
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
73
74 :