2 use ExtUtils::MakeMaker;
\r
3 use Imager::ExtUtils;
\r
7 my @objs = qw/Screenshot.o/;
\r
10 #if (find_header("X11.h") and find_lib("X11")) {
\r
11 # push @objs, 'scx11.o';
\r
12 # push @cflags, '-DSS_X11';
\r
13 # push @lflags, '-lX11';
\r
14 # print "Found X11\n";
\r
16 if (find_header('windows.h') and find_lib('gdi32')) {
\r
17 push @objs, 'scwin32.o';
\r
18 push @cflags, '-DSS_WIN32';
\r
19 push @lflags, '-lgdi32' if $^O eq 'cygwin';
\r
20 print "Found Win32\n";
\r
24 WriteEmptyMakefile();
\r
25 die "Sorry, I can't find headers or libraries for a supported GUI\n"
\r
30 NAME => 'Imager::Screenshot',
\r
31 VERSION_FROM => 'Screenshot.pm',
\r
36 INC => Imager::ExtUtils->includes,
\r
37 TYPEMAPS => [ Imager::ExtUtils->typemap ],
\r
40 $opts{LIBS} = "@lflags" if @lflags;
\r
41 $opts{INC} .= " @cflags" if @cflags;
\r
43 if ($ExtUtils::MakeMaker::VERSION > 6.06) {
\r
44 $opts{AUTHOR} = 'Tony Cook <tonyc@cpan.org>';
\r
45 $opts{ABSTRACT} = 'Screen/Window capture to Imager images';
\r
48 WriteMakefile(%opts);
\r
51 sub header_search_path {
\r
52 @incs and return @incs;
\r
54 push @incs, split /\Q$Config{path_sep}/, $ENV{INCLUDE}
\r
55 if $^O eq 'MSWin32' && $Config{cc} =~ /\bcl\b/ and $ENV{INCLUDE};
\r
56 push @incs, split ' ', $Config{locincpth}
\r
57 if $Config{locincpth};
\r
58 push @incs, split /\Q$Config{path_sep}/, $Config{incpath}
\r
59 if $Config{incpath};
\r
61 @incs = grep -d, @incs;
\r
67 sub library_search_path {
\r
68 @libs and return @libs;
\r
70 push @libs, split /\Q$Config{path_sep}/, $ENV{LIB}
\r
71 if $^O eq 'MSWin32' && $Config{cc} =~ /\bcl\b/ and $ENV{LIB};
\r
72 push @libs, split ' ', $Config{loclibpth}
\r
73 if $Config{loclibpth};
\r
74 push @libs, split /\Q$Config{path_sep}/, $Config{libpth}
\r
77 @libs = grep -d, @libs;
\r
84 my ($name, @where) = @_;
\r
86 grep -f File::Spec->catfile($_, $name), @where;
\r
90 _find_file($_[0], header_search_path());
\r
95 if ($^O eq 'MSWin32') {
\r
96 return _find_file($name . $Config{_a}, library_search_path());
\r
99 return _find_file("lib" . $name . $Config{_a}, library_search_path());
\r