* configure.ac (am_AUTOM4TE): New AC_SUBST'd variable. * tests/defs.in ($AUTOM4TE): New shell variable, defaulting to AC_SUBST'd `...@am_autom4te@'. ($APIVERSION): New variable, AC_SUBST'd. ($ACLOCAL, $AUTOMAKE): Use it. * tests/remake8a.test: New test. * tests/remake8b.test: Likewise. * tests/remake8c.test: Likewise. * tests/remake8d.test: Likewise. * tests/remake8e.test: Likewise. * tests/remake8f.test: Likewise. * tests/remake8g.test: Likewise. * tests/remake8h.test: Likewise. * tests/Makefile.am (TESTS, XFAIL_TESTS): Updated. --- ChangeLog | 16 ++++ Makefile.in | 1 + configure | 6 +- configure.ac | 4 +- doc/Makefile.in | 1 + lib/Automake/Makefile.in | 1 + lib/Automake/tests/Makefile.in | 1 + lib/Makefile.in | 1 + lib/am/Makefile.in | 1 + m4/Makefile.in | 1 + tests/Makefile.am | 12 +++ tests/Makefile.in | 13 +++ tests/defs.in | 7 +- tests/remake8a.test | 94 +++++++++++++++++++++ tests/remake8b.test | 98 ++++++++++++++++++++++ tests/remake8c.test | 111 +++++++++++++++++++++++++ tests/remake8d.test | 179 ++++++++++++++++++++++++++++++++++++++++ tests/remake8e.test | 175 +++++++++++++++++++++++++++++++++++++++ tests/remake8f.test | 119 ++++++++++++++++++++++++++ tests/remake8g.test | 139 +++++++++++++++++++++++++++++++ tests/remake8h.test | 59 +++++++++++++ 21 files changed, 1035 insertions(+), 4 deletions(-) create mode 100755 tests/remake8a.test create mode 100755 tests/remake8b.test create mode 100755 tests/remake8c.test create mode 100755 tests/remake8d.test create mode 100755 tests/remake8e.test create mode 100755 tests/remake8f.test create mode 100755 tests/remake8g.test create mode 100755 tests/remake8h.test
From 67c0e3da12715250249da73d80d9645da11a8a95 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Thu, 12 Aug 2010 18:57:25 +0200 Subject: [PATCH 3/6] Add tests for non-default autotools in rebuild rules.
* configure.ac (am_AUTOM4TE): New AC_SUBST'd variable. * tests/defs.in ($AUTOM4TE): New shell variable, defaulting to AC_SUBST'd `...@am_autom4te@'. ($APIVERSION): New variable, AC_SUBST'd. ($ACLOCAL, $AUTOMAKE): Use it. * tests/remake8a.test: New test. * tests/remake8b.test: Likewise. * tests/remake8c.test: Likewise. * tests/remake8d.test: Likewise. * tests/remake8e.test: Likewise. * tests/remake8f.test: Likewise. * tests/remake8g.test: Likewise. * tests/remake8h.test: Likewise. * tests/Makefile.am (TESTS, XFAIL_TESTS): Updated. --- ChangeLog | 16 ++++ Makefile.in | 1 + configure | 6 +- configure.ac | 4 +- doc/Makefile.in | 1 + lib/Automake/Makefile.in | 1 + lib/Automake/tests/Makefile.in | 1 + lib/Makefile.in | 1 + lib/am/Makefile.in | 1 + m4/Makefile.in | 1 + tests/Makefile.am | 12 +++ tests/Makefile.in | 13 +++ tests/defs.in | 7 +- tests/remake8a.test | 94 +++++++++++++++++++++ tests/remake8b.test | 98 ++++++++++++++++++++++ tests/remake8c.test | 111 +++++++++++++++++++++++++ tests/remake8d.test | 179 ++++++++++++++++++++++++++++++++++++++++ tests/remake8e.test | 175 +++++++++++++++++++++++++++++++++++++++ tests/remake8f.test | 119 ++++++++++++++++++++++++++ tests/remake8g.test | 139 +++++++++++++++++++++++++++++++ tests/remake8h.test | 59 +++++++++++++ 21 files changed, 1035 insertions(+), 4 deletions(-) create mode 100755 tests/remake8a.test create mode 100755 tests/remake8b.test create mode 100755 tests/remake8c.test create mode 100755 tests/remake8d.test create mode 100755 tests/remake8e.test create mode 100755 tests/remake8f.test create mode 100755 tests/remake8g.test create mode 100755 tests/remake8h.test diff --git a/ChangeLog b/ChangeLog index 7f817e0..ac38d7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,21 @@ 2010-08-19 Stefano Lattarini <stefano.lattar...@gmail.com> + Add tests for non-default autotools in rebuild rules. + * configure.ac (am_AUTOM4TE): New AC_SUBST'd variable. + * tests/defs.in ($AUTOM4TE): New shell variable, defaulting + to AC_SUBST'd `...@am_autom4te@'. + ($APIVERSION): New variable, AC_SUBST'd. + ($ACLOCAL, $AUTOMAKE): Use it. + * tests/remake8a.test: New test. + * tests/remake8b.test: Likewise. + * tests/remake8c.test: Likewise. + * tests/remake8d.test: Likewise. + * tests/remake8e.test: Likewise. + * tests/remake8f.test: Likewise. + * tests/remake8g.test: Likewise. + * tests/remake8h.test: Likewise. + * tests/Makefile.am (TESTS, XFAIL_TESTS): Updated. + Testsuite: fix missing*.test for non-default autotools. * tests/missing.test: Build and use our own `autoconf' script, to avoid spurious failures due to configure-time value of $AUTOCONF diff --git a/Makefile.in b/Makefile.in index 528b80e..0284088 100644 --- a/Makefile.in +++ b/Makefile.in @@ -194,6 +194,7 @@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ am_AUTOCONF = @am_AUTOCONF@ am_AUTOHEADER = @am_AUTOHEADER@ +am_AUTOM4TE = @am_AUTOM4TE@ am__leading_dot = @am__leading_dot@ am__tar = @am__tar@ am__untar = @am__untar@ diff --git a/configure b/configure index ae88625..b51f462 100755 --- a/configure +++ b/configure @@ -596,6 +596,7 @@ INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM am_AUTOHEADER +am_AUTOM4TE am_AUTOCONF build_os build_vendor @@ -1766,9 +1767,12 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac # Save the AUTOCONF setting before AM_INIT_AUTOMAKE overrides it; this # way we can run Autoconf tests from configure (or from the test -# suite) without being bothered by `missing'. Likewise for autoheader. +# suite) without being bothered by `missing'. Likewise for autoheader +# and autom4te. am_AUTOCONF="${AUTOCONF-autoconf}" +am_AUTOM4TE="${AUTOM4TE-autom4te}" + am_AUTOHEADER="${AUTOHEADER-autoheader}" diff --git a/configure.ac b/configure.ac index de4583d..90d23ed 100644 --- a/configure.ac +++ b/configure.ac @@ -28,8 +28,10 @@ AC_CANONICAL_BUILD # Save the AUTOCONF setting before AM_INIT_AUTOMAKE overrides it; this # way we can run Autoconf tests from configure (or from the test -# suite) without being bothered by `missing'. Likewise for autoheader. +# suite) without being bothered by `missing'. Likewise for autoheader +# and autom4te. AC_SUBST([am_AUTOCONF], ["${AUTOCONF-autoconf}"]) +AC_SUBST([am_AUTOM4TE], ["${AUTOM4TE-autom4te}"]) AC_SUBST([am_AUTOHEADER], ["${AUTOHEADER-autoheader}"]) AM_INIT_AUTOMAKE([1.10a dist-bzip2 filename-length-max=99 color-tests parallel-tests]) diff --git a/doc/Makefile.in b/doc/Makefile.in index 95a8fb8..6674885 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -161,6 +161,7 @@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ am_AUTOCONF = @am_AUTOCONF@ am_AUTOHEADER = @am_AUTOHEADER@ +am_AUTOM4TE = @am_AUTOM4TE@ am__leading_dot = @am__leading_dot@ am__tar = @am__tar@ am__untar = @am__untar@ diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in index e068ab8..a0ecee3 100644 --- a/lib/Automake/Makefile.in +++ b/lib/Automake/Makefile.in @@ -181,6 +181,7 @@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ am_AUTOCONF = @am_AUTOCONF@ am_AUTOHEADER = @am_AUTOHEADER@ +am_AUTOM4TE = @am_AUTOM4TE@ am__leading_dot = @am__leading_dot@ am__tar = @am__tar@ am__untar = @am__untar@ diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in index 3d28072..7f33269 100644 --- a/lib/Automake/tests/Makefile.in +++ b/lib/Automake/tests/Makefile.in @@ -197,6 +197,7 @@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ am_AUTOCONF = @am_AUTOCONF@ am_AUTOHEADER = @am_AUTOHEADER@ +am_AUTOM4TE = @am_AUTOM4TE@ am__leading_dot = @am__leading_dot@ am__tar = @am__tar@ am__untar = @am__untar@ diff --git a/lib/Makefile.in b/lib/Makefile.in index f90b085..edcd32f 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -183,6 +183,7 @@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ am_AUTOCONF = @am_AUTOCONF@ am_AUTOHEADER = @am_AUTOHEADER@ +am_AUTOM4TE = @am_AUTOM4TE@ am__leading_dot = @am__leading_dot@ am__tar = @am__tar@ am__untar = @am__untar@ diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in index 8924d17..1262c3d 100644 --- a/lib/am/Makefile.in +++ b/lib/am/Makefile.in @@ -141,6 +141,7 @@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ am_AUTOCONF = @am_AUTOCONF@ am_AUTOHEADER = @am_AUTOHEADER@ +am_AUTOM4TE = @am_AUTOM4TE@ am__leading_dot = @am__leading_dot@ am__tar = @am__tar@ am__untar = @am__untar@ diff --git a/m4/Makefile.in b/m4/Makefile.in index 270ee91..e248cfb 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -141,6 +141,7 @@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ am_AUTOCONF = @am_AUTOCONF@ am_AUTOHEADER = @am_AUTOHEADER@ +am_AUTOM4TE = @am_AUTOM4TE@ am__leading_dot = @am__leading_dot@ am__tar = @am__tar@ am__untar = @am__untar@ diff --git a/tests/Makefile.am b/tests/Makefile.am index 35019bb..4a7a0ae 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -21,6 +21,10 @@ all.test \ auxdir2.test \ cond17.test \ gcj6.test \ +remake8d.test \ +remake8e.test \ +remake8g.test \ +remake8h.test \ txinfo5.test include $(srcdir)/parallel-tests.am @@ -602,6 +606,14 @@ remake4.test \ remake5.test \ remake6.test \ remake7.test \ +remake8a.test \ +remake8b.test \ +remake8c.test \ +remake8d.test \ +remake8e.test \ +remake8f.test \ +remake8g.test \ +remake8h.test \ regex.test \ req.test \ reqd.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 91ebcf7..0b65208 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -202,6 +202,7 @@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ am_AUTOCONF = @am_AUTOCONF@ am_AUTOHEADER = @am_AUTOHEADER@ +am_AUTOM4TE = @am_AUTOM4TE@ am__leading_dot = @am__leading_dot@ am__tar = @am__tar@ am__untar = @am__untar@ @@ -248,6 +249,10 @@ all.test \ auxdir2.test \ cond17.test \ gcj6.test \ +remake8d.test \ +remake8e.test \ +remake8g.test \ +remake8h.test \ txinfo5.test parallel_tests = \ @@ -840,6 +845,14 @@ remake4.test \ remake5.test \ remake6.test \ remake7.test \ +remake8a.test \ +remake8b.test \ +remake8c.test \ +remake8d.test \ +remake8e.test \ +remake8f.test \ +remake8g.test \ +remake8h.test \ regex.test \ req.test \ reqd.test \ diff --git a/tests/defs.in b/tests/defs.in index 1744a07..36d1086 100644 --- a/tests/defs.in +++ b/tests/defs.in @@ -54,6 +54,8 @@ test -f "$srcdir/defs.in" || { me=`echo "$0" | sed -e 's,.*[\\/],,;s/\.test$//'` +APIVERSION='@APIVERSION@' + # Make sure we override the user shell. SHELL='@SHELL@' export SHELL @@ -61,12 +63,13 @@ export SHELL test -z "$PERL" && PERL='@PERL@' test -z "$MAKE" && MAKE=make test -z "$AUTOCONF" && AUTOCONF="@am_AUTOCONF@" +test -z "$AUTOM4TE" && AUTOM4TE="@am_AUTOM4TE@" test -z "$AUTOHEADER" && AUTOHEADER="@am_AUTOHEADER@" test -z "$AUTOUPDATE" && AUTOUPDATE=autoupdate test -z "$MISSING" && MISSING=`pwd`/../lib/missing # Use -Werror because this also turns some Perl warnings into error. # (Tests for which this is inappropriate should use -Wno-error.) -test -z "$ACLOCAL" && ACLOCAL="acloc...@apiversion@ -Werror" +test -z "$ACLOCAL" && ACLOCAL="aclocal-$APIVERSION -Werror" # Extra flags to pass to aclocal before all other flags added by this script. ACLOCAL_TESTSUITE_FLAGS= export ACLOCAL_TESTSUITE_FLAGS @@ -77,7 +80,7 @@ export ACLOCAL_TESTSUITE_FLAGS # -Werror by default. Tests for which this is inappropriate # (e.g. when testing that a warning is enabled by a specific switch) # should use -Wnone or/and -Wno-error -test -z "$AUTOMAKE" && AUTOMAKE="automa...@apiversion@ --foreign -Werror -Wall" +test -z "$AUTOMAKE" && AUTOMAKE="automake-$APIVERSION --foreign -Werror -Wall" PATH="`p...@path_separator@$PATH" echo "$PATH" diff --git a/tests/remake8a.test b/tests/remake8a.test new file mode 100755 index 0000000..8d6dfee --- /dev/null +++ b/tests/remake8a.test @@ -0,0 +1,94 @@ +#! /bin/sh +# Copyright (C) 2010 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 that rebuild rules behave properly when no configure-time +# override of autoconf and autom4te is done. + +. ./defs || Exit 1 + +set -e + +: > Makefile.am + +cat > configure.in <<END +AC_INIT([$me], [1.0]) +AM_INIT_AUTOMAKE([foreign -Wall -Werror]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT +END + +mkdir xbin + +for p in autom4te autoconf; do + cat > xbin/$p <<END +#! /bin/sh +echo "Bad $p called: \$0" >&2 +exit 255 +END + cat xbin/$p # for debugging + chmod a+x xbin/$p +done + +# Unfortunately, we cannot just export our $AUTOCONF and $AUTOM4TE for +# use by automake and aclocal. POSIX states that if a Makefile contains +# a macro definition, and this macro has the same name of an exported +# environment variable, then that variable will be redefined by make to +# have the same value of the macro, and thus this will be the value seen +# by make subprocesses. For example: +# $ cat Makefile +# x=1 +# target:; @echo $$x; env | grep '^x=' +# $ x=2 make +# 1 +# x=1 +# Yuck! So we need the following workaround. +for p in automake aclocal; do + cat > xbin/$p <<END +#! /bin/sh +AUTOCONF='$AUTOCONF'; export AUTOCONF +AUTOM4TE='$AUTOM4TE'; export AUTOM4TE +exec '$curdir/$p-$APIVERSION' \${1+"\$@"} +END + cat xbin/$p # for debugging + cp xbin/$p xbin/$p-$APIVERSION + chmod a+x xbin/$p xbin/$p-$APIVERSION +done + +PATH=`pwd`/xbin:$PATH; export PATH + +aclocal-$APIVERSION -Wall -Werror +automake-$APIVERSION -Wall -Werror +$AUTOCONF + +# We don't want configure to pick these vars up from the environment. +unset AUTOCONF +unset AUTOM4TE + +./configure + +$sleep +rm -f aclocal.m4 +touch configure.in +touch Makefile.am + +# The `missing' script should save our day w.r.t. broken autoconf, +# and the rebuild rules shouldn't export the broken autoconf and +# autom4te to the aclocal and automake calls. +$MAKE >output 2>&1 || { cat output; Exit 1; } +cat output +grep 'WARNING:.*missing' output + +: diff --git a/tests/remake8b.test b/tests/remake8b.test new file mode 100755 index 0000000..618684e --- /dev/null +++ b/tests/remake8b.test @@ -0,0 +1,98 @@ +#! /bin/sh +# Copyright (C) 2010 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 automake-generated makefiles wraps autotools calls with +# the `missing' script by default. +# Keep this in sync with sister test `remake8c.test'. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +: > Makefile.am + +cat > configure.in <<END +AC_INIT([$me], [1.0]) +AM_INIT_AUTOMAKE([foreign -Wall -Werror]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT +END + +AUTOCONF="$AUTOCONF" AUTOM4TE="$AUTOM4TE" aclocal-$APIVERSION -Werror -Wall +AUTOCONF="$AUTOCONF" AUTOM4TE="$AUTOM4TE" automake-$APIVERSION -Werror -Wall +AUTOM4TE="$AUTOM4TE" $AUTOCONF -Werror -Wall + +# We don't want AUTOCONF, AUTOMAKE etc. to be picked up by configure, +# so unset them in case the've been exported in the environment. +save_AUTOCONF=$AUTOCONF +save_AUTOM4TE=$AUTOM4TE +unset ACLOCAL +unset AUTOMAKE +unset AUTOCONF +unset AUTOM4TE + +mkdir xbin + +for p in autoconf autom4te; do + cat > xbin/$p <<END +#! /bin/sh +echo 'Fake $p that always fails!' >&2 +exit 255 +END + chmod a+x xbin/$p +done + +for p in automake aclocal; do + cat > xbin/$p <<END +#! /bin/sh +# This is required, otherwise automake and aclocal will try to use +# our fake & always failing autoconf and autom4te. +AUTOCONF='$save_AUTOCONF'; export AUTOCONF +AUTOM4TE='$save_AUTOM4TE'; export AUTOM4TE +exec '$curdir/$p-$APIVERSION' \${1+"\$@"} +END + cat xbin/$p # for debugging + cp -f xbin/$p xbin/$p-$APIVERSION + chmod a+x xbin/$p xbin/$p-$APIVERSION +done + +PATH=`pwd`/xbin:$PATH; export PATH + +./configure + +$sleep +touch configure.in +# Check that the `missing' script kicks in and saves the day. +$MAKE >output 2>&1 || { cat output; Exit 1; } +cat output +grep 'Fake autoconf that always fails!' output +grep 'WARNING:.*autoconf.*missing' output + +rm -f aclocal.m4 +# Check that the `missing' script kicks in and saves the day. +$MAKE >output 2>&1 || { cat output; Exit 1; } +cat output +grep 'Fake autoconf that always fails!' output +grep 'WARNING:.*autoconf.*missing' output + +# Now check that we try to bypass `missing', failures ensue. +./configure AUTOCONF=autoconf +$sleep +touch configure.in +$MAKE && Exit 1 + +: diff --git a/tests/remake8c.test b/tests/remake8c.test new file mode 100755 index 0000000..9addf13 --- /dev/null +++ b/tests/remake8c.test @@ -0,0 +1,111 @@ +#! /bin/sh +# Copyright (C) 2010 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 automake-generated makefiles wraps autotools calls with +# the `missing' script by default. +# Keep this in sync with sister test `remake8b.test'. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +: > Makefile.am + +cat > configure.in <<END +AC_INIT([$me], [1.0]) +AM_INIT_AUTOMAKE([foreign -Wall -Werror]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT +END + +AUTOCONF="$AUTOCONF" AUTOM4TE="$AUTOM4TE" aclocal-$APIVERSION -Werror -Wall +AUTOCONF="$AUTOCONF" AUTOM4TE="$AUTOM4TE" automake-$APIVERSION -Werror -Wall +AUTOM4TE="$AUTOM4TE" $AUTOCONF -Werror -Wall + +# We don't want AUTOCONF, AUTOMAKE etc. to be picked up by configure, +# so unset them in case the've been exported in the environment. +unset ACLOCAL +unset AUTOMAKE +unset AUTOCONF +unset AUTOM4TE + +mkdir xbin + +for p in automake aclocal autoconf autom4te; do + cat > xbin/$p <<END +#! /bin/sh +echo 'Fake $p that always fails!' >&2 +exit 255 +END + cat xbin/$p # for debugging + chmod a+x xbin/$p +done +cp -f xbin/automake xbin/automake-$APIVERSION +cp -f xbin/aclocal xbin/aclocal-$APIVERSION + +PATH=`pwd`/xbin:$PATH; export PATH + +./configure + +$sleep +touch Makefile.am +# Check that the `missing' script kicks in and saves the day. +$MAKE >output 2>&1 || { cat output; Exit 1; } +cat output +grep 'Fake automake that always fails!' output +grep 'WARNING:.*automake.*missing' output + +$sleep +touch configure.in +# Check that the `missing' script kicks in and saves the day. +$MAKE >output 2>&1 || { cat output; Exit 1; } +cat output +grep 'Fake automake that always fails!' output +grep 'WARNING:.*automake.*missing' output +grep 'Fake autoconf that always fails!' output +grep 'WARNING:.*autoconf.*missing' output + +rm -f aclocal.m4 +# Check that the `missing' script kicks in and saves the day. +$MAKE >output 2>&1 || { cat output; Exit 1; } +cat output +grep 'Fake aclocal that always fails!' output +grep 'WARNING:.*aclocal.*missing' output +grep 'Fake automake that always fails!' output +grep 'WARNING:.*automake.*missing' output +grep 'Fake autoconf that always fails!' output +grep 'WARNING:.*autoconf.*missing' output + +# Now check that we try to bypass `missing', failures ensue. +# NOTE: the order of the following tests *is significant*. +# Please do not change it. + +./configure AUTOMAKE=automake +$sleep +touch Makefile.am +$MAKE && Exit 1 + +./configure AUTOCONF=autoconf +$sleep +touch configure.in +$MAKE && Exit 1 + +./configure ACLOCAL=aclocal +rm -f aclocal.m4 +$MAKE && Exit 1 + +: diff --git a/tests/remake8d.test b/tests/remake8d.test new file mode 100755 index 0000000..84406fc --- /dev/null +++ b/tests/remake8d.test @@ -0,0 +1,179 @@ +#! /bin/sh +# Copyright (C) 2010 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 configure-time override of autoconf and autom4te are +# consistently honoured by the automake-generated rebuild rules. +# Keep this in sync with the sister test `remake8e.test'. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +ocwd=`pwd` || Exit 1 + +no_bad_autotools_call() +{ + if find "$ocwd" -name '*.autofail' | grep .; then + Exit 1 + else + : + fi +} + +cat > Makefile.am <<'END' +ACLOCAL_AMFLAGS = -Werror +SUBDIRS = sub +END + +mkdir sub +: > sub/Makefile.am + +cat > configure.in <<END +AC_INIT([$me], [1.0]) +AM_INIT_AUTOMAKE([foreign -Wall -Werror]) +AC_CONFIG_FILES([Makefile sub/Makefile]) +AC_OUTPUT +END + +mkdir xbin +cd xbin + +cat > wrap--Autoconf <<END +#! /bin/sh +exec $AUTOCONF \${1+"\$@"} +END +cat > wrap--Autom4te <<END +#! /bin/sh +exec $AUTOM4TE \${1+"\$@"} +END + +for p in automake aclocal; do + p2=`echo $p | sed 's/a/A/'` + cat > wrap--$p2 <<END +#! /bin/sh +echo "\$0: INFO: AUTOCONF='\$AUTOCONF'" >&2 +echo "\$0: INFO: AUTOM4TE='\$AUTOM4TE'" >&2 +test x"\$AUTOCONF" = x"wrap--Autoconf" || { + : > autoconf-from-$p.autofail + exit 255 +} +test x"\$AUTOM4TE" = x"wrap--Autom4te" || { + : > autom4te-from-$p.autofail + exit 255 +} +exec '$curdir/$p-$APIVERSION' \${1+"\$@"} +END +done + +for p in aclocal automake aclocal-$APIVERSION automake-$APIVERSION \ + autom4te autoconf +do + cat > $p <<END +#! /bin/sh +echo "BAD: $p (\$0) called" >&2 +: > $p.autofail +exit 255 +END +done + +cd .. + +ls -l xbin # for debugging +for f in xbin/*; do + chmod a+x $f + cat $f # for debugging +done + +PATH=$ocwd/xbin:$PATH; export PATH + +unset AUTOCONF +unset AUTOM4TE +unset AUTOMAKE +unset ACLOCAL + +AUTOCONF=wrap--Autoconf AUTOM4TE=wrap--Autom4te wrap--Aclocal -Werror +AUTOCONF=wrap--Autoconf AUTOM4TE=wrap--Autom4te wrap--Automake -Werror -Wall +AUTOM4TE=wrap--Autom4te wrap--Autoconf -Werror -Wall + +# Now check that aclocal and automake calls in Makefile always use +# the configure-time autoconf and autom4te. + +for vpath in : false; do + + if $vpath; then + srcdir=$ocwd + rm -rf build + mkdir build + cd build + else + srcdir=. + fi + + "$srcdir"/configure AUTOCONF=wrap--Autoconf AUTOM4TE=wrap--Autom4te \ + AUTOMAKE=wrap--Automake ACLOCAL=wrap--Aclocal + + # Try to trigger rebuold rules in different situations. + rm -f "$srcdir"/configure "$srcdir"/aclocal.m4 + rm -f "$srcdir"/Makefile.in "$srcdir"/sub/Makefile.in + $MAKE + no_bad_autotools_call + test -f "$srcdir"/configure + test -f "$srcdir"/aclocal.m4 + test -f "$srcdir"/Makefile.in + test -f "$srcdir"/sub/Makefile.in + + rm -f "$srcdir"/Makefile.in "$srcdir"/sub/Makefile.in + cd sub + $MAKE + no_bad_autotools_call + cd .. + test -f "$srcdir"/sub/Makefile.in + # Rebuild rules in subdir are "greedy" + test -f "$srcdir"/Makefile.in + + $sleep + touch "$srcdir"/Makefile.am + $MAKE + no_bad_autotools_call + + $sleep + touch "$srcdir"/sub/Makefile.am + cd sub + $MAKE + cd .. + no_bad_autotools_call + + $sleep + touch "$srcdir"/sub/Makefile.am + $MAKE + no_bad_autotools_call + + $sleep + touch "$srcdir"/configure.in + rm -f aclocal.m4 + $MAKE + no_bad_autotools_call + + $MAKE distclean + + if $vpath; then + cd $srcdir + fi + +done + +: diff --git a/tests/remake8e.test b/tests/remake8e.test new file mode 100755 index 0000000..a3981b7 --- /dev/null +++ b/tests/remake8e.test @@ -0,0 +1,175 @@ +#! /bin/sh +# Copyright (C) 2010 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 configure-time override of autoconf and autom4te are +# consistently honoured by the automake-generated rebuild rules. +# Keep this in sync with the sister test `remake8d.test'. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +ocwd=`pwd` || Exit 1 + +no_bad_autotools_call() +{ + if find "$ocwd" -name '*.autofail' | grep .; then + Exit 1 + else + : + fi +} + +cat > Makefile.am <<'END' +ACLOCAL_AMFLAGS = -Werror +SUBDIRS = sub +END + +mkdir sub +: > sub/Makefile.am + +cat > configure.in <<END +AC_INIT([$me], [1.0]) +AM_INIT_AUTOMAKE([foreign -Wall -Werror]) +AC_CONFIG_FILES([Makefile sub/Makefile]) +AC_OUTPUT +END + +mkdir xbin +cd xbin + +cat > wrap--Autoconf <<END +#! /bin/sh +exec $AUTOCONF \${1+"\$@"} +END +cat > wrap--Autom4te <<END +#! /bin/sh +exec $AUTOM4TE \${1+"\$@"} +END + +for p in autom4te autoconf; do + cat > $p <<END +#! /bin/sh +echo "BAD: $p (\$0) called" >&2 +: > $p.autofail +exit 255 +END +done + +for p in automake aclocal; do + cat > $p <<END +#! /bin/sh +echo "\$0: INFO: AUTOCONF='\$AUTOCONF'" >&2 +echo "\$0: INFO: AUTOM4TE='\$AUTOM4TE'" >&2 +test x"\$AUTOCONF" = x"wrap--Autoconf" || { + : > autoconf-from-$p.autofail + exit 255 +} +test x"\$AUTOM4TE" = x"wrap--Autom4te" || { + : > autom4te-from-$p.autofail + exit 255 +} +exec '$curdir/$p-$APIVERSION' \${1+"\$@"} +END +done + +cd .. + +ls -l xbin # for debugging +for f in xbin/*; do + chmod a+x $f + cat $f # for debugging +done + +PATH=$ocwd/xbin:$PATH; export PATH + +unset AUTOCONF +unset AUTOM4TE +unset AUTOMAKE +unset ACLOCAL + +AUTOCONF=wrap--Autoconf AUTOM4TE=wrap--Autom4te aclocal -Werror +AUTOCONF=wrap--Autoconf AUTOM4TE=wrap--Autom4te automake --foreign -Werror -Wall +AUTOM4TE=wrap--Autom4te wrap--Autoconf -Werror -Wall + +# Now check that aclocal and automake calls in Makefile always use +# the configure-time autoconf and autom4te. + +for vpath in : false; do + + if $vpath; then + srcdir=$ocwd + rm -rf build + mkdir build + cd build + else + srcdir=. + fi + + "$srcdir"/configure AUTOCONF=wrap--Autoconf AUTOM4TE=wrap--Autom4te + + # Try to trigger rebuold rules in different situations. + rm -f "$srcdir"/configure "$srcdir"/aclocal.m4 + rm -f "$srcdir"/Makefile.in "$srcdir"/sub/Makefile.in + $MAKE + no_bad_autotools_call + test -f "$srcdir"/configure + test -f "$srcdir"/aclocal.m4 + test -f "$srcdir"/Makefile.in + test -f "$srcdir"/sub/Makefile.in + + rm -f "$srcdir"/Makefile.in "$srcdir"/sub/Makefile.in + cd sub + $MAKE + no_bad_autotools_call + cd .. + test -f "$srcdir"/sub/Makefile.in + # Rebuild rules in subdir are "greedy" + test -f "$srcdir"/Makefile.in + + $sleep + touch "$srcdir"/Makefile.am + $MAKE + no_bad_autotools_call + + $sleep + touch "$srcdir"/sub/Makefile.am + cd sub + $MAKE + cd .. + no_bad_autotools_call + + $sleep + touch "$srcdir"/sub/Makefile.am + $MAKE + no_bad_autotools_call + + $sleep + touch "$srcdir"/configure.in + rm -f aclocal.m4 + $MAKE + no_bad_autotools_call + + $MAKE distclean + + if $vpath; then + cd $srcdir + fi + +done + +: diff --git a/tests/remake8f.test b/tests/remake8f.test new file mode 100755 index 0000000..1554dae --- /dev/null +++ b/tests/remake8f.test @@ -0,0 +1,119 @@ +#! /bin/sh +# Copyright (C) 2010 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/>. + +# We expect the `missing' script *never* to wrap autoconf and autom4te +# calls *done by automake and aclocal* in our rebuild rules. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +: > Makefile.am + +cat >> configure.in <<END +AC_OUTPUT +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +mkdir xbin +cat > xbin/autoconf <<END +#! /bin/sh +exec $AUTOCONF \${1+"\$@"} +END +cat > xbin/autom4te <<END +#! /bin/sh +exec $AUTOM4TE \${1+"\$@"} +END +chmod a+x xbin/autoconf xbin/autom4te + +PATH=`pwd`/xbin:$PATH; export PATH + +cat > missing <<'END' +#! /bin/sh +if test x"$1" = x"--run"; then + shift + case $1 in + autom4te|autoconf) + echo "Oops! The \`missing' script has called $1!" >&2 + echo "This should have been never happened in this test." >&2 + : > missing.fail + exit 255 + ;; + *) + # Just assume we have the tool, and run it. This should be safe + # given our usage of missing here. + exec "$@" + exit 255 # notreached + ;; + esac +else + echo "Botched \`missing' call detected!" >&2 + echo "Arguments were: $*" >&2 + exit 255 +fi +exit 255 # notreached +END +chmod a+x missing + +no_bad_missing_call() +{ + if find . -name missing.fail | grep .; then + Exit 1 + else + : + fi +} + +# The configure script should not take up any of these from the +# environment. +save_AUTOCONF=$AUTOCONF +unset ACLOCAL +unset AUTOMAKE +unset AUTOCONF +unset AUTOM4TE + +./configure + +$sleep +touch Makefile.am +$MAKE +no_bad_missing_call + +rm -f Makefile.in +$MAKE +no_bad_missing_call + +$MAKE distclean + +# To test more comprehensive rebuild rules, we have to be able to +# call autoconf. +./configure AUTOCONF="$save_AUTOCONF" + +$sleep +touch configure.in +$MAKE +no_bad_missing_call + +$sleep +rm -f aclocal.m4 +$MAKE +no_bad_missing_call + +: diff --git a/tests/remake8g.test b/tests/remake8g.test new file mode 100755 index 0000000..2c5d85b --- /dev/null +++ b/tests/remake8g.test @@ -0,0 +1,139 @@ +#! /bin/sh +# Copyright (C) 2010 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 configure-time override of autoconf and autom4te are +# consistently honoured by the automake-generated rebuild rules. +# Also, check that such rebuild rules are not uselessly run. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +# We might modify/unset this variables later, so save them. +save_PATH=$PATH +save_AUTOCONF=$AUTOCONF +save_AUTOM4TE=$AUTOM4TE + +AUTOCONF=false; export AUTOCONF +AUTOM4TE=false; export AUTOM4TE + +cat > Makefile.am <<'END' +SUBDIRS = sub +END + +mkdir sub +: > sub/Makefile.am + +cat >> configure.in <<'END' +AC_CONFIG_FILES([sub/Makefile]) +AC_OUTPUT +END + +AUTOCONF="$save_AUTOCONF" AUTOM4TE="$save_AUTOM4TE" $ACLOCAL +AUTOCONF="$save_AUTOCONF" AUTOM4TE="$save_AUTOM4TE" $AUTOMAKE +AUTOM4TE="$save_AUTOM4TE" $save_AUTOCONF -Werror -Wall + +# Now check that aclocal and automake calls in Makefile always use +# the configure-time autoconf and autom4te. + +mkdir xbin +cat > xbin/wrap-autoconf <<END +#! /bin/sh +: > ac.run +exec $save_AUTOCONF \${1+"\$@"} +END +cat > xbin/wrap-autom4te <<END +#! /bin/sh +: > am4t.run +exec $save_AUTOM4TE \${1+"\$@"} +END +chmod a+x xbin/wrap-autoconf xbin/wrap-autom4te + +PATH=`pwd`/xbin:$PATH; export PATH + +./configure AUTOCONF=wrap-autoconf AUTOM4TE=wrap-autom4te + +# Try to remove every autotools-generated file, and to remake everything. + +rm -f configure aclocal.m4 Makefile.in sub/Makefile.in +$MAKE +test -f configure +test -f aclocal.m4 +test -f Makefile.in +test -f sub/Makefile.in +# Check that our autotools wrappers have really run. +test -f ac.run +test -f am4t.run +# Cleanup. +rm -f *.run sub/*.run + +# Redo the same checks, but with subset of generated files. +# Since we are at it, throw in also some tame "stress" tests. + +rm -f Makefile.in +$MAKE +test -f Makefile.in +# Check that our autotools wrappers have really run. +test -f ac.run +test -f am4t.run +# Cleanup. +rm -f *.run sub/*.run + +cd sub +$sleep +touch Makefile.am +$MAKE +# Check that the expected code path in the Makefile has been triggered. +# The *.run files must be in `..' because the rebuilt rules are always +# run in the top srcdir. +test -f ../am4t.run +test -f ../ac.run +test ! -r am4t.run +test ! -r ac.run +cd .. +rm -f *.run sub/*.run + +# Now check that rebuild rules are not uselessly triggered. +$sleep +echo .PHONY: foo-Bar-QUUX >> Makefile +$MAKE +test ! -r ac.run +test ! -r sub/ac.run +test ! -r am4t.run +test ! -r sub/am4t.run +$FGREP foo-Bar-QUUX Makefile +$sleep +echo : foo-Bar-QUUX >> configure +echo .PHONY: foo-Bar-QUUX >> Makefile.in +$MAKE +test ! -r ac.run +test ! -r sub/ac.run +test ! -r am4t.run +test ! -r sub/am4t.run +$FGREP foo-Bar-QUUX configure +$FGREP foo-Bar-QUUX Makefile.in +$FGREP foo-Bar-QUUX Makefile +$sleep +touch configure.in +$MAKE +test -f ac.run +test -f am4t.run +$FGREP foo-Bar-QUUX configure && Exit 1 +$FGREP foo-Bar-QUUX Makefile && Exit 1 +$FGREP foo-Bar-QUUX Makefile.in && Exit 1 + +: diff --git a/tests/remake8h.test b/tests/remake8h.test new file mode 100755 index 0000000..3e83637 --- /dev/null +++ b/tests/remake8h.test @@ -0,0 +1,59 @@ +#! /bin/sh +# Copyright (C) 2010 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/>. + +# Automake-generated remake rules: some grepping checks. + +. ./defs || Exit 1 + +set -e + +cat > Makefile.am <<'END' +SUBDIRS = sub +END + +mkdir sub +: > sub/Makefile.am + +cat >> configure.in <<END +AC_CONFIG_FILES([sub/Makefile]) +AC_OUTPUT +END + +$ACLOCAL +$AUTOMAKE + +grep '^ACLOCAL *=' Makefile.in +grep '^AUTOMAKE *=' Makefile.in +grep '^AUTOCONF *=' Makefile.in +grep '^AUTOM4TE *=' Makefile.in + +$AUTOCONF -Werror -Wall + +# We don't want AUTOCONF, AUTOMAKE etc. to be picked up by configure, +# so unset them in case the've been exported in the environment. +unset ACLOCAL +unset AUTOMAKE +unset AUTOCONF +unset AUTOM4TE + +./configure + +grep "^ACLOCAL *=.*/missing --run aclocal-$APIVERSION *$" Makefile +grep "^AUTOMAKE *=.*/missing --run automake-$APIVERSION *$" Makefile +grep "^AUTOCONF *=.*/missing --run autoconf *$" Makefile +grep "^AUTOM4TE *=.*/missing --run autom4te *$" Makefile + +: -- 1.7.1