1 | #! /bin/sh
|
---|
2 | # Copyright (C) 2004 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 2, 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 m4_included files are also scanned for definitions.
|
---|
22 | # Report from Phil Edwards.
|
---|
23 |
|
---|
24 | required=GNUmake
|
---|
25 | . ./defs || exit 1
|
---|
26 |
|
---|
27 | set -e
|
---|
28 |
|
---|
29 | cat >> configure.in << 'END'
|
---|
30 | AM_PROG_LIBTOOL
|
---|
31 | AC_OUTPUT
|
---|
32 | END
|
---|
33 |
|
---|
34 | echo 'm4_include([a.m4])' > acinclude.m4
|
---|
35 | echo 'm4_include([b.m4])' > a.m4
|
---|
36 | cat >b.m4 <<EOF
|
---|
37 | m4_include([c.m4])
|
---|
38 | AC_DEFUN([AM_PROG_LIBTOOL],
|
---|
39 | [AC_REQUIRE([SOMETHING])dnl
|
---|
40 | AC_REQUIRE([SOMETHING_ELSE])dnl
|
---|
41 | ])
|
---|
42 |
|
---|
43 | AC_DEFUN([SOMETHING])
|
---|
44 | EOF
|
---|
45 | echo 'm4_include([d.m4])' > c.m4
|
---|
46 | echo 'AC_DEFUN([SOMETHING_ELSE])' >d.m4
|
---|
47 |
|
---|
48 | mkdir defs
|
---|
49 | echo 'AC_DEFUN([SOMETHING_ELSE])' >defs/e.m4
|
---|
50 | echo 'AC_DEFUN([ANOTHER_MACRO])' >defs/f.m4
|
---|
51 |
|
---|
52 | cat >>Makefile.am<<\EOF
|
---|
53 | ACLOCAL_AMFLAGS = -I defs
|
---|
54 | testdist1: distdir
|
---|
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
|
---|
61 | testdist2: distdir
|
---|
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
|
---|
69 | EOF
|
---|
70 |
|
---|
71 | $ACLOCAL -I defs
|
---|
72 |
|
---|
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
|
---|
82 |
|
---|
83 | $AUTOCONF
|
---|
84 | $AUTOMAKE
|
---|
85 |
|
---|
86 | ./configure
|
---|
87 | $MAKE testdist1
|
---|
88 |
|
---|
89 | cp aclocal.m4 stamp
|
---|
90 | $sleep
|
---|
91 |
|
---|
92 | cat >>c.m4 <<\EOF
|
---|
93 | AC_DEFUN([FOO], [ANOTHER_MACRO])
|
---|
94 | EOF
|
---|
95 | $MAKE
|
---|
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
|
---|
100 | cmp aclocal.m4 stamp
|
---|
101 |
|
---|
102 |
|
---|
103 | # If FOO where to be used, that would be another story, of course.
|
---|
104 | cat >>configure.in <<EOF
|
---|
105 | FOO
|
---|
106 | EOF
|
---|
107 | cp aclocal.m4 stamp
|
---|
108 | $sleep
|
---|
109 | $MAKE
|
---|
110 | grep 'defs/f.m4' aclocal.m4
|
---|
111 | $MAKE testdist2
|
---|
112 |
|
---|
113 | # Make sure aclocal diagnose missing included files with correct `file:line:'.
|
---|
114 | rm -f b.m4
|
---|
115 | $ACLOCAL 2>stderr && exit 1
|
---|
116 | grep 'a.m4:1:.*b.m4.*does not exist' stderr
|
---|