From: Eric Blake Date: Fri, 10 Apr 2009 04:33:37 +0000 (-0600) Subject: Improve documentation about if exit status. X-Git-Tag: v2.64~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0cd7cde0607fff469ac42f173e36c2dd8aad7ea3;p=thirdparty%2Fautoconf.git Improve documentation about if exit status. * doc/autoconf.texi (Limitations of Builtins) : Mention that exit status bugs don't affect modern targets. Reported by Andreas Schwab. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index efa5501e9..2ad6ee7ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-04-13 Eric Blake + Improve documentation about if exit status. + * doc/autoconf.texi (Limitations of Builtins) : Mention that + exit status bugs don't affect modern targets. + Reported by Andreas Schwab. + Add cross-reference to new macros. * doc/autoconf.texi (Text processing Macros) : Reference the new m4_ifblank. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 35cf745ac..9e341d963 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -15836,7 +15836,8 @@ AS_IF([cmp -s file file.new], [], [mv file.new file]) This is especially useful in other M4 macros, where the @dfn{then} and @dfn{else} branches might be macro arguments. -There are shells that do not reset the exit status from an @command{if}: +Some very old shells did not reset the exit status from an @command{if} +with no @command{else}: @example $ @kbd{if (exit 42); then true; fi; echo $?} @@ -15844,9 +15845,10 @@ $ @kbd{if (exit 42); then true; fi; echo $?} @end example @noindent -whereas a proper shell should have printed @samp{0}. This is especially -bad in makefiles since it produces false failures. This is why properly -written makefiles, such as Automake's, have such hairy constructs: +whereas a proper shell should have printed @samp{0}. But this is no +longer a portability problem; any shell that supports functions gets it +correct. However, it explains why some makefiles have lengthy +constructs: @example if test -f "$file"; then