summaryrefslogtreecommitdiff
path: root/t/aclocal-remake-misc.sh
blob: 6dc90151a6090d38cf79e61b3aa5911a4d1ec969 (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
#! /bin/sh
# Copyright (C) 2003-2015 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.

. test-init.sh

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

cat > Makefile.am << 'END'
SUBDIRS = sub
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
$AUTOCONF
$AUTOMAKE --copy --add-missing

mkdir build
cd build

../configure
$MAKE

# Modified configure dependencies must be newer than config.status.
$sleep
# 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

: