From: Martin Mares Date: Fri, 27 Jun 2008 19:11:07 +0000 (+0200) Subject: Configure: Better extraction of settings in PkgConfig() and TrivConfig() X-Git-Tag: holmes-import~411 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=add65063a3b3f05e3969f02ecbe39c101e747f3c;p=libucw.git Configure: Better extraction of settings in PkgConfig() and TrivConfig() TrivConfig() now allows to specify a list of options to ask for. The naming of the configuration variables has been changed from CFLAGS_PKG to PKG_CFLAGS to bring everything related to the PKG together. --- diff --git a/lib/perl/Configure.pm b/lib/perl/Configure.pm index cf082cca..a6c30179 100644 --- a/lib/perl/Configure.pm +++ b/lib/perl/Configure.pm @@ -238,9 +238,9 @@ sub PkgConfig($@) { Set("CONFIG_HAVE_$upper" => 1); Set("CONFIG_VER_$upper" => $ver); my $cf = TryCmd("pkg-config --cflags $pkg"); - Set("CFLAGS_$upper" => $cf) if defined $cf; + Set("${upper}_CFLAGS" => $cf) if defined $cf; my $lf = TryCmd("pkg-config --libs $pkg"); - Set("LIBS_$upper" => $lf) if defined $lf; + Set("${upper}_LIBS" => $lf) if defined $lf; return 1; } @@ -271,10 +271,14 @@ sub TrivConfig($@) { Log("YES: version $ver\n"); Set("CONFIG_HAVE_$upper" => 1); Set("CONFIG_VER_$upper" => $ver); - my $cf = TryCmd("$pc --cflags"); - Set("CFLAGS_$upper" => $cf) if defined $cf; - my $lf = TryCmd("$pc --libs"); - Set("LIBS_$upper" => $lf) if defined $lf; + + my $want = $opts{want}; + defined $want or $want = ["cflags", "libs"]; + for my $w (@$want) { + my $uw = $w; $uw =~ tr/a-z/A-Z/; + my $cf = TryCmd("$pc --$w"); + Set("${upper}_${uw}" => $cf) if defined $cf; + } return 1; }