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

From: Ralf Wildenhues <[email-masked]>
Date: Sat, 26 Feb 2011 10:25:30 +0100

Hi Stefano,

* Stefano Lattarini wrote on Sat, Feb 26, 2011 at 09:32:57AM CET:
> On Saturday 26 February 2011, Ralf Wildenhues wrote:
> > This is not an Automake bug after all.  It can be solved completely
> > within Autoconf, thus no new version skew danger.  :-)
> >
> What about checking in your automake testcase anyway (obviously to
> be skipped with autoconf <= 2.68)?  From a blackbox perspective, the
> behaviour it tests is the desired and expected one, so IHMO it makes
> sense to check for it, against (say) possible future automake and/or
> autoconf regressions.

Yeah, that's what I figured too, but thanks for bringing it up.
I intend to push something like the patch below to maint when
the Autoconf API is cast in stone.

Cheers,
Ralf

    With new Autoconf, rebuilding works after adding a subpackage.
    
    * tests/new-subpkg.test: New test.
    * tests/Makefile.am (TESTS): Update.

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 047bc7b..aecbfb3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -519,6 +519,7 @@ mkinst3.test \
 mmode.test \
 mmodely.test \
 multlib.test \
+new-subpkg.test \
 nobase.test \
 nobase-libtool.test \
 nobase-python.test \
diff --git a/tests/new-subpkg.test b/tests/new-subpkg.test
new file mode 100755
index 0000000..0b82a9a
--- /dev/null
+++ b/tests/new-subpkg.test
@@ -0,0 +1,71 @@
+#! /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 to an existing tree.
+
+required='GNUmake'
+. ./defs || Exit 1
+
+cat >>configure.in <<'END'
+dnl AC_CONFIG_SUBDIRS([lib])
+AC_OUTPUT
+END
+
+: >Makefile.am
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+# We need new-enough Autoconf that recurses new subpackages.
+./configure --help | grep 'recursion=.*new-only' || Exit 77
+
+./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])
+AC_OUTPUT
+EOF
+
+: >lib/Makefile.am
+
+# Ideally, this would work.
+#$MAKE
+
+# But for a start, being able to run make after a manual bootstrap is good.
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+cd lib
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+cd ..
+$MAKE
+
+: