On 06/15/2012 11:49 PM, Vincent Torri wrote:
This can be shortened:
m4_pushdef([flagm4], m4_bpatsubst([[$2]], [no-]))
since m4_bpatsubst is a no-op if the pattern 'no-' doesn't appear.
heh, as option=m4_bpatsubst([[$2]], [no-]) is working, there's no need.
It's so simple when you know how it works...
I finally found the doc of that m4 macro, and it's not mentioned that
it's a no op in some cases:
http://www.gnu.org/software/autoconf/manual/autoconf.html#Conditional-constructs
is it possible to add that ?
Patches welcome, if you think it would help. The current documentation
for m4_bpatsubst() just points to the GNU M4 manual for patsubst():
https://www.gnu.org/software/autoconf/manual/autoconf.html#Redefined-M4-Macros
m4_foreach_w([flag], [$2],
[EFL_CHECK_COMPILER_FLAG([$1], m4_defn([flag]))])
for $1, i was sure, but why is it not needed for m4_defn([flag]) ?
Because you _want_ the m4_defn() to be expanded up front, and because
the output of m4_defn is already quoted for reuse. In other words, you
want to call:
EFL_CHECK_COMPILER_FLAG([efl], [-Wfoo])
EFL_CHECK_COMPILER_FLAG([efl], [-Wno-bar])
and not:
EFL_CHECK_COMPILER_FLAG([efl], [m4_defn([flag])])
EFL_CHECK_COMPILER_FLAG([efl], [m4_defn([flag])])
because the latter wouldn't be checking the right flag names.