+#!perl -w\r
use strict;\r
use ExtUtils::MakeMaker;\r
use Imager::ExtUtils;\r
my @objs = qw/Screenshot.o/;\r
my @cflags;\r
my @lflags;\r
-if (find_header("X11/X.h") and find_lib("X11")) {\r
+my $X11_lib = $^O eq 'cygwin' ? 'X11.dll' : 'X11';\r
+if (find_header("X11/Xlib.h") and find_lib($X11_lib)) {\r
push @objs, 'scx11.o';\r
push @cflags, '-DSS_X11';\r
- push @lflags, '-lX11';\r
+ push @lflags, '-l'.$X11_lib;\r
print "Found X11\n";\r
}\r
if (find_header('windows.h') and find_lib('gdi32')) {\r
push @objs, 'scwin32.o';\r
push @cflags, '-DSS_WIN32';\r
- push @lflags, '-lgdi32' if $^O eq 'cygwin';\r
+ if ($^O eq 'cygwin') {\r
+ push @lflags, '-L/usr/lib/w32api', '-lgdi32';\r
+ }\r
print "Found Win32\n";\r
}\r
\r
@incs and return @incs;\r
\r
push @incs, '/usr/include'\r
- unless $^O eq 'MSWin32';\r
+ unless $^O eq 'MSWin32' && $Config{cc} =~ /\bcl\b/;\r
push @incs, split /\Q$Config{path_sep}/, $ENV{INCLUDE}\r
if $^O eq 'MSWin32' && $Config{cc} =~ /\bcl\b/ and $ENV{INCLUDE};\r
push @incs, split ' ', $Config{locincpth}\r
if $Config{locincpth};\r
push @incs, split /\Q$Config{path_sep}/, $Config{incpath}\r
if $Config{incpath};\r
+ push @incs, '/usr/include/w32api', '/usr/X11R6/include'\r
+ if $^O eq 'cygwin';\r
\r
@incs = grep -d, @incs;\r
\r
@libs and return @libs;\r
\r
push @libs, '/usr/lib'\r
- unless $^O eq 'MSWin32';\r
+ unless $^O eq 'MSWin32' && $Config{cc} =~ /\bcl\b/;\r
push @libs, split /\Q$Config{path_sep}/, $ENV{LIB}\r
if $^O eq 'MSWin32' && $Config{cc} =~ /\bcl\b/ and $ENV{LIB};\r
push @libs, split ' ', $Config{loclibpth}\r
if $Config{loclibpth};\r
push @libs, split /\Q$Config{path_sep}/, $Config{libpth}\r
if $Config{libpth};\r
+ push @libs, '/usr/lib/w32api', '/usr/X11R6/lib'\r
+ if $^O eq 'cygwin';\r
\r
@libs = grep -d, @libs;\r
\r
\r
sub find_lib {\r
my $name = shift;\r
+ my @found;\r
if ($^O eq 'MSWin32') {\r
- return _find_file($name . $Config{_a}, library_search_path());\r
+ @found = _find_file($name . $Config{_a}, library_search_path());\r
}\r
else {\r
- return _find_file("lib" . $name . $Config{_a}, library_search_path());\r
+ @found = _find_file("lib" . $name . $Config{_a}, library_search_path());\r
+ }\r
+ if (@found) {\r
+ push @lflags, "-L$_" for @found;\r
}\r
+ @found;\r
}\r