]> git.imager.perl.org - imager-screenshot.git/blobdiff - Makefile.PL
0.005 release
[imager-screenshot.git] / Makefile.PL
index 415a0827649d2cd7aa2420cd12b2ea0b699eda3b..f6d95eefc6750be8fb18578b782e48e9e7ddcc97 100644 (file)
@@ -1,6 +1,7 @@
 #!perl -w
 use strict;
 use ExtUtils::MakeMaker;
+use Imager 0.54;
 use Imager::ExtUtils;
 use Config;
 use File::Spec;
@@ -8,6 +9,8 @@ use File::Spec;
 my @objs = qw/Screenshot.o/;
 my @cflags;
 my @lflags;
+my %seen_incdir;
+my %seen_libdir;
 my $X11_lib = $^O eq 'cygwin' ? 'X11.dll' : 'X11';
 if (find_header("X11/Xlib.h") and find_lib($X11_lib)) {
   push @objs, 'scx11.o';
@@ -25,7 +28,7 @@ if (find_header('windows.h') and find_lib('gdi32')) {
 }
 
 unless (@objs > 1) {
-  die "Sorry, I can't find headers or libraries for a supported GUI\n"
+  die "NA: Sorry, I can't find headers or libraries for a supported GUI\n"
 }
 
 my %opts = 
@@ -43,12 +46,17 @@ my %opts =
 $opts{LIBS} = "@lflags" if @lflags;
 $opts{INC} .= " @cflags" if @cflags;
 
-if ($ExtUtils::MakeMaker::VERSION > 6.06) {
+# avoid "... isn't numberic in numeric gt ..." warnings for dev versions
+my $eu_mm_version = eval $ExtUtils::MakeMaker::VERSION;
+if ($eu_mm_version > 6.06) {
   $opts{AUTHOR} = 'Tony Cook <tonyc@cpan.org>';
   $opts{ABSTRACT} = 'Screen/Window capture to Imager images';
 }
 
-if ($ExtUtils::MakeMaker::VERSION > 6.06) {
+# LICENSE was introduced in 6.30_01, but Debian etch includes
+# (as of 2007/01/12) an ExtUtils::MakeMaker versioned 6.30_01 without
+# LICENSE support
+if ($eu_mm_version > 6.3001) {
   $opts{LICENSE} = 'perl';
 }
 
@@ -58,7 +66,7 @@ my @incs;
 sub header_search_path {
   @incs and return @incs;
 
-  push @incs, '/usr/include', '/usr/X11R6'
+  push @incs, '/usr/include', '/usr/X11R6/include'
     unless $^O eq 'MSWin32' && $Config{cc} =~ /\bcl\b/;
   push @incs, split /\Q$Config{path_sep}/, $ENV{INCLUDE}
     if $^O eq 'MSWin32' && $Config{cc} =~ /\bcl\b/ and $ENV{INCLUDE};
@@ -102,7 +110,14 @@ sub _find_file {
 }
 
 sub find_header {
-  _find_file($_[0], header_search_path());
+  my @found = _find_file($_[0], header_search_path());
+
+  if (@found) {
+      push @cflags, "-I$_" for grep !$seen_incdir{$_}, @found;
+      @seen_incdir{@found} = (1) x @found;
+  }
+
+  @found;
 }
 
 sub find_lib {
@@ -115,7 +130,8 @@ sub find_lib {
     @found = _find_file("lib" . $name . $Config{_a}, library_search_path());
   }
   if (@found) {
-    push @lflags, "-L$_" for @found;
+    push @lflags, "-L$_" for grep !$seen_libdir{$_}, @found;
+    @seen_libdir{@found} = (1) x @found;
   }
   @found;
 }