]> git.imager.perl.org - imager.git/blobdiff - lib/Imager/Probe.pm
use $Config{path_sep} instead of working it out on our own
[imager.git] / lib / Imager / Probe.pm
index 11d9baec600dca27f42e0834c0de30ca016913cc..8e0c3274f53d9ab9ec663928dd80ecc076d2738d 100644 (file)
@@ -70,6 +70,13 @@ sub is_exe {
 sub _probe_pkg {
   my ($req) = @_;
 
+  # Setup pkg-config's environment variable to search non-standard paths
+  # which may be provided by --libdirs.
+  my @pkgcfg_paths = map { "$_/pkgconfig" } _lib_paths( $req );
+  push @pkgcfg_paths, $ENV{ 'PKG_CONFIG_PATH' } if $ENV{ 'PKG_CONFIG_PATH' };
+
+  local $ENV{ 'PKG_CONFIG_PATH' } = join $Config{path_sep}, @pkgcfg_paths;
+
   is_exe('pkg-config') or return;
   my $redir = $^O eq 'MSWin32' ? '' : '2>/dev/null';
 
@@ -202,11 +209,11 @@ sub _probe_test {
   require Devel::CheckLib;
   # setup LD_RUN_PATH to match link time
   my ($extra, $bs_load, $ld_load, $ld_run_path) =
-    ExtUtils::Liblist->ext($req->{LIBS}, $req->{verbose});
+    ExtUtils::Liblist->ext($result->{LIBS}, $req->{verbose});
   local $ENV{LD_RUN_PATH};
 
   if ($ld_run_path) {
-    print "Setting LD_RUN_PATH=$ld_run_path for TIFF probe\n"
+    print "Setting LD_RUN_PATH=$ld_run_path for $req->{name} probe\n"
       if $req->{verbose};
     $ENV{LD_RUN_PATH} = $ld_run_path;
   }
@@ -214,14 +221,13 @@ sub _probe_test {
     Devel::CheckLib::check_lib
        (
         debug => $req->{verbose},
-        LIBS => $result->{LIBS},
+        LIBS => [ $result->{LIBS} ],
         INC => $result->{INC},
         header => $req->{testcodeheaders},
         function => $req->{testcode},
        );
   unless ($good) {
-    print "$req->{name}: Test code failed checklib probe: $@\n"
-      if $req->{verbose};
+    print "$req->{name}: Test code failed: $@";
     return;
   }