autoconf
[Top][All Lists]
Advanced

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

Re: Use pipe and sed in configure.ac


From: Eric Blake
Subject: Re: Use pipe and sed in configure.ac
Date: Thu, 10 Feb 2011 12:20:51 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7

On 02/10/2011 12:05 PM, Ralf Wildenhues wrote:
> Hello Lyre,
> 
> * Lyre wrote on Thu, Feb 10, 2011 at 04:39:41AM CET:
>> php-config --configure-options | sed -n
>> 's|.*--with-config-file-scan-dir=\([^ ]*\).*|\1|p'
>>
>> It works on shell, and outputs "/etc/php5/conf.d/" on opensuse.
>>
>> And I tired it in configure.ac, as following:
>>
>> PHPCDIR=`php-config --configure-options | sed -n
>> 's|.*--with-config-file-scan-dir=\([^ ]*\).*|\1|p'`
> 
>> After subsitution in Makefile, the PHPCDIR is empty´╝î meanwhile PHPINC get
>> the correct result.
> 
> Probably, m4 eat your [ ] as they are also m4 quotes.  To safely protect
> them from m4, replace them with @<:@ and @:>@, respectively.  See "info
> Autoconf Quadrigraphs".

Oh, thanks for spotting it!  Yes, that's exactly what happened, and what
I missed as I was reading it.

Another option is to add an extra layer of quoting around raw shell code
that should not be subject to m4 processing:

[
PHPCDIR=`...[^ ]...`
]

instead of resorting to quadrigraphs.  It has the added benefit that you
retain copy-and-paste capabilities between configure.ac and your shell.

-- 
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]