source: trunk/essentials/sys-devel/automake-1.8/tests/acloca14.test

Last change on this file was 3118, checked in by bird, 18 years ago

automake 1.8.5

File size: 2.8 KB
Line 
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., 59 Temple Place - Suite 330,
19# Boston, MA 02111-1307, USA.
20
21# Make sure m4_included files are also scanned for definitions.
22# Report from Phil Edwards.
23
24required=GNUmake
25. ./defs || exit 1
26
27set -e
28
29cat >> configure.in << 'END'
30AM_PROG_LIBTOOL
31AC_OUTPUT
32END
33
34echo 'm4_include([a.m4])' > acinclude.m4
35echo 'm4_include([b.m4])' > a.m4
36cat >b.m4 <<EOF
37m4_include([c.m4])
38AC_DEFUN([AM_PROG_LIBTOOL],
39[AC_REQUIRE([SOMETHING])dnl
40AC_REQUIRE([SOMETHING_ELSE])dnl
41])
42
43AC_DEFUN([SOMETHING])
44EOF
45echo 'm4_include([d.m4])' > c.m4
46echo 'AC_DEFUN([SOMETHING_ELSE])' >d.m4
47
48mkdir defs
49echo 'AC_DEFUN([SOMETHING_ELSE])' >defs/e.m4
50echo 'AC_DEFUN([ANOTHER_MACRO])' >defs/f.m4
51
52cat >>Makefile.am<<\EOF
53ACLOCAL_AMFLAGS = -I defs
54testdist1: 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
61testdist2: 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
69EOF
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
89cp aclocal.m4 stamp
90$sleep
91
92cat >>c.m4 <<\EOF
93AC_DEFUN([FOO], [ANOTHER_MACRO])
94EOF
95$MAKE
96# Because c.m4 has changed, aclocal.m4 must have been rebuilt.
97test `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
100cmp aclocal.m4 stamp
101
102
103# If FOO where to be used, that would be another story, of course.
104cat >>configure.in <<EOF
105FOO
106EOF
107cp aclocal.m4 stamp
108$sleep
109$MAKE
110grep 'defs/f.m4' aclocal.m4
111$MAKE testdist2
Note: See TracBrowser for help on using the repository browser.