[Top][All Lists]

[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 10:18:54 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b1 Mnenhy/0.8.2 Thunderbird/3.0.4

On 05/15/2010 06:57 AM, Daniel Leidert wrote:
> Hi,

Hello, and thanks for the query,

> For a project I would like to get defines for every supported languages.
> The ALL_LINGUAS variable contains alist of language codes. Now I would
> like to get
> for every languages code in the variable. 

What you are attempting doesn't make much sense to me yet.  The whole
point of i18n is that the translation files can be maintained
independently of the executable, and that a person can install a subset
of the compiled .mo files according to their needs.  Therefore, any
compile-time test that sets a variable HAVE_LINGUA_foo in relation to
the languages on the compilation machine will most likely be out-of-date
when you copy the executable but not the translation file to a user's
machine.  Conversely, a translation language not available at configure
time might later be written and installed, at which point your
executable is already hard-coded not to use it.

> I tried this piece of code:
>> AS_FOR(
>>         [AC_lingua],
>>         [ac_lingua],
>>         [$ALL_LINGUAS],
>>         [
>>          AC_MSG_NOTICE([Having lingua ]AC_lingua)
>>          AH_TEMPLATE(AS_TR_CPP([HAVE_LINGUA_]AC_lingua), [Define to 1 for 
>> <AC_lingua> lingua support.])
>>          AC_DEFINE(AS_TR_CPP([HAVE_LINGUA_]AC_lingua))
>>         ]
>> )

AS_FOR is not (yet) documented; therefore, it is an internal macro, with
an interface that is subject to change.  You may be better off just
writing a normal shell loop rather than trying to use AS_FOR; at any
rate, going with a hand-written shell loop will reduce the complexity of
understanding whether m4 constructs are being applied correctly.

Beyond that, I'm not sure what you were expecting in the resulting
configure file.  It may be a case of under- or over-quoting some of your
m4 constructs, but without knowing your end goal or why you thought it
necessary to use an undocumented AS_FOR, I'm not sure what to suggest
for fixing it.

Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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