#!perl -w
use strict;
use ExtUtils::MakeMaker;
+use Imager 0.54;
use Imager::ExtUtils;
use Config;
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';
}
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 =
$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';
}
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};
}
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 {
@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;
}