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 08:08:23 -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/09/2011 08:39 PM, Lyre wrote:
> I tried to exact an option from php-config using:
> 
> 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:
> 
> PHPINC=`php-config --includes`
> PHPCDIR=`php-config --configure-options | sed -n
> 's|.*--with-config-file-scan-dir=\([^ ]*\).*|\1|p'`

Is that newline in the middle of your `` an artifact of your mailer, or
literally in your configure.ac?  If it is in your configure.ac, that
would explain the problem, since then there is no argument to sed.

But assuming that you had one long line, then I don't see why this would
have failed for you.

Inside ``, I like using \\ to make it clear where I intend for a literal
backslash to be part of the subshell, rather than relying on the fact
that \( is not an escape sequence and therefore the \ is not consumed.
But whether you use `'\\(\\)\\1'` or `'\(\)\1'`, the result is portably
the same (it only matters for \, $, and `).

The next thing I would suggest is surrounding that code inside a 'set
-vx'/'set +vx' block, and inspecting the output to make sure that the
correct command was executed.

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