]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* sh.m4 (AS_EXIT): Don't rely on false exiting 1.
authorAkim Demaille <akim@epita.fr>
Thu, 30 Nov 2000 17:27:32 +0000 (17:27 +0000)
committerAkim Demaille <akim@epita.fr>
Thu, 30 Nov 2000 17:27:32 +0000 (17:27 +0000)
Actually, always use `(exit $val); exit', don't try smart stuff.
* doc/autoconf.texi (Limitations of Builtins) <false>: new.

ChangeLog
configure
doc/autoconf.texi
lib/m4sugar/m4sh.m4
m4sh.m4

index 87bdf51063431761736e08e0b849aac7a548d7a0..46ec04f1a6cf80e96fe88152dc3e061cbb52f1c8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-11-30  Akim Demaille  <akim@epita.fr>
+
+       * sh.m4 (AS_EXIT): Don't rely on false exiting 1.
+       Actually, always use `(exit $val); exit', don't try smart stuff.
+       * doc/autoconf.texi (Limitations of Builtins) <false>: new.
+
 2000-11-30  Akim Demaille  <akim@epita.fr>
 
        * sh.m4 (_AS_EXPR_PREPARE): Don't rely on the exit status of a
index 2b0dc744de37c1ee195495df8253195cf7a77f95..e847d29c3e4c90bd4c2f30f9950579b0364a942a 100755 (executable)
--- a/configure
+++ b/configure
@@ -239,7 +239,7 @@ do
     # Reject names that are not valid shell variable names.
     expr "x$ac_feature" : ".*[^-_$ac_cr_alnum]" >/dev/null &&
       {  echo "$as_me: error: invalid feature name: $ac_feature" >&2
-  { false; exit; }; }
+  { (exit 1); exit; }; }
     ac_feature=`echo $ac_feature | sed 's/-/_/g'`
     eval "enable_$ac_feature=no" ;;
 
@@ -248,7 +248,7 @@ do
     # Reject names that are not valid shell variable names.
     expr "x$ac_feature" : ".*[^-_$ac_cr_alnum]" >/dev/null &&
       {  echo "$as_me: error: invalid feature name: $ac_feature" >&2
-  { false; exit; }; }
+  { (exit 1); exit; }; }
     ac_feature=`echo $ac_feature | sed 's/-/_/g'`
     case $ac_option in
       *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
@@ -430,7 +430,7 @@ do
     # Reject names that are not valid shell variable names.
     expr "x$ac_package" : ".*[^-_$ac_cr_alnum]" >/dev/null &&
       {  echo "$as_me: error: invalid package name: $ac_package" >&2
-  { false; exit; }; }
+  { (exit 1); exit; }; }
     ac_package=`echo $ac_package| sed 's/-/_/g'`
     case $ac_option in
       *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
@@ -443,7 +443,7 @@ do
     # Reject names that are not valid shell variable names.
     expr "x$ac_package" : ".*[^-_$ac_cr_alnum]" >/dev/null &&
       {  echo "$as_me: error: invalid package name: $ac_package" >&2
-  { false; exit; }; }
+  { (exit 1); exit; }; }
     ac_package=`echo $ac_package | sed 's/-/_/g'`
     eval "with_$ac_package=no" ;;
 
@@ -467,7 +467,7 @@ do
 
   -*) {  echo "$as_me: error: unrecognized option: $ac_option
 Try \`$0 --help' for more information." >&2
-  { false; exit; }; }
+  { (exit 1); exit; }; }
     ;;
 
   *=*)
@@ -475,7 +475,7 @@ Try \`$0 --help' for more information." >&2
     # Reject names that are not valid shell variable names.
     expr "x$ac_envvar" : ".*[^_$ac_cr_alnum]" >/dev/null &&
       {  echo "$as_me: error: invalid variable name: $ac_envvar" >&2
-  { false; exit; }; }
+  { (exit 1); exit; }; }
     ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
     eval "$ac_envvar='$ac_optarg'"
     export $ac_envvar ;;
@@ -496,7 +496,7 @@ done
 if test -n "$ac_prev"; then
   ac_option=--`echo $ac_prev | sed 's/_/-/g'`
   {  echo "$as_me: error: missing argument to $ac_option" >&2
-  { false; exit; }; }
+  { (exit 1); exit; }; }
 fi
 
 # Be sure to have absolute paths.
@@ -509,7 +509,7 @@ do
     [\\/$]* | ?:[\\/]* ) ;;
     NONE ) ;;
     *)  {  echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2
-  { false; exit; }; };;
+  { (exit 1); exit; }; };;
   esac
 done
 
@@ -552,10 +552,10 @@ fi
 if test ! -r $srcdir/$ac_unique_file; then
   if test "$ac_srcdir_defaulted" = yes; then
     {  echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2
-  { false; exit; }; }
+  { (exit 1); exit; }; }
   else
     {  echo "$as_me: error: cannot find sources in $srcdir" >&2
-  { false; exit; }; }
+  { (exit 1); exit; }; }
   fi
 fi
 srcdir=`echo "$srcdir" | sed 's%\([^/]\)/*$%\1%'`
@@ -841,7 +841,7 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
 done
 if test -z "$ac_aux_dir"; then
   {  echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2
-  { false; exit; }; }
+  { (exit 1); exit; }; }
 fi
 ac_config_guess="$SHELL $ac_aux_dir/config.guess"
 ac_config_sub="$SHELL $ac_aux_dir/config.sub"
@@ -944,7 +944,7 @@ if (
       # happened.  Such a system could not be considered "sane".
       {  echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
 alias in your environment" >&2
-  { false; exit; }; }
+  { (exit 1); exit; }; }
    fi
 
    test "$2" = conftestfile
@@ -955,7 +955,7 @@ then
 else
    {  echo "$as_me: error: newly created file is older than distributed files!
 Check your system clock" >&2
-  { false; exit; }; }
+  { (exit 1); exit; }; }
 fi
 rm -f conftest*
 echo "$as_me:961: result: yes" >&5
@@ -1014,7 +1014,7 @@ VERSION=2.49b
 
 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
   {  echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2
-  { false; exit; }; }
+  { (exit 1); exit; }; }
 fi
 
 cat >>confdefs.h <<EOF
@@ -1166,7 +1166,7 @@ echo "$as_me:1165: result: $ac_cv_prog_gnu_m4" >&5
 echo "${ECHO_T}$ac_cv_prog_gnu_m4" >&6
 if test x"$ac_cv_prog_gnu_m4" != xyes; then
   {  echo "$as_me: error: GNU m4 1.4 is required" >&2
-  { false; exit; }; }
+  { (exit 1); exit; }; }
 fi
 # This is needed because Automake does not seem to realize there is
 # an AC_SUBST inside AC_PROG_GNU_M4.  Grmph!
@@ -1637,7 +1637,7 @@ cat >>$CONFIG_STATUS <<\EOF
     # Conflict between --help and --header
     {  echo "$as_me: error: ambiguous option: $ac_option
 Try \`$0 --help' for more information." >&2
-  { false; exit; }; };;
+  { (exit 1); exit; }; };;
   --help | --hel | -h )
     echo "$ac_cs_usage"; exit 0 ;;
   --debug | --d* | -d )
@@ -1662,9 +1662,9 @@ Try \`$0 --help' for more information." >&2
   # This is an error.
   -*) {  echo "$as_me: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&2
-  { false; exit; }; } ;;
+  { (exit 1); exit; }; } ;;
   *) {  echo "$as_me: error: invalid argument: $1" >&2
-  { false; exit; }; };;
+  { (exit 1); exit; }; };;
   esac
   shift
 done
@@ -1697,7 +1697,7 @@ $debug ||
 } ||
 {
    echo "$me: cannot create a temporary directory in $TMPDIR" >&2
-   { false; exit; }
+   { (exit 1); exit; }
 }
 
 EOF
@@ -1885,7 +1885,7 @@ echo "creating $ac_file" >&6;}
       [\\/$]* | ?:[\\/]*)
          # Absolute
          test -f "$f" || {  echo "$as_me: error: cannot find input file: $f" >&2
-  { false; exit; }; }
+  { (exit 1); exit; }; }
          echo $f;;
       *) # Relative
          if test -f "$f"; then
@@ -1897,10 +1897,10 @@ echo "creating $ac_file" >&6;}
          else
            # /dev/null tree
            {  echo "$as_me: error: cannot find input file: $f" >&2
-  { false; exit; }; }
+  { (exit 1); exit; }; }
          fi;;
       esac
-    done` || { false; exit; }
+    done` || { (exit 1); exit; }
 EOF
 cat >>$CONFIG_STATUS <<EOF
   sed "$ac_vpsub
@@ -1932,5 +1932,5 @@ EOF
 chmod +x $CONFIG_STATUS
 ac_clean_files=$ac_clean_files_save
 
-test "$no_create" = yes || $SHELL $CONFIG_STATUS || { false; exit; }
+test "$no_create" = yes || $SHELL $CONFIG_STATUS || { (exit 1); exit; }
 
index 86d94d7ffee0ccf8a774b383500c2a09c89991ab..d3027d97d38d9a3531ef7245e1bcb722c0709f97 100644 (file)
@@ -5515,11 +5515,15 @@ the @samp{x} into account later in the pipe.
 @cindex @command{!}
 You can't use @command{!}, you'll have to rewrite your code.
 
+
 @item @command{break}
+@c ------------------
 @cindex @command{break}
 The use of @samp{break 2} etc. is safe.
 
+
 @item @command{case}
+@c -----------------
 @cindex @command{case}
 You don't need to quote the argument, no splitting is performed.
 
@@ -5545,7 +5549,9 @@ bash-2.02$ case /tmp in [\\/]*) echo OK;; esac
 OK
 @end example
 
+
 @item @command{echo}
+@c -----------------
 @cindex @command{echo}
 The simple @code{echo} is probably the most surprising source of
 portability troubles.
@@ -5562,7 +5568,9 @@ and Zsh (in @command{sh} emulation mode) report 1.  Please note that the
 problem is truly @command{echo}: all the shells understand @samp{'\n'}
 as the string composed of a backslash and an n.
 
+
 @item @command{exit}
+@c -----------------
 @cindex @command{exit}
 @c FIXME: A better merging between this item and `trap' is welcome.
 Some shell scripts, such as those generated by @command{autoconf}, use a
@@ -5576,7 +5584,9 @@ cannot determine whether it was invoked by plain @code{exit} or by
 @code{exit 1}.  Instead of calling @code{exit} directly, use the
 @code{AC_MSG_ERROR} macro that has a workaround for this problem.
 
+
 @item @command{export}
+@c -------------------
 @cindex @command{export}
 The builtin @command{export} dubs @dfn{environment variable} a shell
 variable.  Each update of exported variables corresponds to an update of
@@ -5606,7 +5616,16 @@ alternately @samp{foo} and @samp{bar}, although it should only print
 Therefore you should @command{export} again each environment variable
 you update.
 
+
+@item @command{false}
+@c ------------------
+@cindex @command{false}
+Don't expect @command{false} to exit with status 1: The native Bourne
+shell of Solaris 2.8 exits with status 255.
+
+
 @item @command{for}
+@c ----------------
 @cindex @command{for}
 To loop over positional arguments, use
 
@@ -5656,6 +5675,7 @@ fi
 @end example
 
 @item @command{set}
+@c ----------------
 @cindex @command{set}
 This builtin faces the usual problem with arguments starting with a
 dash.  Modern shells, such as Bash or Zsh understand @samp{--} to
@@ -5670,12 +5690,14 @@ set x $my_list; shift
 @end example
 
 @item @command{shift}
+@c ------------------
 @cindex @command{shift}
 Not only is @command{shift}ing a bad idea when there is nothing left to
 shift, but in addition it is not portable: the shell of @sc{mips
 risc/os} 4.52 refuses it.
 
 @item @command{test}
+@c -----------------
 @cindex @command{test}
 The @code{test} program is the way to perform many file and string
 tests.  It is often invoked by the alternate name @samp{[}, but using
@@ -5773,7 +5795,9 @@ expr "x$ac_feature" : '.*[^-a-zA-Z0-9_]' >/dev/null &&
 "X@var{foo}" | grep "^X@var{bar}"}, because it avoids problems when
 @samp{@var{foo}} contains backslashes.
 
+
 @item @command{trap}
+@c -----------------
 @cindex @command{trap}
 It is safe to trap at least the signals 1, 2, 13 and 15.  You can also
 trap 0, i.e., have the trap run when the script end (either via an
@@ -5825,6 +5849,7 @@ $ exit
 Fortunately this bug affects only trap.
 
 @item @command{true}
+@c -----------------
 @cindex @command{true}
 @cindex @command{:}
 Don't worry: as far as we know @command{true} is portable.
@@ -5841,6 +5866,7 @@ for @command{true}.
 
 
 @item @command{unset}
+@c ------------------
 @cindex @command{unset}
 You cannot assume the support of @command{unset}, nevertheless, because
 it is extremely useful to disable embarrassing variables such as
@@ -5870,6 +5896,7 @@ find some limitations you should be aware of.
 
 @table @asis
 @item @command{awk}
+@c ----------------
 @cindex @command{awk}
 Don't leave white spaces before the parentheses in user functions calls,
 @sc{gnu} awk will reject it:
index e1970f242e15608c51b83ba0e67bb88d4d0eb43b..d7dd9673850b5a01dfe1011ff11f20fc7769bc98 100644 (file)
@@ -106,11 +106,7 @@ AS_UNSET([CDPATH], [:])
 # So we set $? by executing "exit N" in the subshell and then exit.
 # "false" is used for exit code 1 (default), ":" is used for 0
 m4_define([AS_EXIT],
-[{ m4_case([$1],
-           [0], [:; exit],
-           [],  [false; exit],
-           [1], [false; exit],
-           [(exit $1); exit]); }])
+[{ (exit m4_default([$1], 1)); exit; }])
 
 
 # AS_IFELSE(TEST, [IF-TRUE], [IF-FALSE])
diff --git a/m4sh.m4 b/m4sh.m4
index e1970f242e15608c51b83ba0e67bb88d4d0eb43b..d7dd9673850b5a01dfe1011ff11f20fc7769bc98 100644 (file)
--- a/m4sh.m4
+++ b/m4sh.m4
@@ -106,11 +106,7 @@ AS_UNSET([CDPATH], [:])
 # So we set $? by executing "exit N" in the subshell and then exit.
 # "false" is used for exit code 1 (default), ":" is used for 0
 m4_define([AS_EXIT],
-[{ m4_case([$1],
-           [0], [:; exit],
-           [],  [false; exit],
-           [1], [false; exit],
-           [(exit $1); exit]); }])
+[{ (exit m4_default([$1], 1)); exit; }])
 
 
 # AS_IFELSE(TEST, [IF-TRUE], [IF-FALSE])