From 4c59bf27d7083088290219450c81d999431b43f1 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Tue, 20 Oct 2020 13:27:22 -0400 Subject: Improve handling of missing aux scripts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Another regression identified by the Debian archive rebuild was that more macros require the presence of config.sub and config.guess now. ‘autoreconf --install’ doesn’t install these itself, it relies on ‘automake --add-missing’ to do that; so, packages that don’t use Automake will fail at the configure stage after configure is regenerated. To make matters worse, AC_CONFIG_AUX_DIRS assumes that everyone who needs config.sub and config.guess also needs install-sh, so in about half of the affected packages, the failure manifested as a complaint about install-sh being missing -- technically true but adding install-sh wouldn’t have resolved the problem by itself. This patch overhauls the AC_CONFIG_AUX_DIR(S) mechanism so that a configure script knows the complete set of aux scripts that were AC_REQUIRE_AUX_FILE’d for it, checks for the existence of all of them, and not any others. Thus, this configure script AC_INIT([test], [1.0]) AC_FUNC_MALLOC AC_CONFIG_HEADERS([config.h]) AC_OUTPUT will work fine in a directory that contains config.sub and config.guess but not install-sh. Also, if it’s in a directory that *doesn’t* contain config.sub and config.guess, it will print an accurate error message configure: error: cannot find required auxiliary files: config.guess config.sub instead of the misleading configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.." A side-effect: it doesn’t make sense for AC_CONFIG_SUBDIRS to demand the presence of Cygnus configure in the aux dir, on the off-chance that one of the subdirectories *might* be using it -- I have no idea where someone would even get a copy of that nowadays -- so I dropped that feature. I rather suspect nobody has needed it in over a decade. I also documented the expanded need for config.sub and config.guess in NEWS as well as the manual. * NEWS: Document expanded need for config.sub and config.guess. Document removed support for Cygnus configure in subdirectories. * doc/autoconf.texi: Clarify exactly when install-sh, config.sub, and/or config.guess are required. Document canonical online sources for these scripts. Revise documentation of AC_CONFIG_AUX_DIR and AC_REQUIRE_AUX_FILE. Minor improvements to documentation of AC_CONFIG_SRCDIR. Remove mentions of Cygnus configure in subdirectories. * lib/autoconf/general.m4 (_AC_INIT_PARSE_ARGS): Remove mention of Cygnus configure; clarify function of configure.gnu. (AC_CONFIG_AUX_DIR): Support multiple invocations. (AC_CONFIG_AUX_DIRS): Now an undocumented compatibility interface rather than an internal subroutine; just runs AC_CONFIG_AUX_DIR on each of its arguments. (AC_CONFIG_AUX_DIR_DEFAULT): Now a backward compatibility stub that requires _AC_INIT_AUX_DIR without adding anything to _AC_AUX_FILES. (AC_REQUIRE_AUX_FILE): Now adds the named aux file to _AC_AUX_FILES and requires _AC_INIT_AUX_DIR, as well as being a trace hook. (_AC_INIT_AUX_DIR): New home of the loop searching for necessary aux files (formerly in AC_CONFIG_AUX_DIRS). Looks for all the necessary aux files, not just for install-sh. (ac_config_guess, ac_config_sub, ac_configure): Issue deprecation warnings if these undocumented shell variables are actually used. (AC_CANONICAL_BUILD, AC_CANONICAL_HOST, AC_CANONICAL_TARGET): No need to require AC_CONFIG_AUX_DIR_DEFAULT. Can rely on $ac_aux_dir ending with a slash. * lib/autoconf/programs.m4 (AC_PROG_INSTALL, AC_PROG_MKDIR_P): No need to require AC_CONFIG_AUX_DIR_DEFAULT. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to require AC_CONFIG_AUX_DIR_DEFAULT. Remove check for Cygnus configure; clarify function of configure.gnu. * lib/autotest/general.m4: Remove mention of Cygnus configure. * tests/torture.at (Missing auxiliary files): New test. --- tests/torture.at | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'tests/torture.at') diff --git a/tests/torture.at b/tests/torture.at index 631f34f4..f9bcf5e5 100644 --- a/tests/torture.at +++ b/tests/torture.at @@ -1926,3 +1926,41 @@ AT_CHECK([autoreconf -Werror -Wportability-recursive], 0, [], []) rm -rf configure config.h.in Makefile.in aclocal.m4 autom4te.cache AT_CLEANUP + +## ------------------------- ## +## Missing auxiliary files. ## +## ------------------------- ## + +AT_SETUP([Missing auxiliary files]) + +AT_DATA([configure.ac], +[[AC_INIT([GNU foo], [1.0]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CANONICAL_HOST +AC_OUTPUT +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE([], [1], [ignore], +[configure: error: cannot find required auxiliary files: config.guess config.sub +]) + +: > build-aux/config.guess + +AT_CHECK_CONFIGURE([], [1], [ignore], +[configure: error: cannot find required auxiliary files: config.sub +]) + +AT_DATA([configure.ac], +[[AC_INIT([GNU foo], [1.0]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_PROG_INSTALL +AC_OUTPUT +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE([], [1], [ignore], +[configure: error: cannot find required auxiliary files: install-sh +]) + +AT_CLEANUP -- cgit v1.2.1