From add65063a3b3f05e3969f02ecbe39c101e747f3c Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 27 Jun 2008 21:11:07 +0200 Subject: [PATCH] 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. --- lib/perl/Configure.pm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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; } -- 2.39.2