2 # Copyright (C) 2004 Free Software Foundation, Inc.
4 # This file is part of GNU Automake.
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 2, or (at your option)
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.
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.
21 # Make sure m4_included files are also scanned for definitions.
22 # Report from Phil Edwards.
29 cat >> configure.
in << 'END'
34 echo 'm4_include([a.m4])' > acinclude.
m4
35 echo 'm4_include([b.m4])' > a.
m4
38 AC_DEFUN([AM_PROG_LIBTOOL],
39 [AC_REQUIRE([SOMETHING])dnl
40 AC_REQUIRE([SOMETHING_ELSE])dnl
45 echo 'm4_include([d.m4])' > c.
m4
46 echo 'AC_DEFUN([SOMETHING_ELSE])' >d.
m4
49 echo 'AC_DEFUN([SOMETHING_ELSE])' >defs
/e.
m4
50 echo 'AC_DEFUN([ANOTHER_MACRO])' >defs
/f.
m4
52 cat >>Makefile.am
<<\EOF
53 ACLOCAL_AMFLAGS
= -I defs
55 test -f $
(distdir
)/acinclude.
m4
56 test -f $
(distdir
)/a.
m4
57 test -f $
(distdir
)/b.
m4
58 test -f $
(distdir
)/c.
m4
59 test -f $
(distdir
)/d.
m4
60 test ! -d $
(distdir
)/defs
62 test -f $
(distdir
)/acinclude.
m4
63 test -f $
(distdir
)/a.
m4
64 test -f $
(distdir
)/b.
m4
65 test -f $
(distdir
)/c.
m4
66 test -f $
(distdir
)/d.
m4
67 test ! -f $
(distdir
)/defs
/e.
m4
68 test -f $
(distdir
)/defs
/f.
m4
73 $FGREP acinclude.
m4 aclocal.
m4
74 # None of the following macro should be included. acinclude.m4
75 # includes the first four, and the last two are not needed at all.
76 $FGREP a.
m4 aclocal.
m4 && exit 1
77 $FGREP b.
m4 aclocal.
m4 && exit 1
78 $FGREP c.
m4 aclocal.
m4 && exit 1
79 $FGREP d.
m4 aclocal.
m4 && exit 1
80 $FGREP defs
/e.
m4 aclocal.
m4 && exit 1
81 $FGREP defs
/f.
m4 aclocal.
m4 && exit 1
93 AC_DEFUN
([FOO
], [ANOTHER_MACRO
])
96 # Because c.m4 has changed, aclocal.m4 must have been rebuilt.
97 test `ls -1t aclocal.m4 stamp | sed 1q` = aclocal.
m4
98 # However, since FOO is not used, f.m4 should not be included
99 # and the contents of aclocal.m4 should remain the same
103 # If FOO where to be used, that would be another story, of course.
104 cat >>configure.
in <<EOF
110 grep 'defs/f.m4' aclocal.
m4
113 # Make sure aclocal diagnose missing included files with correct `file:line:'.
115 $ACLOCAL 2>stderr
&& exit 1
116 grep 'a.m4:1:.*b.m4.*does not exist' stderr