Re: Use pipe and sed in configure.ac

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

 



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