summaryrefslogtreecommitdiff
path: root/tests/aclocal6.test
blob: f4f1fd378bee1992ea5a43d7805e9e8bd0eabace (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#! /bin/sh
# Copyright (C) 2003, 2011 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Make sure aclocal.m4 is rebuilt whenever a configure
# dependency changes.  Test for acinclude.m4 and VPATH too.

required='GNUmake'
. ./defs || Exit 1

cat >> configure.in << 'END'
SOME_DEFS
AC_CONFIG_FILES([sub/Makefile])
AC_OUTPUT
END

cat > Makefile.am << 'END'
SUBDIRS = sub
ACLOCAL_AMFLAGS = -I m4
END

mkdir sub
: > sub/Makefile.am

mkdir m4
echo 'AC_DEFUN([SOME_DEFS], [])' > m4/somedefs.m4
echo 'AC_DEFUN([MORE_DEFS], [AC_SUBST([GREPME])])' > m4/moredefs.m4

$ACLOCAL -I m4
$AUTOCONF
$AUTOMAKE --copy --add-missing

# Users can disable autom4te.cache.
if test -d autom4te.cache; then
  test_cache='test -d'
else
  test_cache=:
fi

mkdir build
cd build

../configure
$MAKE

# Update an aclocal.m4 dependency, then make sure all Makefiles
# are updated, even from a sub-directory.
echo 'AC_DEFUN([SOME_DEFS], [MORE_DEFS])' > ../m4/somedefs.m4
# Because aclocal will run again, it should also pick up acinclude.m4.
echo 'AC_SUBST([METOO])' > ../acinclude.m4

cd sub
$MAKE
cd ..
grep GREPME Makefile
grep GREPME sub/Makefile
grep GREPME sub/Makefile
grep METOO Makefile
grep METOO sub/Makefile
grep METOO sub/Makefile

# Make sure configure dependencies are distributed.
$MAKE distdir
test -f $me-1.0/m4/moredefs.m4
test -f $me-1.0/m4/somedefs.m4
test -f $me-1.0/acinclude.m4

# Make sure maintainer-clean works in VPATH builds.
# (This is unrelated to the rest of this test.)
$MAKE clean
$test_cache ../autom4te.cache
test -f Makefile
test -f sub/Makefile
$MAKE maintainer-clean
test ! -d ../autom4te.cache
test ! -f Makefile
test ! -f sub/Makefile

: