when probing for TIFF, set LD_RUN_PATH just as the Makefile does so
authorTony Cook <tony@develop=help.com>
Tue, 3 Aug 2010 13:38:41 +0000 (13:38 +0000)
committerTony Cook <tony@develop=help.com>
Tue, 3 Aug 2010 13:38:41 +0000 (13:38 +0000)
the probe can find the library for the test run.

Changes
Makefile.PL

diff --git a/Changes b/Changes
index 5d11352755bcd0520c4c37329ec18f3ff3c47e27..98fd5b105caf67e971a3b985232ea6cdcd3f0778 100644 (file)
--- a/Changes
+++ b/Changes
@@ -25,6 +25,10 @@ Bugs:
  - added hardinvertall filter which also inverts the alpha channel
    (sorry for the mess)
 
+ - when probing for TIFF, set LD_RUN_PATH just as the Makefile does so
+   the probe can find the library for the test run.
+   https://rt.cpan.org/Ticket/Display.html?id=57518
+
 Imager 0.75 - 20 Jun 2010
 ===========
 
index 0b71b80745f2e1e62689641b8b6f1838d5b2f8d2..cda92e4504507cfc42c913f1c82ae37a4fff0058 100644 (file)
@@ -6,6 +6,7 @@ use Config;
 use File::Spec;
 use Getopt::Long;
 use ExtUtils::Manifest qw(maniread);
+use ExtUtils::Liblist;
 use vars qw(%formats $VERBOSE $INCPATH $LIBPATH $NOLOG $DEBUG_MALLOC $MANUAL $CFLAGS $LFLAGS $DFLAGS);
 use lib 'inc';
 use Devel::CheckLib;
@@ -1026,6 +1027,17 @@ sub postcheck_tiff {
     $lib = "tiff";
   }
 
+  # setup LD_RUN_PATH to match link time
+  my $lopts = join " " , map("-L$_", @{$format->{libdir}}), " -ltiff";
+  my ($extra, $bs_load, $ld_load, $ld_run_path) =
+    ExtUtils::Liblist->ext($lopts, $VERBOSE);
+  local $ENV{LD_RUN_PATH};
+
+  if ($ld_run_path) {
+    print "Setting LD_RUN_PATH=$ld_run_path for TIFF probe\n" if $VERBOSE;
+    $ENV{LD_RUN_PATH} = $ld_run_path;
+  }
+
   my $good =
     eval {
       assert_lib
@@ -1052,7 +1064,7 @@ FUNCTION
     };
 
   unless ($good && -s $tiffver_name
-         && open(VERS, "< probe/tiffver.txt")) {
+         && open(VERS, "< $tiffver_name")) {
     unlink $tiffver_name unless $KEEP_FILES;
     print <<EOS;
     **tiff: cannot determine libtiff version number