summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2020-10-20 13:36:58 -0400
committerZack Weinberg <zackw@panix.com>2020-10-20 16:57:01 -0400
commit35a1c64600894ecc3b06b6c4b273952db7c8fc83 (patch)
tree52052ed06694e00df4e30d26742b86f875e84b3c /tests
parent4c59bf27d7083088290219450c81d999431b43f1 (diff)
downloadautoconf-35a1c64600894ecc3b06b6c4b273952db7c8fc83.tar.gz
Improve handling of missing aux scripts (autoreconf)
Make ‘autoreconf --install’ add config.sub, config.guess, and install-sh to the source tree when necessary. This is only relevant for packages that don’t use Automake, because ‘automake --add-missing’ already adds these scripts to the source tree, but apparently there are plenty of packages out there that don’t use Automake, didn’t need config.{sub,guess} with autoconf 2.69, and do need them with 2.70. Such packages will need to have their equivalent of ‘make dist’ manually updated to ship the new files, of course. This patch also has ‘autoreconf’ issue an error if aux files are missing and ‘--install’ *wasn’t* used, or if --install *was* used but could not install all the missing files. This error is more likely to be caught by maintainers than the configure-time error added in the previous patch. It is not currently practical to make autoconf itself issue this error message, because of how the autoconf wrapper script is different from all the other wrapper scripts. Also, autoreconf runs automake *after* autoconf, so we’d get spurious errors from packages that do use automake. * bin/autoreconf.in ($buildauxdir): New package global, initialized to $pkgdatadir/build-aux, or to $ENV{autom4te_buildauxdir} if that’s set. (find_missing_aux_files, can_install_aux_files, try_install_aux_files) (install_aux_file, make_executable): New subs. (autoreconf_current_directory): Trace AC_REQUIRE_AUX_FILE. After running all tools that might install aux files, try to install aux files ourself if --install was given. After that, report on any that are still missing. * lib/autom4te.in (Autoreconf-preselections): Add AC_REQUIRE_AUX_FILE. Make list order consistent with list order in autoreconf.in. * tests/wrapper.as: Set autom4te_buildauxdir to point to location of config.guess, config.sub, and install-sh within the source tree. * lib/local.mk: Install config.guess, config.sub, and install-sh into $(pkgdatadir)/build-aux. * doc/autoconf.texi: Document that autoreconf can now install config.guess, config.sub, and install-sh itself without help from automake, but packages not using automake will need to arrange for tarball distribution of these files by hand. * tests/torture.at (Missing auxiliary files): Test autoreconf as well.
Diffstat (limited to 'tests')
-rw-r--r--tests/torture.at58
-rw-r--r--tests/wrapper.as4
2 files changed, 61 insertions, 1 deletions
diff --git a/tests/torture.at b/tests/torture.at
index f9bcf5e5..6ae6bfdf 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -1932,6 +1932,7 @@ AT_CLEANUP
## ------------------------- ##
AT_SETUP([Missing auxiliary files])
+AT_KEYWORDS([autoreconf])
AT_DATA([configure.ac],
[[AC_INIT([GNU foo], [1.0])
@@ -1941,16 +1942,55 @@ AC_OUTPUT
]])
AT_CHECK_AUTOCONF
+
+# Both configure and autoreconf should detect the missing files.
AT_CHECK_CONFIGURE([], [1], [ignore],
[configure: error: cannot find required auxiliary files: config.guess config.sub
])
+AT_CHECK([autoreconf], 1, [],
+[configure.ac: error: required file 'config.sub' not found
+configure.ac: error: required file 'config.guess' not found
+configure.ac: try running autoreconf --install
+])
+
+# If only one file is missing, the error messages should only report
+# that one. Also, the above invocation of autoreconf should _not_
+# have created build-aux, because it wasn't called with --install.
+AT_CHECK([test ! -e build-aux])
+mkdir build-aux
: > build-aux/config.guess
AT_CHECK_CONFIGURE([], [1], [ignore],
[configure: error: cannot find required auxiliary files: config.sub
])
+AT_CHECK([autoreconf], 1, [],
+[configure.ac: error: required file 'config.sub' not found
+configure.ac: try running autoreconf --install
+])
+
+# Missing aux files should not interfere with --help and --version.
+AT_CHECK_CONFIGURE([--help], [0], [ignore], [ignore])
+AT_CHECK_CONFIGURE([--version], [0], [ignore], [ignore])
+
+# autoreconf --install should be able to install config.sub and config.guess.
+rm build-aux/config.guess
+AT_CHECK([autoreconf --install])
+
+AT_CHECK([test -x build-aux/config.guess])
+AT_CHECK([test -x build-aux/config.sub])
+AT_CHECK([test ! -e build-aux/install-sh])
+
+AT_CHECK_CONFIGURE
+
+# Repeat all the above tests with a configure script that _doesn't_
+# need config.{sub,guess} but does need install-sh.
+
+rm build-aux/config.guess
+rm build-aux/config.sub
+rmdir build-aux
+
AT_DATA([configure.ac],
[[AC_INIT([GNU foo], [1.0])
AC_CONFIG_AUX_DIR([build-aux])
@@ -1958,9 +1998,27 @@ AC_PROG_INSTALL
AC_OUTPUT
]])
+
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([], [1], [ignore],
[configure: error: cannot find required auxiliary files: install-sh
])
+AT_CHECK([autoreconf], 1, [],
+[configure.ac: error: required file 'install-sh' not found
+configure.ac: try running autoreconf --install
+])
+AT_CHECK([test ! -e build-aux])
+
+AT_CHECK_CONFIGURE([--help], [0], [ignore], [ignore])
+AT_CHECK_CONFIGURE([--version], [0], [ignore], [ignore])
+
+AT_CHECK([autoreconf --install])
+
+AT_CHECK([test ! -e build-aux/config.guess])
+AT_CHECK([test ! -e build-aux/config.sub])
+AT_CHECK([test -x build-aux/install-sh])
+
+AT_CHECK_CONFIGURE
+
AT_CLEANUP
diff --git a/tests/wrapper.as b/tests/wrapper.as
index f0a5c037..f310166c 100644
--- a/tests/wrapper.as
+++ b/tests/wrapper.as
@@ -23,9 +23,11 @@ AUTOCONF=autoconf
AUTOHEADER=autoheader
AUTOM4TE=autom4te
AUTOM4TE_CFG='@abs_top_builddir@/lib/autom4te.cfg'
+autom4te_buildauxdir='@abs_top_srcdir@/build-aux'
autom4te_perllibdir='@abs_top_srcdir@/lib'
trailer_m4='@abs_top_srcdir@/lib/autoconf/trailer.m4'
-export AUTOCONF AUTOHEADER AUTOM4TE AUTOM4TE_CFG autom4te_perllibdir trailer_m4
+export AUTOCONF AUTOHEADER AUTOM4TE AUTOM4TE_CFG
+export autom4te_buildauxdir autom4te_perllibdir trailer_m4
case '@wrap_program@' in
ifnames)