end
]])
-# Prevent autoreconf from running aclocal, which might not exist,
-# or could barf over warnings in third-party macro files.
-AT_DATA([aclocal.m4])
-ACLOCAL=true
-export ACLOCAL
-
+AT_SUPPRESS_ACLOCAL
AT_CHECK([autoreconf -vi], [], [ignore], [ignore])
AT_CHECK_CONFIGURE
AT_CHECK_MAKE
end
]])
-# Prevent autoreconf from running aclocal, which might not exist,
-# or could barf over warnings in third-party macro files.
-AT_DATA([aclocal.m4])
-ACLOCAL=true
-export ACLOCAL
-
+AT_SUPPRESS_ACLOCAL
AT_CHECK([autoreconf -vi], [], [ignore], [ignore])
AT_CHECK_CONFIGURE
AT_CHECK_MAKE
# Programs this package provides
AT_TESTED([autom4te autoconf autoheader autoupdate autoreconf ifnames])
-# System-provided programs that this package relies on
-AT_TESTED([$M4 $PERL ${CONFIG_SHELL-$SHELL} $MAKE])
# Enable colored test output.
AT_COLOR_TESTS
CONFIG_SITE=`pwd`/nonexistent/config.site
export CONFIG_SITE
-# Ensure MAKE is set to a useful value. Unlike the above, we *do*
-# want to inherit this variable from the parent environment and/or
-# our command line.
+# Ensure MAKE, AUTOMAKE, and ACLOCAL are set to useful values. Unlike
+# the above, we *do* want to inherit these variables from the parent
+# environment and/or our command line. Also, detect now whether
+# automake and aclocal are unavailable or too old.
: "${MAKE=make}"
export MAKE
+# Some old versions of automake, when used with newer Perl interpreters,
+# will print a warning message about their own Perl code on every
+# invocation, which breaks various tests' expectations for output.
+# This also weeds out broken wrapper scripts; in the past some vendors
+# have shipped an 'automake' that didn't work without user configuration.
+: "${AUTOMAKE=automake}"
+at_automake_version="`$AUTOMAKE --version 2>&1 || echo not found`"
+at_automake_version_1="`AS_ECHO(["$at_automake_version"]) | sed 1q`"
+AS_CASE([$at_automake_version_1],
+ [[*GNU*\)\ [1-9]\.[0-9]*]], [],
+ [AUTOMAKE=false])
+export AUTOMAKE
+
+# Used in the code below that decides delay intervals.
+if test "$AUTOMAKE" == false
+then
+ # If automake is unavailable, then whether it supports subsecond
+ # mtime is moot.
+ at_automake_subsecond_mtime=:
+elif AS_ECHO(["$at_automake_version"]) |
+ grep 'Features: subsecond-mtime' > /dev/null 2>&1
+then
+ at_automake_subsecond_mtime=:
+else
+ at_automake_subsecond_mtime=false
+fi
+
+# The same Perl and wrapper issues exist with aclocal. Also, we
+# require a version that understands --system-acdir and configure.ac.
+: "${ACLOCAL=aclocal}"
+at_aclocal_version="`$ACLOCAL --version 2>&1 || echo not found`"
+at_aclocal_version_1="`AS_ECHO(["$at_aclocal_version"]) | sed 1q`"
+AS_CASE([$at_aclocal_version_1],
+ [[*GNU*\)\ [1-9]\.[0-9]*]],
+ [mkdir at_scratch
+ (cd at_scratch &&
+ touch configure.ac &&
+ mkdir empty &&
+ $ACLOCAL --system-acdir=`pwd`/empty) || ACLOCAL=false
+ rm -rf at_scratch],
+ [ACLOCAL=false])
+export ACLOCAL
+
+# Prevent aclocal from reading third-party macros, in case they are buggy.
+# (AM_INIT_AUTOMAKE will still be available via the default --automake-acdir.)
+if test "$ACLOCAL" != false; then
+ test -d at_empty_dir || mkdir at_empty_dir
+ ACLOCAL="$ACLOCAL --system-acdir=`cd at_empty_dir && pwd`"
+fi
+
# Determine how long we need to delay in between operations that might
# modify autom4te.cache. This depends on three factors: whether the
# 'sleep' utility supports fractional seconds in its argument; what
# Default to the coarsest case.
at_ts_resolution=2
-# Only try to go finer than 1s if sleep, autom4te, and automake
+# Only try to go finer than 1s if sleep, autom4te, and automake (if present)
# can all handle it.
at_try_resolutions=1
if sleep 0.001 2>/dev/null &&
autom4te --version 2>&1 |
grep 'Features:.*subsecond-mtime' > /dev/null 2>&1 &&
- automake --version 2>&1 |
- grep 'Features:.*subsecond-mtime' > /dev/null 2>&1
+ $at_automake_subsecond_mtime
then
at_try_resolutions="0.001 0.01 0.1 $at_try_resolutions"
fi
done
rm -f conftest.ts?
-AS_ECHO(["$at_srcdir/AT_LINE: using ${at_ts_resolution}s as timestamp resolution
-"]) >&AS_MESSAGE_LOG_FD
+# AT_TESTED doesn't support variables in its argument, particularly
+# when they might contain the name of a program along with some
+# arguments, or when they might evaluate to 'false'.
+# Do this in a subshell to contain the effects of 'set'.
+(status=0
+AS_BOX([System supplied programs that we depend on.])
+echo
+for at_program in \
+ "r m4 $M4" \
+ "r perl $PERL" \
+ "r sh ${CONFIG_SHELL-$SHELL}" \
+ "r make $MAKE" \
+ "o automake $AUTOMAKE" \
+ "o aclocal $ACLOCAL"
+do
+ # The first three words of $at_program are a code for whether
+ # it's required (r) or optional (o); the conventional name of the
+ # program (for error messages); and the name (possibly a pathname)
+ # we were told to use for it.
+ set dummy $at_program
+ at_required=$[]2
+ at_prog_name=$[]3
+ at_prog_use=$[]4
+ at_prog_use_=
+
+ AS_CASE(["$at_prog_use"],
+ [: | true | false], [],
+ [[[\\/]* | ?:[\\/]*]],
+ [test -f "$at_prog_use" && at_prog_use_=$at_prog_use],
+ [_AS_PATH_WALK([$PATH],
+ [if test -f "$as_dir$at_prog_use"; then
+ at_prog_use_=$as_dir$at_prog_use
+ break
+ fi])])
+
+ if test -n "$at_prog_use_"; then
+ {
+ AS_ECHO(["# $at_prog_name is $at_prog_use_"])
+ AS_ECHO(["$at_prog_use_ --version"])
+ "$at_prog_use_" --version </dev/null
+ } >&AS_MESSAGE_LOG_FD 2>&1
+ elif test $at_required = r; then
+ AS_ECHO(["*** Required program $at_prog_name is unavailable."])
+ status=1
+ else
+ AS_ECHO(["# $at_prog_name is unavailable"])
+ fi
+ echo
+done
+
+AS_ECHO(["$at_srcdir/AT_LINE: using ${at_ts_resolution}s as mtime resolution"])
+echo
+exit $status
+) >&AS_MESSAGE_LOG_FD 2>&1
+
+if test $? -ne 0; then
+ AS_ERROR([*** Some required programs were not found.])
+fi
])
m4_define([AT_MTIME_DELAY],
[sleep $at_ts_resolution])
+# AT_REQUIRE_AUTOMAKE
+# -------------------
+# Skip this test if automake is unavailable or too old.
+m4_define([AT_REQUIRE_AUTOMAKE],
+[AT_SKIP_IF([test "$AUTOMAKE" = false])])
+
+# AT_REQUIRE_ACLOCAL
+# ------------------
+# Skip this test if aclocal is unavailable or too old.
+m4_define([AT_REQUIRE_ACLOCAL],
+[AT_SKIP_IF([test "$ACLOCAL" = false])])
+
+# AT_SUPPRESS_ACLOCAL
+# -------------------
+# Prevent autoreconf from running aclocal, which might not be available.
+# Use this instead of AT_REQUIRE_ACLOCAL in tests that run autoreconf
+# but don't need aclocal to do anything.
+m4_define([AT_SUPPRESS_ACLOCAL],
+[AT_DATA([aclocal.m4])
+ACLOCAL=true])
+
## ---------------- ##
## Testing syntax. ##
## ---------------- ##
# ----------------------------------------
AT_SETUP([autoupdating with aclocal and m4@&t@_include])
-# We use aclocal.
-AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
-
-# Prevent aclocal from reading third-party macros, in case they are buggy.
-mkdir empty
-ACLOCAL="aclocal --system-acdir=`cd empty && pwd`"
-export ACLOCAL
+AT_REQUIRE_ACLOCAL
mkdir m4 aclocal
AT_DATA([configure.ac],
# -----------------------------
AT_SETUP([autom4te preselections])
-# We use aclocal and automake. Skip broken automake wrappers.
-AT_CHECK([automake --version || exit 77], [], [stdout], [ignore])
-AT_CHECK([[grep '[1-9]\.[0-9]' stdout || exit 77]], [], [ignore])
-AT_CHECK([test ! -f $HOME/.autom4te.cfg || exit 77], [], [ignore], [ignore])
-# Prevent aclocal from reading third-party macros, in case they are buggy.
-# (AM_INIT_AUTOMAKE will still be available via the default --automake-acdir.)
-mkdir empty
-ACLOCAL="aclocal --system-acdir=`cd empty && pwd`"
-export ACLOCAL
+AT_REQUIRE_AUTOMAKE
+AT_REQUIRE_ACLOCAL
+
+# This user configuration file will interfere with this test.
+AT_CHECK([test ! -f $HOME/.autom4te.cfg || exit 77], [], [ignore], [ignore])
AT_DATA([configure.ac],
[[AC_INIT(GNU foo, 1.0)
AT_SETUP([autotools and whitespace in file names])
-# Prevent autoreconf from running aclocal, which might not exist,
-# or could barf over warnings in third-party macro files.
-ACLOCAL=true
-export ACLOCAL
+AT_SUPPRESS_ACLOCAL
x=
export x
AT_CHECK([autoscan --force -I "$dir"], [], [], [ignore])
# autoreconf requires a sane input file name.
mv -f "$file.ac" configure.ac
- # Since aclocal is disabled, provide a stub aclocal.m4.
- AT_DATA([aclocal.m4])
AT_CHECK([autoreconf -B "$dir"])
AT_CHECK([autoreconf --force -I "$dir"])
AT_SETUP([autotools and relative TMPDIR])
-# We use aclocal.
-AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
-
-# Prevent aclocal from reading third-party macros, in case they are buggy.
-mkdir empty
-ACLOCAL="aclocal --system-acdir=`cd empty && pwd`"
-export ACLOCAL
+AT_REQUIRE_ACLOCAL
mkdir _tmp
TMPDIR=_tmp
AT_SETUP([Configuring subdirectories])
AT_KEYWORDS(autoreconf)
-# We use aclocal (via autoreconf).
-AT_CHECK([aclocal --version || exit 77], [], [stdout], [ignore])
-AT_CHECK([[grep '[1-9]\.[0-9]' stdout || exit 77]], [], [ignore])
-
-# It should understand configure.ac.
-AT_CHECK([[grep '[^0-9]1\.[01234][^0-9]' stdout && exit 77]], [1], [ignore])
-
-# Prevent aclocal from reading third-party macros, in case they are buggy.
-mkdir empty
-ACLOCAL="aclocal --system-acdir=`cd empty && pwd`"
-export ACLOCAL
+AT_REQUIRE_ACLOCAL
# The contents of 'inner/', and 'inner/innermost/'.
AS_MKDIR_P([inner/innermost])
AT_SETUP([Deep Package])
AT_KEYWORDS(autoreconf)
-# We use aclocal (via autoreconf).
-AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
-
-# Prevent aclocal from reading third-party macros, in case they are buggy.
-mkdir empty
-ACLOCAL="aclocal --system-acdir=`cd empty && pwd`"
-export ACLOCAL
+AT_REQUIRE_ACLOCAL
# The contents of '.'
AT_DATA([install-sh], [])
AT_KEYWORDS([autoreconf])
# We use aclocal (via autoreconf).
-AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
-
-# Prevent aclocal from reading third-party macros, in case they are buggy.
-mkdir empty
-ACLOCAL="aclocal --system-acdir=`cd empty && pwd`"
-export ACLOCAL
+AT_REQUIRE_ACLOCAL
AT_DATA([install-sh], [])
AT_DATA([configure.ac],
AC_OUTPUT
]])
-# Prevent autoreconf from running aclocal, which might not exist,
-# or could barf over warnings in third-party macro files.
-AT_DATA([aclocal.m4])
-ACLOCAL=true
-export ACLOCAL
-
+AT_SUPPRESS_ACLOCAL
AS_MKDIR_P([foo])
AT_DATA([foo/configure],
AC_OUTPUT
]])
-# Prevent autoreconf from running aclocal, which might not exist,
-# or could barf over warnings in third-party macro files.
-AT_DATA([aclocal.m4])
-ACLOCAL=true
-export ACLOCAL
-
+AT_SUPPRESS_ACLOCAL
# autoreconf should have no complaints, and the generated configure
# script should run fine with or without --no-recursion.
AT_CHECK([autoreconf -Werror], [0], [ignore])
AT_SETUP([Empty directory])
AT_KEYWORDS([autoreconf])
-# Prevent autoreconf from running aclocal, which might not exist,
-# or could barf over warnings in third-party macro files.
+# Prevent autoreconf from running aclocal, which might not be available.
+dnl We can't use AT_SUPPRESS_ACLOCAL here because it creates an aclocal.m4.
ACLOCAL=true
-export ACLOCAL
# The test group directory is not necessarily _empty_, but it does not contain
# files meaningful to 'autoreconf'.
AT_SETUP([Unusual Automake input files])
AT_KEYWORDS([autoreconf])
-# We use aclocal and automake via autoreconf.
-AT_CHECK([automake --version || exit 77], [], [stdout], [ignore])
-AT_CHECK([[grep '[1-9]\.[0-9]' stdout || exit 77]], [], [ignore])
-
-# Prevent aclocal from reading third-party macros, in case they are buggy.
-# (AM_INIT_AUTOMAKE will still be available via the default --automake-acdir.)
-mkdir empty
-ACLOCAL="aclocal --system-acdir=`cd empty && pwd`"
-export ACLOCAL
+AT_REQUIRE_AUTOMAKE
+AT_REQUIRE_ACLOCAL
AT_DATA([configure.ac],
[[AC_INIT(GNU foo, 1.0)
# --help output, that option should not cause errors, even if some
# of the subsidiary programs don't support it.
-# We use aclocal and automake via autoreconf.
-AT_CHECK([automake --version || exit 77], [], [ignore], [ignore])
-
-# Prevent aclocal from reading third-party macros, in case they are buggy.
-# (AM_INIT_AUTOMAKE will still be available via the default --automake-acdir.)
-mkdir empty
-ACLOCAL="aclocal --system-acdir=`cd empty && pwd`"
-export ACLOCAL
+AT_REQUIRE_AUTOMAKE
+AT_REQUIRE_ACLOCAL
AT_DATA([configure.ac],
[[AC_INIT(GNU foo, 1.0)
AT_SETUP([Missing auxiliary files (config.*)])
AT_KEYWORDS([autoreconf])
-# Prevent autoreconf from running aclocal, which might not exist,
-# or could barf over warnings in third-party macro files.
-AT_DATA([aclocal.m4])
-ACLOCAL=true
-export ACLOCAL
-
+AT_SUPPRESS_ACLOCAL
AT_DATA([configure.ac],
[[AC_INIT([GNU foo], [1.0])
AC_CONFIG_AUX_DIR([build-aux])
# configure script _doesn't_ need config.{sub,guess} but does need
# install-sh.
-# Prevent autoreconf from running aclocal, which might not exist,
-# or could barf over warnings in third-party macro files.
-AT_DATA([aclocal.m4])
-ACLOCAL=true
-export ACLOCAL
-
+AT_SUPPRESS_ACLOCAL
AT_DATA([configure.ac],
[[AC_INIT([GNU foo], [1.0])
AC_CONFIG_AUX_DIR([build-aux])
# usage in some automake recipes, but which was broken in autoconf
# beta 2.69d (see https://savannah.gnu.org/support/?110363).
-# Prevent autoreconf from running aclocal, which might not exist,
-# or could barf over warnings in third-party macro files.
-AT_DATA([aclocal.m4])
-ACLOCAL=true
-export ACLOCAL
-
+AT_SUPPRESS_ACLOCAL
AT_DATA([configure.ac],
[[AC_INIT([GNU foo], [1.0])
AC_CONFIG_AUX_DIR([build-aux])
# Additional wrinkle: in case automake got to the files we install
# first, we need to *not* overwrite a newer copy supplied by them.
-# Prevent autoreconf from running aclocal, which might not exist,
-# or could barf over warnings in third-party macro files.
-AT_DATA([aclocal.m4])
-ACLOCAL=true
-export ACLOCAL
-
+AT_SUPPRESS_ACLOCAL
AT_DATA([configure.ac],
[[AC_INIT([GNU foo], [1.0])
AC_CONFIG_AUX_DIR([build-aux])