From: Akim Demaille Date: Wed, 7 Jun 2000 07:07:39 +0000 (+0000) Subject: * doc/autoconf.texi (Limitations of Builtins): More on `test' and X-Git-Tag: autoconf-2.50~828 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e54d5fae471a3f1df7db62beb96cbc4d00b71f52;p=thirdparty%2Fautoconf.git * doc/autoconf.texi (Limitations of Builtins): More on `test' and `case'. Some on `if' and `break'. --- diff --git a/ChangeLog b/ChangeLog index 7ecdfb515..0776dd34b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-06-07 Akim Demaille + + * doc/autoconf.texi (Limitations of Builtins): More on `test' and + `case'. + Some on `if' and `break'. + 2000-06-07 Morten Eriksen * acspecific.m4 (_AC_PATH_X_DIRECT): Include `X11/Intrinsic.h' diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 2da2c08c9..be7582137 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -4761,8 +4761,16 @@ often possible to avoid this problem using @samp{echo "x$word"}, taking the @samp{x} into account later in the pipe. @table @asis +@item @command{break} +@cindex @command{break} +The use of @samp{break 2} etc. is safe. + @item @command{case} @cindex @command{case} +You don't need to quote the argument, no splitting is performed. + +You don't need the last @samp{;;}, but you should use it. + Because of a bug in its @code{fnmatch}, @command{bash} fails to handle properly backslashes in character classes: @@ -4841,6 +4849,24 @@ alternately @samp{foo} and @samp{bar}, although it should only print Therefore you should @command{export} again each environment variable you update. +@item @command{if} +@cindex @command{if} +Using @samp{!} is not portable. Instead of + +@example +if ! cmp -s file file.new; then + mv file.new file +fi +@end example + +@noindent +use + +@example +if cmp -s file file.new; then :; else + mv file.new file +fi +@end example @item @command{test} @cindex @command{test} @@ -4857,13 +4883,17 @@ operators; consequently, @sc{posix} does not specify them, so using them is nonportable. If you combine @samp{&&} and @samp{||} in the same statement, keep in mind that they have equal precedence. +You may use @samp{!} with @command{test}, but not with @command{if}: +@samp{test ! -r foo || exit 1}. + @item @command{test} (files) To enable @code{configure} scripts to support cross-compilation, they shouldn't do anything that tests features of the build system instead of the host system. But occasionally you may find it necessary to check whether some arbitrary file exists. To do so, use @samp{test -f} or @samp{test -r}. Do not use @samp{test -x}, because @sc{4.3bsd} does not -have it. +have it. Do not use @samp{test -e} either. +@c FIXME: Jim, what was the system? @item @command{test} (strings) Avoid @samp{test "@var{string}"}, in particular if @var{string} might