]> mj.ucw.cz Git - libucw.git/commitdiff
Configure: Better extraction of settings in PkgConfig() and TrivConfig()
authorMartin Mares <mj@ucw.cz>
Fri, 27 Jun 2008 19:11:07 +0000 (21:11 +0200)
committerMartin Mares <mj@ucw.cz>
Tue, 1 Jul 2008 09:41:01 +0000 (11:41 +0200)
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

index cf082cca1c238ffdba180ed1590f9a78a64fdd12..a6c301797b9fa9ecbfaa7735be640ac2db2f5fd3 100644 (file)
@@ -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;
 }