autoconf-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Autoconf source repository branch, master, updated. v2.68-106-


From: Stefano Lattarini
Subject: [SCM] GNU Autoconf source repository branch, master, updated. v2.68-106-gb583202
Date: Mon, 26 Dec 2011 21:21:06 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Autoconf source repository".

http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=b5832028b6d3ad087f60a72d9484b94fd6c49a2a

The branch, master has been updated
       via  b5832028b6d3ad087f60a72d9484b94fd6c49a2a (commit)
       via  eee6c2224d2f494682ff63f681800811a1aac3f7 (commit)
       via  8fb1aafa0d81175f3ca27ed7ed2e0532c8af9902 (commit)
      from  d1b31ac57cc069527d037f3291e643813ce0bd69 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b5832028b6d3ad087f60a72d9484b94fd6c49a2a
Author: Stefano Lattarini <address@hidden>
Date:   Mon Dec 26 10:27:51 2011 +0100

    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.

commit eee6c2224d2f494682ff63f681800811a1aac3f7
Author: Stefano Lattarini <address@hidden>
Date:   Mon Dec 26 10:06:18 2011 +0100

    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 `_AS_FORCE_REEXEC_WITH_CONFIG_SHELL' to
    "yes", emit code to always re-execute the current script with
    $CONFIG_SHELL, if that's set.
    * tests/m4sh.at: Add tests for the new and old semantics, in ...
    (Re-exec with CONFIG_SHELL, Forced re-exec with CONFIG_SHELL): ...
    these new test groups.

commit 8fb1aafa0d81175f3ca27ed7ed2e0532c8af9902
Author: Stefano Lattarini <address@hidden>
Date:   Mon Dec 26 10:06:18 2011 +0100

    m4sh: refactor _AS_DETECT_BETTER_SHELL, for future changes
    
    * lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL): Move code to
    handle the re-execution of the shell ...
    (_AS_REEXEC_WITH_SHELL): ... in this new macro.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog               |   33 ++++++++++++++
 NEWS                    |    3 +
 doc/autoconf.texi       |   11 ++---
 doc/install.texi        |    6 +-
 lib/autoconf/general.m4 |    3 +
 lib/m4sugar/m4sh.m4     |   63 ++++++++++++++++++++------
 tests/m4sh.at           |  114 +++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 208 insertions(+), 25 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8eaf0d7..0826f00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2011-12-26  Stefano Lattarini  <address@hidden>
+
+       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  <address@hidden>
+
+       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 `_AS_FORCE_REEXEC_WITH_CONFIG_SHELL' to
+       "yes", emit code to always re-execute the current script with
+       $CONFIG_SHELL, if that's set.
+       * tests/m4sh.at: Add tests for the new and old semantics, in ...
+       (Re-exec with CONFIG_SHELL, Forced re-exec with CONFIG_SHELL): ...
+       these new test groups.
+
+2011-12-26  Stefano Lattarini  <address@hidden>
+
+       m4sh: refactor _AS_DETECT_BETTER_SHELL, for future changes
+       * lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL): Move code to
+       handle the re-execution of the shell ...
+       (_AS_REEXEC_WITH_SHELL): ... in this new macro.
+
 2011-12-24  Stefano Lattarini  <address@hidden>
 
        docs: issue with shell functions and here-documents on Solaris
diff --git a/NEWS b/NEWS
index daec256..2de5d2f 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 4c89750..0f068e5 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -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
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/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 7195618..2bffee8 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -192,6 +192,28 @@ m4_define([_AS_DETECT_SUGGESTED_PRUNE],
 #
 # This code is run outside any trap 0 context, hence we can simplify AS_EXIT.
 m4_defun([_AS_DETECT_BETTER_SHELL],
+dnl
+dnl By default, do not force re-execution of the script just because
+dnl the user has pre-set $CONFIG_SHELL; do so only if the m4sh client has
+dnl defined the internal variable `_AS_FORCE_REEXEC_WITH_CONFIG_SHELL' to
+dnl "yes".
+dnl FIXME: This interface is acceptable for the moment, as a private,
+dnl FIXME: internal one; but if we want to make the "always re-execute"
+dnl FIXME: feature public, we should find a better interface!
+[m4_if(_AS_FORCE_REEXEC_WITH_CONFIG_SHELL, [yes],
+  [# Use a proper internal environment variable to ensure we don't fall
+  # into an infinite loop, continuously re-executing ourselves.
+  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+    _as_can_reexec=no; export _as_can_reexec;
+    _AS_REEXEC_WITH_SHELL([$CONFIG_SHELL])
+  fi
+  # We don't want this to propagate to other subprocesses.
+  dnl This might be especially important in case an m4sh-generated script
+  dnl is used to later execute other m4sh-generated scripts.  This happens
+  dnl for example in autoconf's own testsuite (and happens *a lot* there,
+  dnl in fact).
+  AS_UNSET([_as_can_reexec])
+])]dnl
 dnl Remove any tests from suggested that are also required
 [m4_set_map([_AS_DETECT_SUGGESTED_BODY], [_AS_DETECT_SUGGESTED_PRUNE])]dnl
 [m4_pushdef([AS_EXIT], [exit m4_default(]m4_dquote([$][1])[, 1)])]dnl
@@ -223,21 +245,8 @@ dnl Remove any tests from suggested that are also required
             [CONFIG_SHELL=$SHELL as_have_required=yes])])
 
       AS_IF([test "x$CONFIG_SHELL" != x],
-       [# We cannot yet assume a decent shell, so we have to provide a
-       # neutralization value for shells without unset; and this also
-       # works around shells that cannot unset nonexistent variables.
-       # Preserve -v and -x to the replacement shell.
-       BASH_ENV=/dev/null
-       ENV=/dev/null
-       (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-       export CONFIG_SHELL
-       case $- in @%:@ ((((
-         *v*x* | *x*v* ) as_opts=-vx ;;
-         *v* ) as_opts=-v ;;
-         *x* ) as_opts=-x ;;
-         * ) as_opts= ;;
-       esac
-       exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"address@hidden"}])
+            [export CONFIG_SHELL
+             _AS_REEXEC_WITH_SHELL([$CONFIG_SHELL])])
 
 dnl Unfortunately, $as_me isn't available here.
     AS_IF([test x$as_have_required = xno],
@@ -263,6 +272,30 @@ CLICOLOR_FORCE= GREP_OPTIONS=
 unset CLICOLOR_FORCE GREP_OPTIONS
 _m4_popdef([AS_EXIT])])# _AS_DETECT_BETTER_SHELL
 
+# _AS_REEXEC_WITH_SHELL(SHELL)
+# ----------------------------
+# Re-execute the current script with the given shell, trying to preserve
+# portable settings (e.g., the `xtrace' and `verbose' shell flag).
+m4_defun([_AS_REEXEC_WITH_SHELL], [dnl
+# We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in @%:@ ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $1 $as_opts "$as_myself" ${1+"address@hidden"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+AS_ECHO(["$[]0: could not re-execute with $1"]) >&2
+AS_EXIT([255])])# _AS_REEXEC_WITH_SHELL
+
 
 # _AS_PREPARE
 # -----------
diff --git a/tests/m4sh.at b/tests/m4sh.at
index a5ef905..ba8991a 100644
--- a/tests/m4sh.at
+++ b/tests/m4sh.at
@@ -17,6 +17,120 @@ AT_BANNER([M4sh.])
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+## --------------------------- ##
+## Re-exec with CONFIG_SHELL.  ##
+## --------------------------- ##
+
+AT_SETUP([No extra re-exec with CONFIG_SHELL])
+AT_KEYWORDS([CONFIG_SHELL])
+AT_DATA_M4SH([script.as],
+[[
+dnl We have to muck with internal details to goad the script into
+dnl thinking that the default shell is always good enough.
+m4_define([_AS_DETECT_REQUIRED_BODY], [])dnl
+m4_define([_AS_DETECT_SUGGESTED_BODY], [])dnl
+AS_INIT
+echo foo > ok
+]])
+AT_CHECK_M4SH
+AT_CHECK([CONFIG_SHELL=/bin/false ./script], [0], [], [])
+AT_CHECK([test -f ok], [0])
+rm -f ok
+
+AT_CLEANUP
+
+AT_SETUP([Forced re-exec with CONFIG_SHELL])
+AT_KEYWORDS([CONFIG_SHELL])
+
+AT_DATA_M4SH([script.as],
+[[m4_define([_AS_FORCE_REEXEC_WITH_CONFIG_SHELL], [yes])
+AS_INIT
+echo foo > sentinel
+]])
+AT_CHECK_M4SH
+
+AT_DATA([fake-shell],
+[[#!/bin/sh
+echo 'Fake shell executed.'
+shift # fake shell
+echo "nargs = @S|@#"
+for i
+do
+  printf ' :%s:\n' "$i"
+done
+]])
+chmod a+x fake-shell
+
+AT_CHECK([CONFIG_SHELL=./fake-shell ./script 1 2 4 8], [0],
+[Fake shell executed.
+nargs = 4
+ :1:
+ :2:
+ :4:
+ :8:
+], [])
+AT_CHECK([test ! -f sentinel], [0])
+test ! -f sentinel || rm -f sentinel # Cleanup for next test.
+
+AT_CHECK(
+[CONFIG_SHELL=`pwd`/fake-shell sh script a 'b  c' '  d         e '],
+[0],
+[Fake shell executed.
+nargs = 3
+ :a:
+ :b  c:
+ :  d          e :
+], [])
+AT_CHECK([test ! -f sentinel], [0])
+test ! -f sentinel || rm -f sentinel # Cleanup for next test.
+
+AT_CHECK([(PATH=`pwd`:$PATH; export PATH;
+CONFIG_SHELL=fake-shell script '' '&' '!;*' '<(address@hidden:@)>,' 'x
+y  z
+1 2 3')], [0],
+[Fake shell executed.
+nargs = 5
+ ::
+ :&:
+ :!;*:
+ :<(address@hidden:@)>,:
+ :x
+y  z
+1 2 3:
+], [])
+AT_CHECK([test ! -f sentinel], [0])
+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.  ##
 ## ------------------- ##


hooks/post-receive
-- 
GNU Autoconf source repository



reply via email to

[Prev in Thread] Current Thread [Next in Thread]