From: Tony Cook Date: Fri, 12 Jan 2007 10:40:51 +0000 (+0000) Subject: - Makefile.PL was checking /usr/X11R6 for headers instead of X-Git-Tag: v0.008~25 X-Git-Url: http://git.imager.perl.org/imager-screenshot.git/commitdiff_plain/8a7d68906f61f4a5045378bb415db8301a08742d - Makefile.PL was checking /usr/X11R6 for headers instead of /usr/X11R6/include - add header directories as -I flags if we find a header in them - avoid duplicate -L flags --- diff --git a/Changes b/Changes index 8d729b4..cef8d55 100755 --- a/Changes +++ b/Changes @@ -1,3 +1,10 @@ +0.003 + - Makefile.PL was checking /usr/X11R6 for headers instead of + /usr/X11R6/include + - add header directories as -I flags if we find a header in + them + - avoid duplicate -L flags + 0.002 2 Jan 2007 Just packaging changes: - README was missing diff --git a/Makefile.PL b/Makefile.PL index 415a082..099b519 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -8,6 +8,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'; @@ -48,7 +50,7 @@ if ($ExtUtils::MakeMaker::VERSION > 6.06) { $opts{ABSTRACT} = 'Screen/Window capture to Imager images'; } -if ($ExtUtils::MakeMaker::VERSION > 6.06) { +if ($ExtUtils::MakeMaker::VERSION > 6.30) { $opts{LICENSE} = 'perl'; } @@ -58,7 +60,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 +104,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 +124,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; }