autoconf-patches
[Top][All Lists]
Advanced

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

Re: AS_IF


From: Bruno Haible
Subject: Re: AS_IF
Date: Tue, 06 Oct 2020 23:56:55 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-189-generic; KDE/5.18.0; x86_64; ; )

[CCing autoconf-patches]

Paul Eggert wrote in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-10/msg00019.html>:
> > AFAICS, this is relevant for code written directly into configure.ac. But
> > inside an AC_DEFUN it is irrelevant, because required macros are hoisted
> > before the body of the AC_DEFUN anyway.
> 
> I was playing it safe based on this NEWS item from Autoconf 2.69c:
> 
>     - Autoconf macros that use AC_REQUIRE internally, are not safe to
>       use inside of hand-written shell control-flow constructs.  Use
>       AS_IF, AS_CASE, AS_FOR, etc. instead.  (See the “Prerequisite
>       Macros” section of the manual for further explanation.)
> 
> Since I didn't know whether the macros in question used AC_REQUIRE 
> internally, I 
> played it safe.
> 
> But now that you mention it, AS_IF isn't needed here and I installed the 
> attached further patch. Also, to help prevent others from making a similar 
> mistake, I plan to reword the Autoconf NEWS item to start with something like 
> "Autoconf macros that use AC_REQUIRE are not safe to use in hand-written 
> shell 
> control-flow constructs that appear outside of macros defined by AC_DEFUN."

Thanks. But if you, Paul, make an incorrect assumption about what AS_IF really
does, how many more users (who read only the documentation) will make the same
mistake? I therefore think the documentation should be enhanced to avoid this
misinterpretation.

Proposed patch attached.

Bruno

Attachment: 0001-Clarify-that-AS_IF-and-AS_CASE-are-overkill-inside-A.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]