[Top][All Lists]

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

Re: Keep variable un-expanded in configure script

From: Eric Blake
Subject: Re: Keep variable un-expanded in configure script
Date: Fri, 11 Mar 2011 11:37:40 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7

On 03/11/2011 11:32 AM, Eric Blake wrote:
> On 03/11/2011 11:17 AM, Too, Justin A. wrote:
>> Hi,
>> I have a simple function in an m4 file that is a convenience to output 
>> information. The function takes two parameters
>> function foo () {
>>   If test $# != 2 ; then
>>     exit 1
>>   fi
>> }
>> However, Autoconf expands $#. How can I escape $#, so that it will remain 
>> as-is in the configure script? I just can't figure this one out :)
> Several options, but I'd need to see more context to make sure of which
> one is right for your scenario.
> Have you tried $][# (that is, using the proper m4 quoting to break the
> m4 macro definition into two concatenated strings) or $[]# (that is,
> inject an extra m4 quoted empty string)?  (Which one to use depends on
> what level of nesting the $# appears in your macro, and whether it is
> likely to go through another round of m4 expansion).
> And if all else fails - use quadrigraphs: @S|@#

For shell, you can also use ${#} instead of trying to get autoconf to
output literal $#.

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]