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.90" );
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",
69 require Imager::Probe;
71 # these are mostly needed when pkg-config isn't available
76 incsuffix => "libpng16",
81 incsuffix => "libpng15",
86 incsuffix => "libpng14",
91 incsuffix => "libpng12",
96 incsuffix => "libpng10",
104 altname => "Generic",
105 pkg => [ qw/libpng libpng16 libpng15 libpng14 libpng12 libpng10/ ],
106 inccheck => sub { -e File::Spec->catfile($_[0], "png.h") },
108 testcode => _png_test_code(),
109 testcodeheaders => [ "png.h", "stdio.h" ],
110 incpath => \@incpaths,
111 libpath => \@libpaths,
117 altname => "base (+libz)",
118 libbase => [ "png", "z" ],
120 ( # a static libpng may require libz too
123 altname => "$_->{altname} (+libz)",
124 libbase => [ $_->{libbase}, "z" ],
130 my $probe_res = Imager::Probe->probe(\%probe);
132 $IMAGER_LIBS{PNG} = 1;
134 push @inc, $probe_res->{INC};
135 $opts{LIBS} = $probe_res->{LIBS};
136 $opts{DEFINE} = $probe_res->{DEFINE};
139 if ($MM_ver > 6.06) {
140 $opts{AUTHOR} = 'Tony Cook <tonyc@cpan.org>';
141 $opts{ABSTRACT} = 'PNG Image file support';
144 WriteMakefile(%opts);
147 $IMAGER_LIBS{PNG} = 0;
149 if ($BUILDING_IMAGER) {
150 ExtUtils::MakeMaker::WriteEmptyMakefile(%opts);
154 die "OS unsupported: PNG libraries or headers not found\n";
161 fprintf(stderr, "PNG: library version %ld, header version %ld\n", (long)png_access_version_number(), (long)PNG_LIBPNG_VER);
163 if (png_access_version_number() != PNG_LIBPNG_VER) {
164 fprintf(stderr, "PNG: Your header version number doesn't match the library version number\n");