Hello Hans Ulrich, * Hans Ulrich Niedermann wrote on Mon, Jun 25, 2007 at 06:20:53PM CEST: > > "configure --help=recursive" does not run the --help parts of the > directories included via AC_CONFIG_SUBDIR when called as > $ /path/to/top_srcdir/configure --help=recursive > or > $ ../configure --help=recursive
Thank you for the nice, concise and complete bug report! Actually, this is an ugly bug. It goes away if you do mkdir direct-sub in the current working directory. Consequently it is not visible once you are in a configured build tree. The reason configure does not enter the source tree is that the source tree may live on read-only media, and the sub-configure needs to be able to write to the CWD before it gets to help output (for example to find out $PATH_SEPARATOR). OTOH having configure --help=recursive create the build subtree (1) (and document that) seems like an ugly solution, too. The next best thing I could come up with would be to use the same build directory for each of the sub configure scripts (2). But there is a failure scenario for that: Say, the shell does not support $LINENO properly. In that case, we create and execute "configure.lineno" in the current directory. The sub configure script will try to overwrite the same script. As the toplevel script is still in use by the parent shell, it won't be overwritable on, say, some NFS volume. My next idea was: --help=recursive creates a build tree if necessary (3). It remembers whether it had to create the tree, and if so, tries to clean up after itself. Implementation-wise, however, this is a mess (What if, with AC_CONFIG_SUBDIRS([deep/sub/dir]), deep/sub exists but not deep/sub/dir, should we remember to only remove the last component?). Lastly (4), we could just document the current situation. The prospects of having to run configure just to find out about all of its options are bleak, though. I'd vote for (1). The proposed patch below implements that. What's the general opinion about this? Cheers, Ralf 2007-07-01 Ralf Wildenhues <[EMAIL PROTECTED]> * lib/autoconf/general.m4 (_AC_INIT_HELP): Create the toplevel build directory for each sub configure invoked with --help=recursive, so help output works even in unconfigured trees. * tests/torture.at (Configuring subdirectories): Expose it. * NEWS: Update. Report by Hans Ulrich Niedermann <[EMAIL PROTECTED]>. Index: NEWS =================================================================== RCS file: /cvsroot/autoconf/autoconf/NEWS,v retrieving revision 1.430 diff -u -r1.430 NEWS --- NEWS 21 May 2007 17:50:57 -0000 1.430 +++ NEWS 1 Jul 2007 07:22:42 -0000 @@ -1,5 +1,8 @@ * Major changes in Autoconf 2.61b (????-??-??) +** `configure --help=recursive' now creates those parts of the build + tree necessary for obtaining sub configure help. + ** New macro AC_OPENMP. ** AC_C_BIGENDIAN now supports universal binaries a la Mac OS X. Index: lib/autoconf/general.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v retrieving revision 1.950 diff -u -r1.950 general.m4 --- lib/autoconf/general.m4 12 Jun 2007 11:36:57 -0000 1.950 +++ lib/autoconf/general.m4 1 Jul 2007 07:20:43 -0000 @@ -1001,6 +1001,7 @@ -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages + and create the associated build tree -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] @@ -1088,7 +1089,8 @@ if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || continue + test -d "$srcdir/$ac_dir" || continue + AS_MKDIR_P(["$ac_dir"]) _AC_SRCDIRS(["$ac_dir"]) cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. Index: tests/torture.at =================================================================== RCS file: /cvsroot/autoconf/autoconf/tests/torture.at,v retrieving revision 1.82 diff -u -r1.82 torture.at --- tests/torture.at 12 Jun 2007 11:36:57 -0000 1.82 +++ tests/torture.at 1 Jul 2007 07:20:43 -0000 @@ -979,6 +979,11 @@ # The same, but from a builddir. AS_MKDIR_P([builddir]) +# recursive help will create parts of the build tree: +AT_CHECK([cd builddir && ../configure --help=recursive | grep INNER], 0, [ignore]) +( cd builddir && rm -r inner ) +AT_CHECK([cd builddir && `pwd`/../configure --help=recursive | grep INNER], 0, [ignore]) +( cd builddir && rm -r inner ) AT_CHECK([cd builddir && ../configure], 0, [ignore]) AT_CHECK([cat builddir/inner/innermost/config], 0, [INNER=inner