>From 53317371d1e44d816c8793ee1f97c5bb41525edb Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Mon, 26 Dec 2011 10:27:51 +0100 Subject: [PATCH 3/3] configure: will re-execute with $CONFIG_SHELL, if it's set * lib/m4sugar/general.m4 (_AS_DETECT_BETTER_SHELL): Define the macro `' 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 | 15 +++++++++++++++ NEWS | 3 +++ doc/autoconf.texi | 11 ++++------- doc/install.texi | 6 +++--- lib/autoconf/general.m4 | 3 +++ tests/m4sh.at | 27 +++++++++++++++++++++++++++ 6 files changed, 55 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8e3b881..16b55f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,20 @@ 2011-12-26 Stefano Lattarini + configure: will re-execute with $CONFIG_SHELL, if it's set + * lib/m4sugar/general.m4 (_AS_DETECT_BETTER_SHELL): Define the + macro `' 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 + m4sh: allow forced re-execution with $CONFIG_SHELL, if it's set * lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL): If the m4sh client has defined the macro, emit code to always re-execute the current diff --git a/NEWS b/NEWS index 858601a..aff0fbb 100644 --- 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. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index d7d2231..5360572 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -22633,13 +22633,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 address@hidden/bin/sh} otherwise. @end defvar @defvar CONFIG_STATUS diff --git a/doc/install.texi b/doc/install.texi index d397b8a..c6a8bdf 100644 --- a/doc/install.texi +++ b/doc/install.texi @@ -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 diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index dd20e71..b2a7d94 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -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]) diff --git a/tests/m4sh.at b/tests/m4sh.at index cdd0e7e..ba8991a 100644 --- a/tests/m4sh.at +++ b/tests/m4sh.at @@ -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. ## -- 1.7.7.3