autoconf
[Top][All Lists]
Advanced

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

Re: avoiding undesired macro expansion after AS_TR_CPP


From: Eric Blake
Subject: Re: avoiding undesired macro expansion after AS_TR_CPP
Date: Thu, 03 Jun 2010 15:23:53 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b2pre Mnenhy/0.8.2 Thunderbird/3.0.4

On 06/03/2010 02:52 PM, Bruno Haible wrote:
> Hi,
> 
> I would like to avoid undesired macro expansion on the result of AS_TR_CPP,
> and cannot get it to work. Can someone help, please?
> 
> ================================ configure.ac =============================
> AC_INIT([dummy], [0])
> AM_INIT_AUTOMAKE
> 
> dnl m4_define([FOO_BAR], [undesired substitution])
> 
> AC_DEFUN([MYCOND],
> [
>   AM_CONDITIONAL([LIBUNISTRING_]AS_TR_CPP([$1]), [true])

AM_CONDITIONAL([LIBUNISTRING_]AS_TR_CPP([[$1]]), [true])

You want to double-quote the argument to AS_TR_CPP, since that macro
will be expanded immediately and strips one level of quotes.

> 
> So I guess some more quoting is needed.
> 
> Attempt #1: Use brackets. Change line 8 to
> 
>   AM_CONDITIONAL([LIBUNISTRING_][AS_TR_CPP([$1])], [true])

No, this delays the transformation until after AM_CONDITIONAL has run.

> Attempt #2: Use m4_quote. Change line 8 to
> 
>   AM_CONDITIONAL([LIBUNISTRING_]m4_quote(AS_TR_CPP([$1])), [true])

Still too late - the results of AS_TR_CPP are still expanded prior to
calling m4_quote.

> 
> Attempt #3: Use m4_dquote. Change line 8 to
> 
>   AM_CONDITIONAL([LIBUNISTRING_]m4_dquote(AS_TR_CPP([$1])), [true])

No different than the m4_dquote case - the result of AS_TR_CPP is
expanded prior to the m4_dquote call.

> Attempt #4: Use m4_quote and brackets. Change line 8 to
> 
>   AM_CONDITIONAL([LIBUNISTRING_]m4_quote([AS_TR_CPP([$1])]), [true])

This is like attempt #1 - you end up not invoking AS_TR_CPP at all.

-- 
Eric Blake   address@hidden    +1-801-349-2682
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]