]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* doc/autoconf.texi (Limitations of Builtins): More on `test' and
authorAkim Demaille <akim@epita.fr>
Wed, 7 Jun 2000 07:07:39 +0000 (07:07 +0000)
committerAkim Demaille <akim@epita.fr>
Wed, 7 Jun 2000 07:07:39 +0000 (07:07 +0000)
`case'.
Some on `if' and `break'.

ChangeLog
doc/autoconf.texi

index 7ecdfb515f95e58f459d5f767390dd2a3d0d64ca..0776dd34b9a78b2f6cc75220c4e82024820d994e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-06-07  Akim Demaille  <akim@epita.fr>
+
+       * doc/autoconf.texi (Limitations of Builtins): More on `test' and
+       `case'.
+       Some on `if' and `break'.
+
 2000-06-07  Morten Eriksen  <mortene@sim.no>
 
        * acspecific.m4 (_AC_PATH_X_DIRECT): Include `X11/Intrinsic.h'
index 2da2c08c956999681fb2ce8cfd649f1293f1d64c..be758213759b12116e0062e54bd7c122b9cdb0d5 100644 (file)
@@ -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