]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Fix some build and test failures with Autoconf 2.70.
authorZack Weinberg <zackw@panix.com>
Mon, 14 Dec 2020 19:50:47 +0000 (14:50 -0500)
committerKarl Berry <karl@freefriends.org>
Tue, 15 Dec 2020 01:53:03 +0000 (17:53 -0800)
Autoconf 2.70 (released last week) makes a few changes that broke Automake’s
expectations, mostly in the test suite.  This patch addresses two of the
problems:

 - autoconf now issues a warning if fed a configure script that doesn’t invoke
   both AC_INIT and AC_OUTPUT; this, plus a problem with system-provided
   tools (still under investigation) broke the *build* on macOS; it also
   causes a couple of spurious testsuite failures.

 - AC_PACKAGE_NAME and AC_PACKAGE_VERSION are now defined unconditionally.
   AM_INIT_AUTOMAKE needs to use m4_ifset instead of m4_ifdef to diagnose
   the obsolete use of AC_INIT with fewer than two arguments.  (This change
   is compatible with autoconf 2.69; m4_ifset is much older, and it means
   ‘defined with a non-empty value’.)

* configure.ac: Use both AC_INIT and AC_OUTPUT in test configure scripts.
* t/deprecated-acinit.sh, t/init.sh: Likewise.
* m4/init.m4 (AM_INIT_AUTOMAKE): Use m4_ifset, not m4_ifdef, to detect
  AC_PACKAGE_NAME and/or AC_PACKAGE_VERSION not having a value.

configure.ac
m4/init.m4
t/deprecated-acinit.sh
t/init.sh

index 45507b6f4dc1d2762c7f10dab956e76b7d77e136..065317411479965a93694c5193063406d04b2fdb 100644 (file)
@@ -123,7 +123,9 @@ fi
 
 AC_CACHE_CHECK([whether autoconf works], [am_cv_autoconf_works],
 [mkdir conftest
-echo 'AC''_INIT' > conftest/conftest.ac
+printf '%s\n' > conftest/conftest.ac \
+  'AC''_INIT([smoke-test], [1])' \
+  'AC''_OUTPUT'
 if AM_RUN_LOG([cd conftest && $am_AUTOCONF -o /dev/null conftest.ac]);
 then
   am_cv_autoconf_works=yes
@@ -139,7 +141,10 @@ fi
 AC_CACHE_CHECK([whether autoconf is recent enough], [am_cv_autoconf_version],
 [mkdir conftest
 dnl Creative quoting required to avoid spurious expansion of AC_PREREQ macro
-echo 'AC'"_PREREQ([[$required_autoconf_version]])" > conftest/conftest.ac
+printf '%s\n' > conftest/conftest.ac \
+  'AC'"_PREREQ([[$required_autoconf_version]])" \
+  'AC''_INIT([smoke-test], [1])' \
+  'AC''_OUTPUT'
 if AM_RUN_LOG([cd conftest && $am_AUTOCONF -o /dev/null conftest.ac]);
 then
   am_cv_autoconf_version=yes
index f82d756c2d6748195813ba28d9ac43faec32393d..cbe8fddf8a7bb4248fe3ddce212401c6acab9218 100644 (file)
@@ -64,7 +64,7 @@ m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
 [_AM_SET_OPTIONS([$1])dnl
 dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
 m4_if(
-  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
   [ok:ok],,
   [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
index 21614bafac2c61b6269b80c2f64754eb3d6e0758..f393d6534419c62f872bca7c9a4403fe3ef1e1ab 100644 (file)
@@ -35,6 +35,7 @@ for ac_init in AC_INIT 'AC_INIT([Makefile.am])'; do
         $ac_init
         $am_init_automake
         AC_CONFIG_FILES([Makefile])
+        AC_OUTPUT
 END
     cat configure.ac # For debugging.
     $ACLOCAL 2>stderr && { cat stderr >&2; exit 1; }
index c6f6d64613464ade2d4c0addd82fac67a5412425..df138a04007d87bdc32c83497a33cf808769a49b 100644 (file)
--- a/t/init.sh
+++ b/t/init.sh
@@ -25,6 +25,7 @@ for ac_init_args in '' '([x])'; do
     unindent >configure.ac <<END
       AC_INIT$ac_init_args
       AM_INIT_AUTOMAKE$am_init_args
+      AC_OUTPUT
 END
     cat configure.ac # For debugging.
     # The error message should mention AC_INIT, not AC_PACKAGE_VERSION.