[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Iterating over variable using AC_DEFINE to get HAVE_FOO_varitem (sim
From: |
Eric Blake |
Subject: |
Re: Iterating over variable using AC_DEFINE to get HAVE_FOO_varitem (similar to AC_CHECK_HEADERS) |
Date: |
Mon, 17 May 2010 14:30:12 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b1 Mnenhy/0.8.2 Thunderbird/3.0.4 |
On 05/17/2010 01:44 PM, Daniel Leidert wrote:
>> AS_FOR is not (yet) documented;
>
> I tried m4_foreach_w too. But this fails too:
>
>> ALL_LINGUAS="de fr nl"
>> m4_foreach_w(
m4_foreach_w does iteration of a list known at m4 time...
>> [AC_lingua],
>> [$ALL_LINGUAS],
but $ALL_LINGUAS is a list not known until shell time. Therefore,
m4_foreach_w sees a single-element list - the string "$ALL_LINGUAS".
I meant that it would be worth writing an open-coded shell for loop:
for lingua in $ALL_LINGUAS; do
AC_MSG_NOTICE([...])
...
end
> Even if I use m4_unquote, m4_split, ... I can't get this to work. My
> working solution now is this one:
>
>> m4_define([_MY_LINGUAS], [de fr nl])
With this approach, you've moved the whitespace list of linguas out of
shell and into m4...
>> AC_SUBST([ALL_LINGUAS], "_MY_LINGUAS")
>> m4_foreach_w(
>> [AC_lingua],
>> _MY_LINGUAS,
which explains why this is working better for you.
> Unfortunately the shell loop didn't work for me. I tried this:
>
>> ALL_LINGUAS="de fr nl"
>> for lang in $ALL_LINGUAS
>> do
>> AC_MSG_NOTICE([Having lingua $lang])dnl debugging
>> AH_TEMPLATE(AS_TR_CPP([HAVE_LINGUA_$lang]), [Define to 1 for $lang
>> lingua support.])
>> AC_DEFINE(AS_TR_CPP([HAVE_LINGUA_$lang]))
>> done
>
> It did split the variable correctly, but AH_TEMPLATES didn't seem to
> work. Maybe I did something wrong (quotation maybe?)?
Ah - to use an indirect variable (as in the value of HAVE_LINGUA_$lang),
you have to us AS_VAR_PUSHDEF and AS_VAR_POPDEF. AH_TEMPLATE is a no-op
unless it has a literal argument, but you gave it an indirect argument.
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature