3 use ExtUtils::MakeMaker;
7 my $verbose = $ENV{IM_VERBOSE};
11 GetOptions("incpath=s", \@incpaths,
12 "libpath=s" => \@libpaths,
13 "verbose|v" => \$verbose);
18 my $MM_ver = eval $ExtUtils::MakeMaker::VERSION;
22 NAME => 'Imager::File::PNG',
23 VERSION_FROM => 'PNG.pm',
24 OBJECT => 'PNG.o impng.o',
25 clean => { FILES => 'testout' },
29 if ($BUILDING_IMAGER) {
31 unshift @INC, "../lib";
35 print "PNG: building independently\n";
36 require Imager::ExtUtils;
37 push @inc, Imager::ExtUtils->includes;
38 $opts{TYPEMAPS} = [ Imager::ExtUtils->typemap ];
40 # Imager required configure through use
41 my @Imager_req = ( Imager => "0.78" );
42 if ($MM_ver >= 6.46) {
52 "Test::More" => "0.47",
56 homepage => "http://imager.perl.org/",
57 repository => "git://git.imager.perl.org/imager.git",
58 bugtracker => "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Imager",
68 require Imager::Probe;
74 pkg => [ qw/libpng14 libpng12 libpng10 libpng/ ],
75 inccheck => sub { -e File::Spec->catfile($_[0], "png.h") },
77 testcode => _png_test_code(),
78 testcodeheaders => [ "png.h", "stdio.h" ],
79 incpath => \@incpaths,
80 libpath => \@libpaths,
85 incsuffix => "libpng14",
90 incsuffix => "libpng12",
95 incsuffix => "libpng10",
101 my $probe_res = Imager::Probe->probe(\%probe);
103 $IMAGER_LIBS{PNG} = 1;
105 push @inc, $probe_res->{INC};
106 $opts{LIBS} = $probe_res->{LIBS};
107 $opts{DEFINE} = $probe_res->{DEFINE};
110 if ($MM_ver > 6.06) {
111 $opts{AUTHOR} = 'Tony Cook <tonyc@cpan.org>';
112 $opts{ABSTRACT} = 'PNG Image file support';
115 WriteMakefile(%opts);
118 $IMAGER_LIBS{PNG} = 0;
120 if ($BUILDING_IMAGER) {
121 ExtUtils::MakeMaker::WriteEmptyMakefile(%opts);
125 die "OS unsupported: PNG libraries or headers not found\n";
132 fprintf(stderr, "PNG: library version %ld, header version %ld\n", (long)png_access_version_number(), (long)PNG_LIBPNG_VER);