summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2020-11-05 08:59:46 -0500
committerZack Weinberg <zackw@panix.com>2020-11-05 08:59:46 -0500
commitaa27fc5707c6be8c921548d5a2c408f24a125a09 (patch)
treea151b61b66b8364edab01673ef2cb08cb9b6b408
parent972e83200f3e015c8e531d9a416a944af588c85f (diff)
downloadautoconf-aa27fc5707c6be8c921548d5a2c408f24a125a09.tar.gz
Define AC_REQUIRE_AUX_FILE with AC_DEFUN.
Some widely used Automake recipes involve putting AC_REQUIRE_AUX_FILE at top level of a configure script, and it uses AC_REQUIRE now, so it needs to be defined with AC_DEFUN. * lib/autoconf/general.m4 (AC_REQUIRE_AUX_FILE): Define with AC_DEFUN. * tests/torture.at (Missing auxiliary files (foreign)): New test.
-rw-r--r--lib/autoconf/general.m42
-rw-r--r--tests/torture.at49
2 files changed, 49 insertions, 2 deletions
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 4ec2317c..b74a441f 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -1789,7 +1789,7 @@ AC_DEFUN([AC_CONFIG_AUX_DIRS],
# required auxiliary files, the script will bomb out. This macro may also
# be used as a trace hook by tools that wish to identify all of the required
# auxiliary files.
-m4_define([AC_REQUIRE_AUX_FILE],
+AC_DEFUN([AC_REQUIRE_AUX_FILE],
[AS_LITERAL_WORD_IF([$1],
[m4_do(
[AC_REQUIRE([_AC_INIT_AUX_DIR])],
diff --git a/tests/torture.at b/tests/torture.at
index a96af651..46466f34 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -1964,7 +1964,7 @@ AT_CLEANUP
## Missing auxiliary files. ##
## ------------------------- ##
-AT_SETUP([Missing auxiliary files])
+AT_SETUP([Missing auxiliary files (config.*)])
AT_KEYWORDS([autoreconf])
# Prevent autoreconf from running aclocal, which might not exist,
@@ -2023,6 +2023,12 @@ AT_CHECK([test ! -e build-aux/install-sh])
AT_CHECK_CONFIGURE
+AT_CLEANUP
+
+
+AT_SETUP([Missing auxiliary files (install-sh)])
+AT_KEYWORDS([autoreconf])
+
# Repeat all the above tests with a configure script that _doesn't_
# need config.{sub,guess} but does need install-sh.
@@ -2062,6 +2068,47 @@ AT_CHECK_CONFIGURE
AT_CLEANUP
+
+AT_SETUP([Missing auxiliary files (foreign)])
+AT_KEYWORDS([autoreconf])
+
+# If an aux file is required that autoreconf doesn't know how to install,
+# it shouldn't suggest autoreconf --install.
+# This also verifies that AC_REQUIRE_AUX_FILE can be used outside of a
+# macro definition, which was always the intent, and was recommended
+# usage in some automake recipes, but which was broken in autoconf
+# beta 2.69d (see https://savannah.gnu.org/support/?110363).
+
+AT_DATA([configure.ac],
+[[AC_INIT([GNU foo], [1.0])
+AC_CONFIG_AUX_DIR([build-aux])
+AC_REQUIRE_AUX_FILE([tap-driver.sh])
+AC_OUTPUT
+]])
+
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE([], [1], [ignore],
+[configure: error: cannot find required auxiliary files: tap-driver.sh
+])
+
+AT_CHECK([autoreconf], 1, [],
+[configure.ac: error: required file 'tap-driver.sh' not found
+])
+AT_CHECK([test ! -e build-aux])
+
+AT_CHECK([autoreconf --install], 1, [],
+[configure.ac: error: required file 'tap-driver.sh' not found
+])
+# autoreconf --install always creates the aux directory.
+AT_CHECK([test -e build-aux])
+
+touch build-aux/tap-driver.sh
+
+AT_CHECK([autoreconf])
+AT_CHECK_CONFIGURE
+
+AT_CLEANUP
+
## ------------------------------ ##
## Files clobbered by AC_OPENMP. ##
## ------------------------------ ##