autoconf-patches
[Top][All Lists]
Advanced

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

proposed patch to re-execute "configure" with a LINENO-grokking shell


From: Paul Eggert
Subject: proposed patch to re-execute "configure" with a LINENO-grokking shell
Date: Fri, 5 Oct 2001 17:40:00 -0700 (PDT)

> From: Akim Demaille <address@hidden>
> Date: 04 Oct 2001 17:39:04 +0200
> 
> I also forgot to say that your code could use happily AS_PATH_WALK.

OK, here's a revised patch that takes all your suggestions into
account.  It's much shorter, as I decided to omit AC_PROG_SHELL for
now.  This allows us to focus purely on LINENO issues, and not worry
about other POSIX shell features.

2001-10-05  Paul Eggert  <address@hidden>

        * doc/autoconf.texi (config.status Invocation):
        CONFIG_SHELL defaults to a shell that supports LINENO if available.

        * lib/m4sugar/m4sh.m4 (_AS_LINENO_PREPARE): If the current
        shell does not support LINENO, and if CONFIG_SHELL is unset or
        empty, and if we can find a shell that does support LINENO,
        then set CONFIG_SHELL to that shell and then re-execute
        ourselves with CONFIG_SHELL.

diff -pru autoconf-fiw0/doc/autoconf.texi autoconf-fiw1/doc/autoconf.texi
--- autoconf-fiw0/doc/autoconf.texi     Tue Oct  2 16:21:27 2001
+++ autoconf-fiw1/doc/autoconf.texi     Fri Oct  5 17:33:47 2001
@@ -10049,7 +10049,8 @@ can alter its behavior:
 @defvar CONFIG_SHELL
 @evindex CONFIG_SHELL
 The shell with which to run @code{configure} for the @option{--recheck}
-option.  It must be Bourne-compatible.  The default is @file{/bin/sh}.
+option.  It must be Bourne-compatible.  The default is a shell that
+supports @env{LINENO} if available, and @file{/bin/sh} otherwise.
 @end defvar
 
 @defvar CONFIG_STATUS
diff -pru autoconf-fiw0/lib/m4sugar/m4sh.m4 autoconf-fiw1/lib/m4sugar/m4sh.m4
--- autoconf-fiw0/lib/m4sugar/m4sh.m4   Fri Oct  5 11:29:39 2001
+++ autoconf-fiw1/lib/m4sugar/m4sh.m4   Fri Oct  5 16:52:44 2001
@@ -420,12 +420,16 @@ fi
 # it protects us from repetitive rewrites.  Be sure to have a test
 # that does detect non LINENO support...
 m4_define([_AS_LINENO_PREPARE],
-[as_lineno_1=$LINENO
-as_lineno_2=$LINENO
-as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-if test "x$as_lineno_1"  = "x$as_lineno_2" ||
-   test "x$as_lineno_3" != "x$as_lineno_2";
-  then
+[as_command='
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"
+'
+if eval "$as_command"; then
+  :
+else
   # Find who we are.  Look in the path if we contain no path at all
   # relative or not.
   case $[0] in
@@ -442,6 +446,20 @@ if test "x$as_lineno_1"  = "x$as_lineno_
   if test ! -f "$as_myself"; then
     AS_ERROR([cannot find myself; rerun with an absolute path])
   fi
+  case $CONFIG_SHELL in
+  '')
+    _AS_PATH_WALK([/bin:/usr/bin:$PATH],
+      [for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c "$as_command") 2>/dev/null; then
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$[0]" ${1+"address@hidden"}
+          fi;;
+        esac
+       done]);;
+  esac
   if test ! -f "$as_me.lineno" ||
      test x`ls -1dt "$as_me.lineno" "$as_myself" 2>/dev/null | sed 1q` \
                 != x"$as_me.lineno"; then



reply via email to

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