autoconf
[Top][All Lists]
Advanced

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

Re: m4_set_contains cannot find key


From: Eric Blake
Subject: Re: m4_set_contains cannot find key
Date: Fri, 18 Mar 2016 09:02:34 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

On 03/18/2016 05:39 AM, Petre Pircalabu wrote:
> Please disregard this question. The m4 preprocessing is done before
> "configure", so the m4 preprocessor has no way of knowing about the
> variable.

Correct - you were mixing two languages (m4 and shell), and which gets
run when.

>> m4_set_add([food], [fish])
>> m4_set_add([food], [steak])
>> m4_set_add([food], [junk])
>>
>> meal=junk
>>
>> AC_MSG_CHECKING([whether we have junk food for dinner])
>> m4_set_contains([food], [$meal], [VAL="yes"], [VAL="no"])

The literal string '$meal' (at m4-time) is NOT in the set, so the m4
result of the expansion is always going to trigger the 'VAL="no"'
branch.  If you want to see if the contents of a shell variable are in a
shell set, then m4_set_* is not the right construct to be using.

-- 
Eric Blake   eblake redhat com    +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]