Re: m4_set_contains cannot find key

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

 



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

_______________________________________________
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