From: Eric Blake Date: Sat, 25 Oct 2008 12:29:37 +0000 (-0600) Subject: Document AS_EXIT. X-Git-Tag: v2.63b~195 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d9dae38a348f4e9cc827bed1e97b6b5a522dcfa;p=thirdparty%2Fautoconf.git Document AS_EXIT. * doc/autoconf.texi (Common Shell Constructs) : Document this macro. (Limitations of Builtins): Mention AS_EXIT. * NEWS: Mention it. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 70cc6fc04..a0f87ec61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2008-10-25 Eric Blake + Document AS_EXIT. + * doc/autoconf.texi (Common Shell Constructs) : Document + this macro. + (Limitations of Builtins): Mention AS_EXIT. + * NEWS: Mention it. + Use AS_EXIT in autoconf.as. * bin/autoconf.as: Consistently use AS_EXIT. diff --git a/NEWS b/NEWS index 496fac711..5bdff4860 100644 --- a/NEWS +++ b/NEWS @@ -23,9 +23,9 @@ GNU Autoconf NEWS - User visible changes. AS_LINENO_PREPARE AS_ME_PREPARE AS_VAR_APPEND AS_VAR_COPY ** The following m4sh macros are documented now: - AS_ECHO AS_ECHO_N AS_LITERAL_IF AS_UNSET AS_VAR_IF AS_VAR_POPDEF - AS_VAR_PUSHDEF AS_VAR_SET AS_VAR_SET_IF AS_VAR_TEST_SET - AS_VERSION_COMPARE + AS_ECHO AS_ECHO_N AS_EXIT AS_LITERAL_IF AS_UNSET AS_VAR_IF + AS_VAR_POPDEF AS_VAR_PUSHDEF AS_VAR_SET AS_VAR_SET_IF + AS_VAR_TEST_SET AS_VERSION_COMPARE ** The m4sh macros AS_IF and AS_CASE can now be used in shell lists. The responsibility for supplying a trailing newline now belongs to diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 85093229a..b89ce5b7a 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -11966,6 +11966,14 @@ for portability, should not include more than one newline. The bytes of Redirections can be placed outside the macro invocation. @end defmac +@defmac AS_EXIT (@dvar{status, 1}) +@asindex{EXIT} +Emit code to exit the shell with @var{status}. This works around shells +that see the exit status of the command prior to @code{exit} inside a +@samp{trap 0} handler (@pxref{Limitations of Builtins, , Limitations of +Shell Builtins}). +@end defmac + @defmac AS_IF (@var{test1}, @ovar{run-if-true1}, @dots{}, @ovar{run-if-false}) @asindex{IF} Run shell code @var{test1}. If @var{test1} exits with a zero status then @@ -15433,7 +15441,8 @@ $ @kbd{bash trap.sh} The portable solution is then simple: when you want to @samp{exit 42}, run @samp{(exit 42); exit 42}, the first @command{exit} being used to set the exit status to 42 for Zsh, and the second to trigger the trap -and pass 42 as exit status for Bash. +and pass 42 as exit status for Bash. In m4sh, this is covered by using +@code{AS_EXIT}. The shell in Free@acronym{BSD} 4.0 has the following bug: @samp{$?} is reset to 0 by empty lines if the code is inside @command{trap}.