summaryrefslogtreecommitdiff
path: root/t/aclocal-amflags.sh
blob: 10f0cb185d4aec7d7707ffda825900600cb5ee80 (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
#! /bin/sh
# Copyright (C) 2012-2013 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/>.

# Check that the obsolescent idiom of setting $(ACLOCAL_AMFLAGS) in
# Makefile.am is warned against, but 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

for opts in '' '-Wnone -Wobsolete'; do
  AUTOMAKE_fails $opts
  grep "Makefile\.am:.*'ACLOCAL_AMFLAGS' is deprecated" stderr
  grep "Makefile\.am:.*'AC_CONFIG_MACRO_DIRS'.*configure\.ac.*instead" stderr
done

echo AUTOMAKE_OPTIONS = -Wall -Wno-obsolete >> Makefile.am
cat Makefile.am # For debugging.
$AUTOMAKE -Werror

./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

$MAKE Makefile >output 2>&1 || { cat output; exit 1; }
cat output
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

: