[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug#8111: after adding a(nother) subconfigure, rerunning make fails
From: |
Ralf Wildenhues |
Subject: |
Re: bug#8111: after adding a(nother) subconfigure, rerunning make fails |
Date: |
Sat, 26 Feb 2011 09:18:11 +0100 |
User-agent: |
Mutt/1.5.20 (2010-08-04) |
[ dropping bug-automake ]
* Jack Kelly wrote on Fri, Feb 25, 2011 at 10:38:39PM CET:
> On Sat, Feb 26, 2011 at 7:46 AM, Ralf Wildenhues wrote:
> > [ adding autoconf-patches; this is <http://debbugs.gnu.org/8111> ]
> > * Jack Kelly wrote on Thu, Feb 24, 2011 at 11:49:44PM CET:
> >> On Fri, Feb 25, 2011 at 6:36 AM, Ralf Wildenhues wrote:
> > Since 'makefile' might be spelt in various different
> > ways, we can take presence of 'config.status' in the subdir build tree
> > as indicator, that should be good enough.
>
> You should add a comment to this effect in your status.m4 changes.
> Currently, it looks like you've tested for config.status by mistake.
Indeed, thanks.
> > I'm still wondering whether we should rename the option
> > --new-recursion-only however, that would be more precise.
> > Other than that, the patch below seems to do what I want.
>
> Yes. the name becomes very confusing. Maybe --recursion=no (with
> --no-recursion as an alias), --recursion=new-only?
That's better.
Eric, what do you think about this patch? The test suite is still
running, but it's past the torture.at stage so I don't expect further
surprises.
I chose to not rename the internal $no_recursion for now. It looks a
big ugly the way it is, but codesearch tells me that user configure.ac
scripts are using this variable actively, e.g. the GCC/src/binutils/gdb
trees, or in erlang-otp. The latter would need fixing anyway I guess;
see <git://github.com/mfoemmel/erlang-otp.git>. So somebody will lose
here.
Should I compactify the install.texi diff? Markup-wise, would that be
address@hidden address@hidden@address@hidden|address@hidden|address@hidden@}}
?
automake/lib/config-ml.in will need a (trivial) update for this too.
Thanks,
Ralf
configure reruns now enter new subpackages.
Assume you have a project that provides rebuild rules (e.g.,
those from automake), and an up to date build tree. If you add
a new subpackage, `make' will trigger `config.status --recheck'
but the new subpackage will never be configured, as it has no
makefile yet. This patch changes config.status to pass the new
option --recursion=new-only rather than --no-recursion to
configure, so that new subdirectories will be configured.
* doc/autoconf.texi (Setting Output Variables): Update example
output.
(config.status Invocation): Document that config.status uses
--recursion=new-only now.
* doc/install.texi (configure Invocation): Document
--no-recursion, --recursion={no,yes,new-only}.
* lib/autoconf/general.m4 (_AC_INIT_PARSE_ARGS, _AC_INIT_HELP):
Accept and document the new options.
(_AC_INIT_PREPARE): Strip the options out so they don't pile up.
* lib/autoconf/status.m4 (_AC_OUTPUT_SUBDIRS): If new-only, do
not configure a subdir that already has a config.status file.
(_AC_OUTPUT_CONFIG_STATUS): Pass --recursion=new-only instead of
--no-recursion.
* tests/torture.at (New AC_CONFIG_SUBDIRS): New test.
* NEWS: Update.
diff --git a/NEWS b/NEWS
index 3edebd8..3368d87 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,13 @@ GNU Autoconf NEWS - User visible changes.
** AS_LITERAL_IF again treats '=' as a literal. Regression introduced in
2.66.
+** configure now also accepts arguments --recursion={no,yes,new-only}, with
+ the first being an alias for --no-recursion and the second the default.
+ `config.status --recheck' now triggers the `new-only' case which enters
+ subdirectories if they have not been configured yet, so that an initial
+ makefile can be generated for a new sub package.
+
+
** Macros
- New macro AC_HEADER_CHECK_STDBOOL.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index b011316..1ccfcd3 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -9712,7 +9712,7 @@ Setting Output Variables
$ @kbd{CC=/usr/bin/cc ./configure var=raboof --silent}
$ @kbd{./config.status --recheck}
running CONFIG_SHELL=/bin/sh /bin/sh ./configure var=raboof \
- CC=/usr/bin/cc --no-create --no-recursion
+ CC=/usr/bin/cc --no-create --recursion=new-only
@end example
@end itemize
@end defmac
@@ -22088,10 +22088,11 @@ config.status Invocation
@option{--recheck} option reruns @command{configure} with the same arguments
you used before, plus the @option{--no-create} option, which prevents
@command{configure} from running @file{config.status} and creating
address@hidden and other files, and the @option{--no-recursion} option,
address@hidden and other files, and the @option{--recursion=new-only} option,
which prevents @command{configure} from running other @command{configure}
-scripts in subdirectories. (This is so other Make rules can
-run @file{config.status} when it changes; @pxref{Automatic Remaking},
+scripts in subdirectories that have already been configured before.
+(This is so other Make rules can run @file{config.status} when it changes;
address@hidden Remaking},
for an example).
@end table
diff --git a/doc/install.texi b/doc/install.texi
index d397b8a..46482a3 100644
--- a/doc/install.texi
+++ b/doc/install.texi
@@ -423,6 +423,13 @@ configure Invocation
@item --no-create
@itemx -n
Run the configure checks, but stop before creating any output files.
+
address@hidden --no-recursion
address@hidden --recursion=no
address@hidden --recursion=yes
address@hidden --recursion=new-only
+Run @command{configure} scripts in subdirectories either never, or always,
+or only if the subdirectories have not been configured yet.
@end table
@noindent
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 337aba7..16e63b8 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -752,6 +752,16 @@ do
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
+ -recursion=* | --recursion=* | --recursio=* | --recursi=* | --recurs=* \
+ | --recur=* | --recu=* | --rec=* | --re=* | --r=*)
+ case $ac_optarg in
+ yes) ;;
+ no) no_recursion=yes ;;
+ new-only) no_recursion=new-only ;;
+ *)
+ AC_MSG_ERROR([unrecognized option $ac_optarg to $ac_dashdash$ac_option])
+ ;;
+ esac ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
@@ -1038,6 +1048,8 @@ Configuration:
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
+ --no-recursion, --recursion={no,yes,new-only} run sub configures never,
+ always, or only if not configured yet
--srcdir=DIR find the sources in DIR [configure dir or \`..']
Installation directories:
@@ -1209,7 +1221,7 @@ m4_define([_AC_INIT_PREPARE],
[m4_divert_push([INIT_PREPARE])dnl
# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --no-create and --(no-)recursion so they do not pile up.
# Strip out --silent because we don't want to record it for future runs.
# Also quote any args containing shell meta-characters.
# Make two passes to allow for proper duplicate-argument suppression.
@@ -1222,7 +1234,9 @@ do
for ac_arg
do
case $ac_arg in
- -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -no-create | --no-c* | -n | -no-recursion | --no-r* | -recursion=* \
+ | --r*=*)
+ continue ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index a1a857b..00cbb31 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -1181,6 +1181,11 @@ if test "$no_recursion" != yes; then
# parts of a large source tree are present.
test -d "$srcdir/$ac_dir" || continue
+ # If recursing to new subpackages only, skip already-configured ones.
+ if test "$no_recursion" = new-only && test -x $ac_dir/config.status; then
+ continue
+ fi
+
ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)"
_AS_ECHO_LOG([$ac_msg])
_AS_ECHO([$ac_msg])
@@ -1542,7 +1547,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
dnl Check this before opening the log, to avoid a bug on MinGW,
dnl which prohibits the recursive instance from truncating an open log.
if \$ac_cs_recheck; then
- set X '$SHELL' '$[0]' $ac_configure_args \$ac_configure_extra_args
--no-create --no-recursion
+ set X '$SHELL' '$[0]' $ac_configure_args \$ac_configure_extra_args
--no-create --recursion=new-only
shift
\AS_ECHO(["running CONFIG_SHELL=$SHELL \$[*]"]) >&AS_MESSAGE_FD
CONFIG_SHELL='$SHELL'
diff --git a/tests/torture.at b/tests/torture.at
index b3a5ac3..a005a5d 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -1690,6 +1690,56 @@ AT_CHECK([grep INNERMOST
builddir/inner/innermost/config.h], 0,
AT_CLEANUP
+## ---------------------- ##
+## New AC_CONFIG_SUBDIRS. ##
+## ---------------------- ##
+
+# `config.status --recheck' should recurse into subdirectories that
+# have not been configured yet. That way, `make' in a build tree
+# can start recursing there too, after rebuild rules are finished.
+
+AT_SETUP([New AC_CONFIG_SUBDIRS])
+AT_KEYWORDS([autoreconf])
+
+AT_DATA_AUTOCONF([configure.ac],
+[[AC_INIT([GNU Outer], [1.0])
+dnl AC_CONFIG_SUBDIRS([sub])
+AC_OUTPUT
+]])
+
+mkdir sub
+
+AT_DATA_AUTOCONF([sub/configure.ac],
+[[AC_INIT([GNU Inner], [1.0])
+AC_OUTPUT
+]])
+
+: >install-sh
+AT_CHECK([autoreconf -v], [], [ignore], [ignore])
+AT_CHECK_CONFIGURE
+
+sed 's/d@&address@hidden //' configure.ac > configure.t
+mv -f configure.t configure.ac
+AT_CHECK([autoreconf -vf], [], [ignore], [ignore])
+
+# Hypothesis: recheck also takes care of configuring the subdir
+# if it has not been configured yet.
+AT_CHECK([./config.status --recheck], [], [ignore])
+AT_CHECK([test -x sub/config.status])
+
+sleep 1
+echo timestamp >sub/stamp-file
+sleep 1
+
+# Hypothesis: recheck does not reconfigure a configured subdirectory.
+AT_CHECK([./config.status --recheck], [], [ignore])
+AT_CHECK([ls -1t sub/stamp-file sub/config.status | sed -n 1p], [],
+[[sub/stamp-file
+]])
+
+
+AT_CLEANUP
+
## -------------------------------- ##
## Non-Autoconf AC_CONFIG_SUBDIRS. ##