Re: Keep variable un-expanded in configure script

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

 



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   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://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