3 use ExtUtils::MakeMaker;
7 my $verbose = $ENV{IM_VERBOSE};
11 GetOptions("incpath=s", \@incpaths,
12 "libpath=s" => \@libpaths,
13 "verbose|v" => \$verbose);
20 NAME => 'Imager::File::PNG',
21 VERSION_FROM => 'PNG.pm',
22 OBJECT => 'PNG.o impng.o',
23 clean => { FILES => 'testout' },
26 if (eval { ExtUtils::MakeMaker->VERSION('6.46'); 1 }) {
27 $opts{LICENSE} = "perl_5";
28 $opts{AUTHOR} = 'Tony Cook <tonyc@cpan.org>';
29 $opts{ABSTRACT} = 'PNG Image file support for Imager';
35 url => "https://metacpan.org/pod/CPAN::Meta::Spec",
39 homepage => "http://imager.perl.org/",
43 url => "git://git.imager.perl.org/imager.git",
44 web => "http://git.imager.perl.org/imager.git",
48 web => "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Imager",
49 mailto => 'bug-Imager@rt.cpan.org',
56 if ($BUILDING_IMAGER) {
58 unshift @INC, "../lib";
62 print "PNG: building independently\n";
63 require Imager::ExtUtils;
64 push @inc, Imager::ExtUtils->includes;
65 $opts{TYPEMAPS} = [ Imager::ExtUtils->typemap ];
67 # Imager required configure through use
68 my @Imager_req = ( Imager => "0.90" );
69 if (eval { ExtUtils::MakeMaker->VERSION('6.46'); 1 }) {
70 $opts{META_MERGE}{prereqs} =
84 "Test::More" => "0.47",
98 "Test::More" => "0.47",
110 require Imager::Probe;
112 # these are mostly needed when pkg-config isn't available
117 incsuffix => "libpng16",
122 incsuffix => "libpng15",
127 incsuffix => "libpng14",
132 incsuffix => "libpng12",
137 incsuffix => "libpng10",
145 altname => "Generic",
146 pkg => [ qw/libpng libpng16 libpng15 libpng14 libpng12 libpng10/ ],
147 inccheck => sub { -e File::Spec->catfile($_[0], "png.h") },
149 testcode => _png_test_code(),
150 testcodeheaders => [ "png.h", "stdio.h" ],
151 incpath => \@incpaths,
152 libpath => \@libpaths,
158 altname => "base (+libz)",
159 libbase => [ "png", "z" ],
161 ( # a static libpng may require libz too
164 altname => "$_->{altname} (+libz)",
165 libbase => [ $_->{libbase}, "z" ],
171 my $probe_res = Imager::Probe->probe(\%probe);
173 $IMAGER_LIBS{PNG} = 1;
175 push @inc, $probe_res->{INC};
176 $opts{LIBS} = $probe_res->{LIBS};
177 $opts{DEFINE} = $probe_res->{DEFINE};
180 WriteMakefile(%opts);
183 $IMAGER_LIBS{PNG} = 0;
185 if ($BUILDING_IMAGER) {
186 ExtUtils::MakeMaker::WriteEmptyMakefile(%opts);
190 die "OS unsupported: PNG libraries or headers not found\n";
197 fprintf(stderr, "PNG: library version %ld, header version %ld\n", (long)png_access_version_number(), (long)PNG_LIBPNG_VER);
199 if (png_access_version_number() != PNG_LIBPNG_VER) {
200 fprintf(stderr, "PNG: Your header version number doesn't match the library version number\n");