]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/m4sugar/m4sh.m4 (M4SH-SANITIZE): New diversion.
authorPaolo Bonzini <bonzini@gnu.org>
Fri, 30 Jan 2004 14:29:18 +0000 (14:29 +0000)
committerPaolo Bonzini <bonzini@gnu.org>
Fri, 30 Jan 2004 14:29:18 +0000 (14:29 +0000)
(AS_INIT): Output shell initialization there. Removed optional
parameter. Expand _AS_SHELL_FN_SPY.
(AS_INIT_WITH_SHELL_FN): Removed.
(_AS_SHELL_FN_SPY): New macro.
(AS_DETECT_REQUIRED, AS_DETECT_SUGGESTED): New
macros.
(AS_SHELL_SANITIZE): Remove loop to find better shell
and documentation for the parameter.
(_AS_DETECT_BETTER_SHELL): Move it here.
(_AS_SHELL_FN_WORK): Remove shell invocation, reformat.
(_AS_RUN): Move it here, support testing with eval.
(AS_REQUIRE_SHELL_FN): Require shell functions when
it is used.
(_AS_LINENO_WORKS): Put around braces, we do not
trigger the bash bug anymore.
* lib/autotest/general.m4: Document M4SH-SANITIZE, do not
use AS_INIT_WITH_SHELL_FN.
* bin/autoconf.in, tests/wrapper.in: Regenerated.

ChangeLog
bin/autoconf.in
lib/autotest/general.m4
lib/m4sugar/m4sh.m4
tests/wrapper.in

index ed57e2aa234064f5948ae868b6fb588d7b0dd9d7..96ea5536811cc8eb689b5ecb88e6eee53ed0f77d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,28 @@
-2003-11-26  Paolo Bonzini  <bonzini@bogus.example.com>
+2004-01-30 Paolo Bonzini <bonzini@bogus.example.com>
+           Eric Sunshine <sunshine@sunshineco.com>
+           Paul Eggert <eggert@twinsun.com>
+
+        * lib/m4sugar/m4sh.m4 (M4SH-SANITIZE): New diversion.
+        (AS_INIT): Output shell initialization there. Removed optional
+        parameter. Expand _AS_SHELL_FN_SPY.
+        (AS_INIT_WITH_SHELL_FN): Removed.
+        (_AS_SHELL_FN_SPY): New macro.
+        (AS_DETECT_REQUIRED, AS_DETECT_SUGGESTED): New
+        macros.
+        (AS_SHELL_SANITIZE): Remove loop to find better shell
+        and documentation for the parameter.
+        (_AS_DETECT_BETTER_SHELL): Move it here.
+        (_AS_SHELL_FN_WORK): Remove shell invocation, reformat.
+        (_AS_RUN): Move it here, support testing with eval.
+        (AS_REQUIRE_SHELL_FN): Require shell functions when
+        it is used.
+        (_AS_LINENO_WORKS): Put around braces, we do not
+        trigger the bash bug anymore.
+        * lib/autotest/general.m4: Document M4SH-SANITIZE, do not
+        use AS_INIT_WITH_SHELL_FN.
+        * bin/autoconf.in, tests/wrapper.in: Regenerated.
+
+2004-01-30  Paolo Bonzini  <bonzini@gnu.org>
 
        * bin/autoupdate.in: Trace AU_DEFINE instead of AU_DEFUN.
        * doc/autoconf.texi: Don't say that the third parameter
index 9127547ec014eeb256c1fe09cf3593752b181d4f..f946a75aa1df43130d060c55f35b5b6eaa19dd8b 100644 (file)
@@ -69,35 +69,73 @@ if test ! -f "$as_myself"; then
    { (exit 1); exit 1; }; }
 fi
 
-if { $SHELL 2>/dev/null <<\_ASEOF
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
-  set -o posix
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
 fi
-DUALCASE=1; export DUALCASE # for MKS sh
 
-func_return () {
-  (exit $1)
-}
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
 
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+
+if test "x$CONFIG_SHELL" = x; then
+  if (eval ":") 2>/dev/null; then
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+
+  if test $as_have_required = yes &&    (eval ":
+(func_return () {
+  (exit \$1)
+}
 func_success () {
   func_return 0
 }
-
 func_failure () {
   func_return 1
 }
-
 func_ret_success () {
   return 0
 }
-
 func_ret_failure () {
   return 1
 }
@@ -106,52 +144,66 @@ exitcode=0
 if func_success; then
   :
 else
-
   exitcode=1
   echo func_failure succeeded.
-
 fi
 
 if func_failure; then
-
   exitcode=1
   echo func_success failed.
-
 fi
 
 if func_ret_success; then
   :
 else
-
   exitcode=1
   echo func_ret_success failed.
-
 fi
 
 if func_ret_failure; then
-
   exitcode=1
   echo func_ret_failure succeeded.
-
 fi
 
-{ (exit $exitcode); exit $exitcode; }
-_ASEOF
-}; then
+test \$exitcode = 0) || { (exit 1); exit 1; }
+") 2> /dev/null; then
   :
 else
-
-  case $CONFIG_SHELL in
-  '')
+  as_candidate_shells="$SHELL"
     as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for as_base in sh bash ksh sh5; do
-        case $as_dir in
+  case $as_dir in
         /*)
-          if { $as_dir/$as_base 2>/dev/null <<\_ASEOF
+          for as_base in sh bash ksh sh5; do
+            as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+          done
+       esac
+done
+
+
+      for as_shell in $as_candidate_shells; do
+        if { $as_shell 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+:
+_ASEOF
+}; then
+  CONFIG_SHELL=$as_shell
+              as_have_required=yes
+              if { $as_shell 2> /dev/null <<\_ASEOF
 # Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   emulate sh
@@ -164,22 +216,19 @@ elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
 fi
 DUALCASE=1; export DUALCASE # for MKS sh
 
-func_return () {
+:
+(func_return () {
   (exit $1)
 }
-
 func_success () {
   func_return 0
 }
-
 func_failure () {
   func_return 1
 }
-
 func_ret_success () {
   return 0
 }
-
 func_ret_failure () {
   return 1
 }
@@ -188,106 +237,108 @@ exitcode=0
 if func_success; then
   :
 else
-
   exitcode=1
   echo func_failure succeeded.
-
 fi
 
 if func_failure; then
-
   exitcode=1
   echo func_success failed.
-
 fi
 
 if func_ret_success; then
   :
 else
-
   exitcode=1
   echo func_ret_success failed.
-
 fi
 
 if func_ret_failure; then
-
   exitcode=1
   echo func_ret_failure succeeded.
-
 fi
 
-{ (exit $exitcode); exit $exitcode; }
+test $exitcode = 0) || { (exit 1); exit 1; }
+
 _ASEOF
 }; then
+  break
+fi
+
+fi
 
-            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
-            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
-            CONFIG_SHELL=$as_dir/$as_base
-            export CONFIG_SHELL
-            exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+      done
 
+      if test "x$CONFIG_SHELL" != x; then
+  $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+        $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+        export CONFIG_SHELL
+        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
 fi
-;;
-        esac
-       done
-done
-;;
-  esac
 
-echo Found no shell that has working shell functions.
-echo
-echo Please tell autoconf@gnu.org about your system.
+
+    if test $as_have_required = no; then
+  echo This script requires a shell more modern than all the
+      echo shells that I found on your system.  Please install a
+      echo modern shell, or manually run the script under such a
+      echo shell if you do have one.
+      { (exit 1); exit 1; }
+fi
 
 
 fi
 
+fi
 
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
 
-# NLS nuisances.
-for as_var in \
-  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-  LC_TELEPHONE LC_TIME
-do
-  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
-    eval $as_var=C; export $as_var
-  else
-    $as_unset $as_var
-  fi
-done
 
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
-  as_expr=expr
+(eval "func_return () {
+  (exit \$1)
+}
+func_success () {
+  func_return 0
+}
+func_failure () {
+  func_return 1
+}
+func_ret_success () {
+  return 0
+}
+func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if func_success; then
+  :
 else
-  as_expr=false
+  exitcode=1
+  echo func_failure succeeded.
 fi
 
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
-  as_basename=basename
-else
-  as_basename=false
+if func_failure; then
+  exitcode=1
+  echo func_success failed.
 fi
 
+if func_ret_success; then
+  :
+else
+  exitcode=1
+  echo func_ret_success failed.
+fi
 
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-        X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)$' \| \
-        .     : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
-         /^X\/\(\/\/\)$/{ s//\1/; q; }
-         /^X\/\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
+if func_ret_failure; then
+  exitcode=1
+  echo func_ret_failure succeeded.
+fi
 
+test \$exitcode = 0") || {
+  echo No shell found that supports shell functions.
+  echo Please tell autoconf@gnu.org about your system,
+  echo including any error possibly output before this
+  echo message
+}
 
 # autoconf -- create `configure' using m4 macros
 # Copyright (C) 1992, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003
index 6ab5eec144af18882cc2d418370dcecda3f6649c..01954317139b39cdebc1a827f2d97b758a845954 100644 (file)
@@ -1,6 +1,6 @@
 # This file is part of Autoconf.                          -*- Autoconf -*-
 # M4 macros used in building test suites.
-# Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -60,7 +60,8 @@
 #    1. HEADER-REVISION
 #    2. HEADER-COMMENT
 #    3. HEADER-COPYRIGHT
-#    4. M4SH-INIT
+#    4. M4SH-SANITIZE
+#    5. M4SH-INIT
 # 1000. BODY
 #
 # Defined below:
@@ -142,7 +143,7 @@ m4_define([AT_TESTSUITE_NAME],
          m4_defn([AT_PACKAGE_STRING])[ test suite]m4_ifval([$1], [: $1]))
 m4_define([AT_ordinal], 0)
 m4_define([AT_banner_ordinal], 0)
-AS_INIT_WITH_SHELL_FN
+AS_INIT
 AS_PREPARE
 m4_divert_push([DEFAULTS])dnl
 
index 68861d275e112e93f67c218160f2ddb77780bc99..447b09c7d9ef27bd005ac8a3864b5255dcec702a 100644 (file)
 #   Purpose of the script etc.
 # - HEADER-COPYRIGHT
 #   Copyright notice(s)
+# - M4SH-SANITIZE
+#   M4sh's shell setup
 # - M4SH-INIT
-#   M4sh's initializations
-#
+#   M4sh initialization
 # - BODY
 #   The body of the script.
 
@@ -81,7 +82,8 @@ m4_define([_m4_divert(BINSH)],             0)
 m4_define([_m4_divert(HEADER-REVISION)],   1)
 m4_define([_m4_divert(HEADER-COMMENT)],    2)
 m4_define([_m4_divert(HEADER-COPYRIGHT)],  3)
-m4_define([_m4_divert(M4SH-INIT)],         4)
+m4_define([_m4_divert(M4SH-SANITIZE)],     4)
+m4_define([_m4_divert(M4SH-INIT)],         5)
 m4_define([_m4_divert(BODY)],           1000)
 
 # Aaarg.  Yet it starts with compatibility issues...  Libtool wants to
@@ -141,8 +143,7 @@ m4_define([AS_REQUIRE],
 # xx_REQUIRE macros, BODY-TO-EXPAND is mandatory.
 #
 m4_define([AS_REQUIRE_SHELL_FN],
-[m4_provide_if([AS_INIT_WITH_SHELL_FN],
-              [m4_warn([syntax], [AS_INIT_WITH_SHELL_FN not called.])])dnl
+[AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])dnl
 m4_provide_if([AS_SHELL_FN_$1], [],
                [m4_provide([AS_SHELL_FN_$1])m4_divert_text([M4SH-INIT], [$1() {
 $2
@@ -167,58 +168,126 @@ DUALCASE=1; export DUALCASE # for MKS sh
 ])
 
 
-# _AS_SHELL_FN_WORK(TESTED-SHELL)
-# --------------------------------------------------
+# _AS_RUN(TEST, [SHELL])
+# ----------------------
+# Run TEST under the current shell (if one parameter is used)
+# or under the given SHELL, protecting it from syntax errors.
+m4_define([_AS_RUN],
+[m4_ifval([$2],
+[{ $2 <<\_ASEOF
+_AS_BOURNE_COMPATIBLE
+$1
+_ASEOF
+}],
+[(eval "AS_ESCAPE(m4_quote($1))")])])
+
+# AS_DETECT_REQUIRED(TEST)
+# ------------------------
+# Refuse to execute under a shell that does not pass
+# the given TEST.
+m4_define([_AS_DETECT_REQUIRED_BODY], [:])
+m4_defun([AS_DETECT_REQUIRED],
+[m4_require([_AS_DETECT_BETTER_SHELL])dnl
+m4_expand_once([m4_append([_AS_DETECT_REQUIRED_BODY], [
+($1) || AS_EXIT(1)
+])], [AS_DETECT_REQUIRED_provide($1)])])
+
+# AS_DETECT_SUGGESTED(TEST)
+# -------------------------
+# Prefer to execute under a shell that passes the given TEST.
+m4_define([_AS_DETECT_SUGGESTED_BODY], [:])
+m4_defun([AS_DETECT_SUGGESTED],
+[m4_require([_AS_DETECT_BETTER_SHELL])dnl
+m4_expand_once([m4_append([_AS_DETECT_SUGGESTED_BODY], [
+($1) || AS_EXIT(1)
+])], [AS_DETECT_SUGGESTED_provide($1)])])
+
+# _AS_DETECT_BETTER_SHELL
+# -----------------------
+# The real workhorse for detecting a shell with the correct
+# features.
+m4_defun_once([_AS_DETECT_BETTER_SHELL],
+[m4_wrap([m4_divert_text([M4SH-SANITIZE], [
+if test "x$CONFIG_SHELL" = x; then
+  AS_IF([_AS_RUN([_AS_DETECT_REQUIRED_BODY]) 2>/dev/null],
+        [as_have_required=yes],
+       [as_have_required=no])
+  AS_IF([test $as_have_required = yes && dnl
+        _AS_RUN([_AS_DETECT_SUGGESTED_BODY]) 2> /dev/null],
+    [],
+    [as_candidate_shells="$SHELL"
+    _AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],
+      [case $as_dir in
+        /*)
+          for as_base in sh bash ksh sh5; do
+            as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+          done
+       esac])
+
+      for as_shell in $as_candidate_shells; do
+        AS_IF([_AS_RUN([_AS_DETECT_REQUIRED_BODY], [$as_shell 2> /dev/null])],
+              [CONFIG_SHELL=$as_shell
+              as_have_required=yes
+              AS_IF([_AS_RUN([_AS_DETECT_SUGGESTED_BODY], [$as_shell 2> /dev/null])],
+                    [break])])
+      done
+
+      AS_IF([test "x$CONFIG_SHELL" != x],
+        [AS_UNSET([ENV])
+        AS_UNSET([BASH_ENV])
+        export CONFIG_SHELL
+        exec "$CONFIG_SHELL" "$as_myself" ${1+"$[@]"}])
+
+    AS_IF([test $as_have_required = no],
+      [echo This script requires a shell more modern than all the
+      echo shells that I found on your system.  Please install a
+      echo modern shell, or manually run the script under such a
+      echo shell if you do have one.
+      AS_EXIT(1)])
+    ])
+fi
+])])])
+
+
+# _AS_SHELL_FN_WORK
+# -----------------
 # This is a spy to detect "in the wild" shells that do not support shell
 # functions correctly.  It is based on the m4sh.at Autotest testcases.
 m4_define([_AS_SHELL_FN_WORK],
-[{ $1 2>/dev/null <<\_ASEOF
-_AS_BOURNE_COMPATIBLE
-func_return () {
+[func_return () {
   (exit [$]1)
 }
-
 func_success () {
   func_return 0
 }
-
 func_failure () {
   func_return 1
 }
-
 func_ret_success () {
   return 0
 }
-
 func_ret_failure () {
   return 1
 }
 
 exitcode=0
-AS_IF([func_success], [], [
-  exitcode=1
-  echo func_failure succeeded.
-])
-AS_IF([func_failure], [
-  exitcode=1
-  echo func_success failed.
-])
-AS_IF([func_ret_success], [], [
-  exitcode=1
-  echo func_ret_success failed.
-])
-AS_IF([func_ret_failure], [
-  exitcode=1
-  echo func_ret_failure succeeded.
-])
-AS_EXIT($exitcode)
-_ASEOF
-}])
-
-# AS_SHELL_SANITIZE(WHAT-IF-SHELL-FUNCTIONS-DO-NOT-WORK)
-# ------------------------------------------------------
-# The parameter is temporary; it will go away and you
-# should not rely on it.
+AS_IF([func_success], [],
+  [exitcode=1
+  echo func_failure succeeded.])
+AS_IF([func_failure],
+  [exitcode=1
+  echo func_success failed.])
+AS_IF([func_ret_success], [],
+  [exitcode=1
+  echo func_ret_success failed.])
+AS_IF([func_ret_failure],
+  [exitcode=1
+  echo func_ret_failure succeeded.])
+test $exitcode = 0])
+
+
+# AS_SHELL_SANITIZE
+# -----------------
 m4_defun([AS_SHELL_SANITIZE],
 [## --------------------- ##
 ## M4sh Initialization.  ##
@@ -248,28 +317,6 @@ if test ! -f "$as_myself"; then
   AS_ERROR([cannot find myself; rerun with an absolute path])
 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+"$[@]"}
-          ]);;
-        esac
-       done]);;
-  *)
-    $1;;
-  esac
-])
-
 # Work around bugs in pre-3.0 UWIN ksh.
 $as_unset ENV MAIL MAILPATH
 PS1='$ '
@@ -649,6 +696,7 @@ m4_define([_AS_LINENO_WORKS],
 # configure.
 m4_define([_AS_LINENO_PREPARE],
 [AS_REQUIRE([_AS_CR_PREPARE])dnl
+AS_DETECT_SUGGESTED([_AS_LINENO_WORKS])
 _AS_LINENO_WORKS || {
 
   # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
@@ -1188,16 +1236,29 @@ m4_define([AS_VAR_POPDEF],
 [m4_popdef([$1])])
 
 
-
 ## ----------------- ##
 ## Setting M4sh up.  ##
 ## ----------------- ##
 
 
-# AS_INIT(WHAT-IF-SHELL-FUNCTIONS-DO-NOT-WORK)
-# --------------------------------------------
-# The parameter is temporary; it will go away and you
-# should not rely on it.
+# _AS_SHELL_FN_SPY
+# ----------------
+# This temporary macro checks "in the wild" for shells that do
+# not support shell functions.
+m4_define([_AS_SHELL_FN_SPY],
+[AS_DETECT_SUGGESTED([_AS_SHELL_FN_WORK])
+_AS_RUN([_AS_SHELL_FN_WORK]) || {
+  echo No shell found that supports shell functions.
+  echo Please tell autoconf@gnu.org about your system,
+  echo including any error possibly output before this
+  echo message
+}
+])
+
+
+# AS_INIT
+# -------
+# Initialize m4sh.
 m4_define([AS_INIT],
 [m4_init
 
@@ -1206,26 +1267,10 @@ m4_pattern_forbid([^_?AS_])
 
 # Bangshe and minimal initialization.
 m4_divert_text([BINSH], [@%:@! /bin/sh])
-m4_divert_text([M4SH-INIT], [AS_SHELL_SANITIZE([m4_default([$1], [
-echo Found no shell that has working shell functions.
-echo
-echo Please tell autoconf@gnu.org about your system.
-])])])
+m4_divert_text([M4SH-SANITIZE], [AS_SHELL_SANITIZE])
+AS_REQUIRE([_AS_SHELL_FN_SPY])
 
 # Let's go!
 m4_wrap([m4_divert_pop([BODY])[]])
 m4_divert_push([BODY])[]dnl
 ])
-
-# AS_INIT_WITH_SHELL_FN
-# ---------------------
-# Same as AS_INIT, but exit if shell functions are
-# not supported.
-m4_define([AS_INIT_WITH_SHELL_FN],
-[AS_INIT([
-echo Shell functions are not supported on any shell I could find 
-echo on your system.  This script requires shell functions: please
-echo install a modern shell, or manually run the script under such
-echo a shell if you do have one.
-AS_EXIT(1)
-])])
index 462f33c76a26be3769edf663675fb6cc73cde3e0..1c5a37dff631fbbea5519b1e351135638306c598 100755 (executable)
@@ -69,35 +69,73 @@ if test ! -f "$as_myself"; then
    { (exit 1); exit 1; }; }
 fi
 
-if { $SHELL 2>/dev/null <<\_ASEOF
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
-  set -o posix
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
 fi
-DUALCASE=1; export DUALCASE # for MKS sh
 
-func_return () {
-  (exit $1)
-}
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
 
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+
+if test "x$CONFIG_SHELL" = x; then
+  if (eval ":") 2>/dev/null; then
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+
+  if test $as_have_required = yes &&    (eval ":
+(func_return () {
+  (exit \$1)
+}
 func_success () {
   func_return 0
 }
-
 func_failure () {
   func_return 1
 }
-
 func_ret_success () {
   return 0
 }
-
 func_ret_failure () {
   return 1
 }
@@ -106,52 +144,66 @@ exitcode=0
 if func_success; then
   :
 else
-
   exitcode=1
   echo func_failure succeeded.
-
 fi
 
 if func_failure; then
-
   exitcode=1
   echo func_success failed.
-
 fi
 
 if func_ret_success; then
   :
 else
-
   exitcode=1
   echo func_ret_success failed.
-
 fi
 
 if func_ret_failure; then
-
   exitcode=1
   echo func_ret_failure succeeded.
-
 fi
 
-{ (exit $exitcode); exit $exitcode; }
-_ASEOF
-}; then
+test \$exitcode = 0) || { (exit 1); exit 1; }
+") 2> /dev/null; then
   :
 else
-
-  case $CONFIG_SHELL in
-  '')
+  as_candidate_shells="$SHELL"
     as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for as_base in sh bash ksh sh5; do
-        case $as_dir in
+  case $as_dir in
         /*)
-          if { $as_dir/$as_base 2>/dev/null <<\_ASEOF
+          for as_base in sh bash ksh sh5; do
+            as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+          done
+       esac
+done
+
+
+      for as_shell in $as_candidate_shells; do
+        if { $as_shell 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+:
+_ASEOF
+}; then
+  CONFIG_SHELL=$as_shell
+              as_have_required=yes
+              if { $as_shell 2> /dev/null <<\_ASEOF
 # Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   emulate sh
@@ -164,22 +216,19 @@ elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
 fi
 DUALCASE=1; export DUALCASE # for MKS sh
 
-func_return () {
+:
+(func_return () {
   (exit $1)
 }
-
 func_success () {
   func_return 0
 }
-
 func_failure () {
   func_return 1
 }
-
 func_ret_success () {
   return 0
 }
-
 func_ret_failure () {
   return 1
 }
@@ -188,107 +237,108 @@ exitcode=0
 if func_success; then
   :
 else
-
   exitcode=1
   echo func_failure succeeded.
-
 fi
 
 if func_failure; then
-
   exitcode=1
   echo func_success failed.
-
 fi
 
 if func_ret_success; then
   :
 else
-
   exitcode=1
   echo func_ret_success failed.
-
 fi
 
 if func_ret_failure; then
-
   exitcode=1
   echo func_ret_failure succeeded.
-
 fi
 
-{ (exit $exitcode); exit $exitcode; }
+test $exitcode = 0) || { (exit 1); exit 1; }
+
 _ASEOF
 }; then
+  break
+fi
+
+fi
 
-            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
-            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
-            CONFIG_SHELL=$as_dir/$as_base
-            export CONFIG_SHELL
-            exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+      done
 
+      if test "x$CONFIG_SHELL" != x; then
+  $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+        $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+        export CONFIG_SHELL
+        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
 fi
-;;
-        esac
-       done
-done
-;;
-  *)
 
-echo Found no shell that has working shell functions.
-echo
-echo Please tell autoconf@gnu.org about your system.
-;;
-  esac
 
+    if test $as_have_required = no; then
+  echo This script requires a shell more modern than all the
+      echo shells that I found on your system.  Please install a
+      echo modern shell, or manually run the script under such a
+      echo shell if you do have one.
+      { (exit 1); exit 1; }
 fi
 
 
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
+fi
 
-# NLS nuisances.
-for as_var in \
-  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-  LC_TELEPHONE LC_TIME
-do
-  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
-    eval $as_var=C; export $as_var
-  else
-    $as_unset $as_var
-  fi
-done
+fi
 
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
-  as_expr=expr
+
+
+(eval "func_return () {
+  (exit \$1)
+}
+func_success () {
+  func_return 0
+}
+func_failure () {
+  func_return 1
+}
+func_ret_success () {
+  return 0
+}
+func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if func_success; then
+  :
 else
-  as_expr=false
+  exitcode=1
+  echo func_failure succeeded.
 fi
 
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
-  as_basename=basename
-else
-  as_basename=false
+if func_failure; then
+  exitcode=1
+  echo func_success failed.
 fi
 
+if func_ret_success; then
+  :
+else
+  exitcode=1
+  echo func_ret_success failed.
+fi
 
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-        X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)$' \| \
-        .     : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
-         /^X\/\(\/\/\)$/{ s//\1/; q; }
-         /^X\/\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
+if func_ret_failure; then
+  exitcode=1
+  echo func_ret_failure succeeded.
+fi
 
+test \$exitcode = 0") || {
+  echo No shell found that supports shell functions.
+  echo Please tell autoconf@gnu.org about your system,
+  echo including any error possibly output before this
+  echo message
+}
 
 
 testdir=@abs_top_builddir@/tests