Re: AS_EXECUTABLE_P again

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Fri, Jan 21, 2005 at 11:54:45AM +0100, Ralf Wildenhues wrote:
> * Stepan Kasal wrote:
> > 2) The autoconf manual says you cannot use `test ! -d' with `if'.
...
> | You may use @samp{!} with @command{test}, but not with @command{if}:
> | @samp{test ! -r foo || exit 1}.
> 
> means that you may use
>   if test ! ...
> but not
>   if ! test ...
> portably.

oh, I see.
Paul, can I commit the attached below?
(I would mail it to autoconf-patches, of course.)

A related question:
The item about `!' mentions the following code:

	if @var{command}; then (exit 1); else :; fi

Can I change the suggestion to

	if @var{command}; then false; else :; fi

Yes, the exit code might be 255, but it shouldn't matter.
I think `false' is often a builtin, so we can save one process creation.

Stepan

2005-01-21  Stepan Kasal  <kasal@xxxxxx>

	* doc/autoconf.texi (Limitations of Builtins) <test>: Clarify that
	  `test !' is portable.

Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.865
diff -u -r1.865 autoconf.texi
--- doc/autoconf.texi	21 Jan 2005 00:03:40 -0000	1.865
+++ doc/autoconf.texi	21 Jan 2005 11:38:24 -0000
@@ -11082,8 +11082,9 @@
 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}.
+It's safe to use @samp{!} as an @emph{argument} to @command{test}, even
+with @command{if}: @samp{if test ! -d foo; then ...; fi}.
+But you cannot use @code{if ! test -d foo}; see the item @command{!} above.
 
 
 @item @command{test} (files)


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux