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)