Re: string manipulation : removing a part of a string

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

 



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   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org



Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux