summaryrefslogtreecommitdiff
path: root/t/aclocal-amflags.sh
blob: 7e7db9bd1ac2868071fa69d7f15f27f63e09d40f (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
#! /bin/sh
# Copyright (C) 2012-2018 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 <https://www.gnu.org/licenses/>.

# Check that the obsolescent idiom of setting $(ACLOCAL_AMFLAGS) in
# Makefile.am still works.  Remove this test once support for this
# obsolescent idiom is removed.

. test-init.sh

cat >> configure.ac <<'END'
MACRO_FOO || AS_EXIT([1])
AC_OUTPUT
END

mkdir m4_1 m4_2
cat > m4_1/foo.m4 <<'END'
AC_DEFUN([MACRO_FOO], [: > foo])
END
cat > m4_2/bar.m4 <<'END'
AC_DEFUN([MACRO_BAR], [: > bar])
END

cat > Makefile.am <<'END'
ACLOCAL_AMFLAGS = -I m4_2 --verbose
check-local:
	test ! -r foo
	test -f bar
DISTCLEANFILES = bar
END

$ACLOCAL -I m4_1 >output 2>&1 || { cat output; exit 1; }
cat output
grep 'found macro' output && exit 1 # Sanity check.
$AUTOCONF
$AUTOMAKE

./configure
test -f foo
rm -f foo

# ACLOCAL_AMFLAGS is used in rebuild rules, so trigger them.
$sleep

sed 's/MACRO_FOO/MACRO_BAR/' configure.ac > t
mv -f t configure.ac

run_make -M Makefile
grep "^aclocal.*:.*found macro.*MACRO_BAR.*m4_2/bar\.m4" output
grep "macro.*MACRO_FOO" output && exit 1
test ! -r foo
test -f bar

$MAKE distcheck

: