]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
autoreconf: cope with empty AC_CONFIG_SUBDIRS (bug 110331)
authorZack Weinberg <zackw@panix.com>
Thu, 15 Oct 2020 00:22:41 +0000 (20:22 -0400)
committerZack Weinberg <zackw@panix.com>
Thu, 15 Oct 2020 00:22:41 +0000 (20:22 -0400)
Commit 41edf99f9515f3f83398428c39d79e11266a5a0d made all Perl warnings
fatal.  This caused autoreconf to crash on packages that call
AC_CONFIG_SUBDIRS with no arguments. They probably shouldn’t do that,
but we shouldn’t crash if they do.

Problem reported by Ross Burton.

* bin/autoreconf.in (autoreconf_current_directory):
  Convert undef to '' before attempting to split it.
* tests/torture.at (Empty AC_CONFIG_SUBDIRS): New test.

bin/autoreconf.in
tests/torture.at

index 2ea917b52eec9efcc2be3f85f23a44496e1c8762..54b9b675650d2f46d74ee561fae2940dd457b352 100644 (file)
@@ -438,8 +438,9 @@ sub autoreconf_current_directory ($)
       $uses_automake = 1            if $macro eq "AM_INIT_AUTOMAKE";
       $uses_intltool = 1            if $macro eq "IT_PROG_INTLTOOL";
       $uses_gtkdoc = 1              if $macro eq "GTK_DOC_CHECK";
-      push @subdir, split (' ', $args[0])
-                                    if $macro eq "AC_CONFIG_SUBDIRS" && $recursive;
+      push @subdir, split (' ', $args[0] || '')
+                                    if $macro eq "AC_CONFIG_SUBDIRS"
+                                       && $recursive;
     }
   $traces->close;
 
index ff0f53f31f1e0a5512fc6796c87146498f21bfec..631f34f4df8040637d391983e5e3d779aaa71bbb 100644 (file)
@@ -1807,6 +1807,28 @@ AT_CHECK([test -f foo/innerfile])
 
 AT_CLEANUP
 
+## ------------------------- ##
+## Empty AC_CONFIG_SUBDIRS.  ##
+## ------------------------- ##
+
+AT_SETUP([Empty AC_CONFIG_SUBDIRS])
+AT_KEYWORDS([autoreconf])
+
+AT_DATA([install-sh], [])
+AT_DATA([configure.ac],
+[[AC_INIT(GNU Outer, 1.0)
+
+AC_CONFIG_SUBDIRS()
+AC_OUTPUT
+]])
+
+# 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_CHECK_CONFIGURE()
+AT_CHECK_CONFIGURE([--no-recursion])
+
+AT_CLEANUP
 
 ## ----------------- ##
 ## Empty directory.  ##