]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
doc: mention shell operators preferred over `test` options.
authorKarl Berry <karl@freefriends.org>
Sun, 19 Nov 2023 02:25:16 +0000 (18:25 -0800)
committerKarl Berry <karl@freefriends.org>
Sun, 19 Nov 2023 02:25:16 +0000 (18:25 -0800)
* doc/automake.texi (Usage of Conditionals): mention that shell
operators (&&, ||, ()) are preferred over `test` options (-a, -o,
\(\)). Idea and POSIX url reference from Michael Stapelberg,
https://lists.gnu.org/archive/html/automake-patches/2016-10/msg00002.html

doc/automake.texi

index 51a3c3dbe0aa161af4636b537fd7aff941a9f3d4..635bdd28c450e0ca1335cd1a8249b2ad6ac76316 100644 (file)
@@ -11118,6 +11118,14 @@ must arrange for @emph{every} @code{AM_CONDITIONAL} to be invoked every
 time @command{configure} is run.  If @code{AM_CONDITIONAL} is run
 conditionally (e.g., in a shell @code{if} statement), then the result
 will confuse @command{automake}.
+
+For portability, it is best to use shell operators @code{&&} and
+@code{||} and parentheses, when constructing a compound
+@var{condition} using the @command{test} command, and not the
+@code{-a} and @code{-o} options and parentheses as options to
+@command{test}, all of which have been marked obsolescent by POSIX
+(@url{https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html#tag_20_128_161}).
+The name @code{test} is also more portable than @code{[}.
 @end defmac
 
 @cindex @option{--enable-debug}, example