Subject: after adding a(nother) subconfigure, rerunning make fails

From: Ralf Wildenhues <[email-masked]>
Date: Thu, 24 Feb 2011 20:36:22 +0100

Say I have a project with an up to date build tree.

Say I add a(nother) sub package, update toplevel configure.ac, then
rerun make.  Then the new sub/configure will not be rerun by the
triggered './config.status --recheck' thus make will later fail due to
nonexistent Makefile in the new subdirectory.

Not even rerunning autoreconf -v in the toplevel source directory, then
rerunning make, will fix this: you need to rerun configure in the (each)
build tree.

Can we fix this somehow in either Autoconf or Automake?

We could, by not passing --no-recursion upon --recheck, but doing that
all the time is probably not the best way to address this.  I'm not
quite sure if we can find out at 'config.status --recheck' time whether
the updated configure will enable the new sub configure.  Maybe a
--maybe-recursion?

Thanks,
Ralf

    Expose failure to run 'make' when new subpackage has been added.
    
    * tests/new-subpkg.test: New test.
    * tests/Makefile.am (TESTS, XFAIL_TESTS): Update.

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2ffdb9b..d6e3664 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -24,6 +24,7 @@ all.test \
 auxdir2.test \
 cond17.test \
 gcj6.test \
+new-subpkg.test \
 override-conditional-2.test \
 txinfo5.test
 
@@ -633,6 +634,7 @@ mkinst3.test \
 mmode.test \
 mmodely.test \
 multlib.test \
+new-subpkg.test \
 no-outdir-option.test \
 nobase.test \
 nobase-libtool.test \
diff --git a/tests/new-subpkg.test b/tests/new-subpkg.test
new file mode 100644
index 0000000..b49e16d
--- /dev/null
+++ b/tests/new-subpkg.test
@@ -0,0 +1,66 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# make should work after adding a new subpackage.
+
+required='GNUmake'
+. ./defs || Exit 1
+
+cat >>configure.in <<'END'
+dnl AC_CONFIG_SUBDIRS([lib])
+AC_OUTPUT
+END
+
+: >Makefile.am
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+./configure
+$MAKE
+
+sed 's/^dnl //' configure.in > configure.int
+mv -f configure.int configure.in
+
+cat >Makefile.am <<'EOF'
+SUBDIRS = lib
+EOF
+
+mkdir lib
+
+cat >lib/configure.ac <<'EOF'
+AC_INIT([lib], [1])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+EOF
+
+: >lib/Makefile.am
+
+# Ideally, this would work.
+#$MAKE
+
+# But for a start, it would be good if even this would work.
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+cd lib
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+cd ..
+$MAKE
+
+: