blob: 2979b204320e67640218c281dd8c088435a9fce1 [file] [log] [blame]
#! /bin/sh
# Copyright (C) 2012-2017 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 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
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
: