autoconf
[Top][All Lists]
Advanced

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

Re: shell or M4sugar?


From: Julien ÉLIE
Subject: Re: shell or M4sugar?
Date: Sat, 9 Jan 2021 12:24:03 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.6.0

Hi Zack,

AS_CASE([$host],
      [*-openbsd*],
          [CC_WARNINGS=`echo "$CC_WARNINGS" | sed 's/-Wredundant-decls //'`])

Using AS_CASE means you don't have to write unbalanced parentheses in
your configure.ac or extension .m4 file.  If this is the top level of
configure.ac, it also means the AC_REQUIRE machinery knows not to emit
required macros inside the conditional.

Noted, thanks for your detailed answer.


Using AS_ECHO means you don't have to worry about echo interpreting
text to be echoed as options.  Sometimes you know that's not relevant,
but in this example, $CC_WARNINGS is a list of compiler options, so I
would definitely use AS_ECHO.

AS_ECHO(["$CC_WARNINGS"]) - yes, you need to quote for *both* m4 and shell - but otherwise yes, that's the preferred form.
OK.

Incidentally, the below sentence present in the Section of the documentation for the echo built-in shell function could be worthwhile also writing in the AS_ECHO documentation. It would make clearer what AS_ECHO does.

"M4sh provides AS_ECHO and AS_ECHO_N macros which choose between various portable implementations: ‘echo’ or ‘print’ where they work, printf if it is available, or else other creative tricks in order to work around the above problems."


Or the CC_WARNINGS be m4_define'd and then manipulated through m4_append
& like, and use m4_bpatsubst for doing what sed does?

That won't work here; the value of $host is not yet known when you run
autoconf, only when you run configure.

(This is the difference between the "m4sugar" and "m4sh" layers.  m4_*
macros are fully executed at autoconf time, AS_* macros generate code
that will be executed at configure time.)

I'll remember that, thanks.

--
Julien ÉLIE

« J'aime les calculs faux car ils donnent des résultats plus justes. »
  (Jean Arp)



reply via email to

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