7db62e6563551cd1da2635ceb256f535e32f37b8
[platform/upstream/automake.git] / tests / aclocal6.test
1 #! /bin/sh
2 # Copyright (C) 2003  Free Software Foundation, Inc.
3 #
4 # This file is part of GNU Automake.
5 #
6 # GNU Automake is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3, or (at your option)
9 # any later version.
10 #
11 # GNU Automake is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with Automake; see the file COPYING.  If not, write to
18 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 # Boston, MA 02110-1301, USA.
20
21 # Make sure aclocal.m4 is rebuilt whenever a configure
22 # dependency changes.  Test for acinclude.m4 and VPATH too.
23
24 required='GNUmake'
25 . ./defs || exit 1
26
27 set -e
28
29 cat >> configure.in << 'END'
30 SOME_DEFS
31 AC_CONFIG_FILES([sub/Makefile])
32 AC_OUTPUT
33 END
34
35 cat > Makefile.am << 'END'
36 SUBDIRS = sub
37 ACLOCAL_AMFLAGS = -I m4
38 END
39
40 mkdir sub
41 : > sub/Makefile.am
42
43 mkdir m4
44 echo 'AC_DEFUN([SOME_DEFS], [])' > m4/somedefs.m4
45 echo 'AC_DEFUN([MORE_DEFS], [AC_SUBST([GREPME])])' > m4/moredefs.m4
46
47 $ACLOCAL -I m4
48 $AUTOCONF
49 $AUTOMAKE --copy --add-missing
50
51 # Users can disable autom4te.cache.
52 if test -d autom4te.cache; then
53   test_cache='test -d'
54 else
55   test_cache=:
56 fi
57
58 mkdir build
59 cd build
60
61 ../configure
62 $MAKE
63
64 # Update an aclocal.m4 dependency, then make sure all Makefiles
65 # are updated, even from a sub-directory.
66 echo 'AC_DEFUN([SOME_DEFS], [MORE_DEFS])' > ../m4/somedefs.m4
67 # Because aclocal will run again, it should also pick up acinclude.m4.
68 echo 'AC_SUBST([METOO])' > ../acinclude.m4
69
70 cd sub
71 $MAKE
72 cd ..
73 grep GREPME Makefile
74 grep GREPME sub/Makefile
75 grep GREPME sub/Makefile
76 grep METOO Makefile
77 grep METOO sub/Makefile
78 grep METOO sub/Makefile
79
80 # Make sure configure dependencies are distributed.
81 $MAKE distdir
82 test -f aclocal6-1.0/m4/moredefs.m4
83 test -f aclocal6-1.0/m4/somedefs.m4
84 test -f aclocal6-1.0/acinclude.m4
85
86 # Make sure maintainer-clean works in VPATH builds.
87 # (This is unrelated to the rest of this test.)
88 $MAKE clean
89 $test_cache ../autom4te.cache
90 test -f Makefile
91 test -f sub/Makefile
92 $MAKE maintainer-clean
93 test ! -d ../autom4te.cache
94 test ! -f Makefile
95 test ! -f sub/Makefile