autoconf
[Top][All Lists]
Advanced

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

Re: string manipulation : removing a part of a string


From: Vincent Torri
Subject: Re: string manipulation : removing a part of a string
Date: Mon, 18 Jun 2012 17:39:48 +0200 (CEST)



On Mon, 18 Jun 2012, Eric Blake wrote:

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

the patsubst() doc seems sufficient, actually :

http://uw714doc.sco.com/cgi-bin/info2html?%28m4%29Patsubst&lang=en

Also, if I'm not mistaken, there's a typo in the macro name :

m4_bpatsubsts (final s)
            ^

Wrong macro.  m4_bpatsubsts() with the final s is a different macro,
with even more power than m4_bpatsubst().

haa, ok

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.

ok, thank you !

Vincent Torri



reply via email to

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