From: Akim Demaille Date: Thu, 30 Nov 2000 17:27:32 +0000 (+0000) Subject: * sh.m4 (AS_EXIT): Don't rely on false exiting 1. X-Git-Tag: autoconf-2.50~362 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=264fc11c212a691990b33232c3392909986d75fb;p=thirdparty%2Fautoconf.git * 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) : new. --- diff --git a/ChangeLog b/ChangeLog index 87bdf5106..46ec04f1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-11-30 Akim Demaille + + * 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) : new. + 2000-11-30 Akim Demaille * sh.m4 (_AS_EXPR_PREPARE): Don't rely on the exit status of a diff --git a/configure b/configure index 2b0dc744d..e847d29c3 100755 --- 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 <&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 </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: diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index e1970f242..d7dd96738 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/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]) diff --git a/m4sh.m4 b/m4sh.m4 index e1970f242..d7dd96738 100644 --- 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])