]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
m4sh: preserve set -vx over re-exec
authorEric Blake <eblake@redhat.com>
Wed, 8 Sep 2010 16:31:50 +0000 (10:31 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 8 Sep 2010 16:43:25 +0000 (10:43 -0600)
See http://lists.gnu.org/archive/html/bug-gnulib/2010-09/msg00035.html
for the motivation for this patch.

* lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL): Trace through
re-exec, to make it easier to debug script startup issues.
Idea from recent bug-gnulib change to init.sh.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
lib/m4sugar/m4sh.m4

index 5edb50c479364f8eaf5e9ac350851941851ef1d3..027741942d1a94f904dc055734a765583ea8cdf6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-09-08  Eric Blake  <eblake@redhat.com>
 
+       m4sh: preserve set -vx over re-exec
+       * lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL): Trace through
+       re-exec, to make it easier to debug script startup issues.
+       Idea from recent bug-gnulib change to init.sh.
+
        docs: update alloca recommendations
        * doc/autoconf.texi (Particular Functions): Don't redeclare alloca
        on FreeBSD.
index ef99cb5a0b523ef1611cb462e0a93c3633a81139..ca221614833d5e79e495aad3cd2af4a9cc898cb5 100644 (file)
@@ -227,11 +227,18 @@ dnl Remove any tests from suggested that are also required
        [# 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
-       exec "$CONFIG_SHELL" "$as_myself" ${1+"$[@]"}])
+       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+"$[@]"}])
 
 dnl Unfortunately, $as_me isn't available here.
     AS_IF([test x$as_have_required = xno],