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: Eric Blake
Subject: Re: string manipulation : removing a part of a string
Date: Mon, 18 Jun 2012 07:16:06 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0

On 06/16/2012 12:01 AM, Vincent Torri wrote:
> 
> 
> On Fri, 15 Jun 2012, Eric Blake wrote:
> 
>> On 06/15/2012 04:55 PM, Vincent Torri wrote:
> 
>>> AC_DEFUN([EFL_CHECK_COMPILER_FLAG],
>>> [
>>> m4_pushdef([UPEFL], m4_translit([[$1]], [-a-z], [_A-Z]))
>>> m4_pushdef([UP], m4_translit([[$2]], [-a-z], [_A-Z]))
>>>
>>> m4_if(m4_index([$2], [-Wno-]), [0], [m4_pushdef([flagm4],
>>> [m4_bpatsubst([[$2]], [no-])])], [m4_pushdef([flagm4], [$2])])
>>
>> option=m4_bpatsubst([[$2]], [no-])
> 
> Actually, i want to store in option -Wfoo if $2 is -Wno-foo, and only
> that case. It's for testing if a compiler option is available (after
> discussion with gcc guys, -Wno-foo use produces a warning while -Wfoo
> use produces an error). So if I pass -fno-bar, option will store -fbar,
> which is not what I want. So I guess that I have to use the m4_if
> construction.

But you can still be shorter than using a pushdef:

option=m4_bpatsubst([[$2]], [^-Wno-], [-W])

Regular expression substitutions are quite powerful.

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org



Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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