autoconf-patches
[Top][All Lists]
Advanced

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

[PATCH] Shell function reporting


From: Eric Sunshine
Subject: [PATCH] Shell function reporting
Date: Tue, 6 Jan 2004 11:07:26 -0500

Hello,

The logic in AS_SHELL_SANITIZE() for reporting that it failed to find a  
function-supporting shell is just plain buggy.  In the case when $SHELL does  
not support functions, AS_SHELL_SANITIZE() reports that it could not find an  
appropriate shell even if it actually locates such a shell (which it assigns  
to CONFIG_SHELL).  Furthermore, when it actually does fail to find a suitable  
shell, it neglects to complain at all.  The logic is backward.

Here is a patch which implements the correct logic.  The patch also makes  
the code more robust by preventing the user from fooling configure into  
thinking that it has a valid shell if the user manually sets CONFIG_SHELL to  
a non-function-supporting shell.

Eric


2004-01-06  Eric Sunshine  <address@hidden>

        * lib/m4sugar/m4sh.m4 (AS_SHELL_SANITIZE): Fixed bogus error reporting
        logic.  If $SHELL did not support shell functions, and if it found a
        shell which did support functions, it would complain that it failed to
        find such a shell (backward logic).  Worse, it did not complain if it
        failed to find a suitable shell.  Now it complains iff it fails to find
        a function-supporting shell.


--- lib/m4sugar/m4sh.m4 Tue Jan  6 10:44:28 2004
+++ lib/m4sugar/m4sh.m4-fix     Tue Jan  6 10:44:08 2004
@@ -249,25 +249,22 @@
 fi

 dnl In the future, the `else' branch will be that in AS_INIT_WITH_SHELL_FN.
-AS_IF([_AS_SHELL_FN_WORK([$SHELL])], [], [
-  case $CONFIG_SHELL in
-  '')
-    _AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],
-      [for as_base in sh bash ksh sh5; do
-        case $as_dir in
-        /*)
-          AS_IF([_AS_SHELL_FN_WORK([$as_dir/$as_base])], [
-            AS_UNSET(BASH_ENV)
-            AS_UNSET(ENV)
-            CONFIG_SHELL=$as_dir/$as_base
-            export CONFIG_SHELL
-            exec "$CONFIG_SHELL" "$as_myself" ${1+"address@hidden"}
-          ]);;
-        esac
-       done]);;
-  *)
-    $1;;
-  esac
+AS_IF([_AS_SHELL_FN_WORK([${CONFIG_SHELL-${SHELL-/bin/sh}}])], [], [
+  _AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],
+    [for as_base in sh bash ksh sh5; do
+       case $as_dir in
+       /*)
+        AS_IF([_AS_SHELL_FN_WORK([$as_dir/$as_base])], [
+          AS_UNSET(BASH_ENV)
+          AS_UNSET(ENV)
+          CONFIG_SHELL=$as_dir/$as_base
+          export CONFIG_SHELL
+          exec "$CONFIG_SHELL" "$as_myself" ${1+"address@hidden"}
+        ]);;
+       esac
+     done])
+  # If we got this far, then we failed to find a function-supporting shell.
+  $1
 ])

 # Work around bugs in pre-3.0 UWIN ksh.




reply via email to

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