]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
configure: will re-execute with $CONFIG_SHELL, if it's set
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 26 Dec 2011 09:27:51 +0000 (10:27 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 26 Dec 2011 21:17:54 +0000 (22:17 +0100)
* lib/m4sugar/general.m4 (_AS_DETECT_BETTER_SHELL): Define the macro
`_AS_FORCE_REEXEC_WITH_CONFIG_SHELL' to `yes', so that the code in
`_AS_DETECT_BETTER_SHELL' will cause autoconf-generated configure
scripts to always re-execute themselves with $CONFIG_SHELL, if it's
set in the environment.
* doc/autoconf.texi (config.status Invocation): Update.
* doc/install.texi (Defining Variables): Likewise.
* NEWS: Likewise.
* tests/m4sh.at: Add tests for the new semantics in ...
(Configure re-execs self with CONFIG_SHELL): ... this new
test group.

ChangeLog
NEWS
doc/autoconf.texi
doc/install.texi
lib/autoconf/general.m4
tests/m4sh.at

index a91c5f085a6b963a2edb929a333cfb7d880a3aee..0826f00dd661dcd912a430c2b499913d4353b935 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2011-12-26  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       configure: will re-execute with $CONFIG_SHELL, if it's set
+       * lib/m4sugar/general.m4 (_AS_DETECT_BETTER_SHELL): Define the macro
+       `_AS_FORCE_REEXEC_WITH_CONFIG_SHELL' to `yes', so that the code in
+       `_AS_DETECT_BETTER_SHELL' will cause autoconf-generated configure
+       scripts to always re-execute themselves with $CONFIG_SHELL, if it's
+       set in the environment.
+       * doc/autoconf.texi (config.status Invocation): Update.
+       * doc/install.texi (Defining Variables): Likewise.
+       * NEWS: Likewise.
+       * tests/m4sh.at: Add tests for the new semantics in ...
+       (Configure re-execs self with CONFIG_SHELL): ... this new
+       test group.
+
 2011-12-26  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        m4sh: allow forced re-execution with $CONFIG_SHELL, if it's set
diff --git a/NEWS b/NEWS
index daec25602f665e7907b88d299949afce19a3cbed..2de5d2fe970e572d82d7f7d4ff1b89db95a6e25b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ GNU Autoconf NEWS - User visible changes.
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+** Autoconf-generated configure scripts now unconditionally re-execute
+   themselves with $CONFIG_SHELL, if that's set in the environment.
+
 ** The texinfo documentation no longer specifies "front-cover" or
    "back-cover" texts, so that it may now be included in Debian's
    "main" section.
index 4c897503ba507a0bdb95a3ac4662723c9d57fc87..0f068e54a193022812f0e77b17e8b6769c95ecd2 100644 (file)
@@ -22646,13 +22646,10 @@ can alter its behavior:
 @anchor{CONFIG_SHELL}
 @defvar CONFIG_SHELL
 @evindex CONFIG_SHELL
-The shell with which to run @command{configure} for the @option{--recheck}
-option.  It must be Bourne-compatible.  The default is a shell that
-supports @code{LINENO} if available, and @file{/bin/sh} otherwise.
-Invoking @command{configure} by hand bypasses this setting, so you may
-need to use a command like @samp{CONFIG_SHELL=/bin/bash /bin/bash ./configure}
-to insure that the same shell is used everywhere.  The absolute name of the
-shell should be passed.
+The shell with which to run @command{configure}.  It must be
+Bourne-compatible, and the absolute name of the shell should be passed.
+The default is a shell that supports @code{LINENO} if available, and
+@file{/bin/sh} otherwise.
 @end defvar
 
 @defvar CONFIG_STATUS
index d397b8a89b4cb3f385c702d69a8dde7072533762..c6a8bdf7af472e4b60012793d09a4b68ddc6f30c 100644 (file)
@@ -364,11 +364,11 @@ overridden in the site shell script).
 
 @noindent
 Unfortunately, this technique does not work for @env{CONFIG_SHELL} due
-to an Autoconf bug.  Until the bug is fixed you can use this
-workaround:
+to an Autoconf limitation.  Until the limitation is lifted, you can use
+this workaround:
 
 @example
-CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
 @end example
 
 @node configure Invocation
index dd20e7115cab4fc81b2ebe7ec519a430e5b70d61..b2a7d946fb283b5e3a9be684b3ac7a36abf4b304 100644 (file)
@@ -1386,6 +1386,9 @@ m4_pattern_forbid([^LIBOBJS$],
                  [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS'])
 # Actually reserved by M4sh.
 m4_pattern_allow([^AS_FLAGS$])
+# So that the autoconf-generated scripts will always re-execute
+# themselves with $CONFIG_SHELL, if that's set in the environment.
+m4_define([_AS_FORCE_REEXEC_WITH_CONFIG_SHELL], [yes])
 AS_INIT[]dnl
 AS_PREPARE[]dnl
 m4_divert_push([KILL])
index cdd0e7ecb56c1b5192713a11ff2404a5a10afc14..ba8991a43352e2e83bb8ca00e7546931ab973bcd 100644 (file)
@@ -103,6 +103,33 @@ test ! -f sentinel || rm -f sentinel # Cleanup for next test.
 
 AT_CLEANUP
 
+AT_SETUP([Configure re-execs self with CONFIG_SHELL])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+echo foobar >> quux
+]])
+
+AT_CHECK_AUTOCONF
+
+AT_DATA([cfg-sh],
+[[#!/bin/sh
+: > cfg-sh-has-run
+exec sh "@S|@@"
+]])
+chmod a+x cfg-sh
+
+AT_CAPTURE_FILE([config.log])
+AT_CHECK([env CONFIG_SHELL=./cfg-sh ./configure], [0], [], [])
+# ./configure re-executed itself.
+AT_CHECK([test -f cfg-sh-has-run], [0])
+# And did that not to cause extra execution of later commands.
+AT_CHECK([cat quux], [0], [foobar
+], [])
+
+rm -f quux cfg-sh*
+AT_CLEANUP
+
 
 ## ------------------- ##
 ## AS_WARN, AS_ERROR.  ##