3 use ExtUtils::MakeMaker;
7 my $verbose = $ENV{IM_VERBOSE};
11 GetOptions("incpath=s", \@incpaths,
12 "libpath=s" => \@libpaths,
13 "verbose|v" => \$verbose);
19 my $fp_rep = unpack("H*", pack("f", 1.25));
20 if ($fp_rep eq "0000a03f" || $fp_rep eq "3fa00000") {
21 $define = "-DIEEEFP_TYPES";
26 NAME => 'Imager::File::TIFF',
27 VERSION_FROM => 'TIFF.pm',
28 OBJECT => 'TIFF.o imtiff.o',
30 clean => { FILES => 'testout' },
33 if (eval { ExtUtils::MakeMaker->VERSION('6.46'); 1 }) {
34 $opts{LICENSE} = "perl_5";
35 $opts{AUTHOR} = 'Tony Cook <tonyc@cpan.org>';
36 $opts{ABSTRACT} = 'TIFF image file support for Imager';
42 url => "https://metacpan.org/pod/CPAN::Meta::Spec",
46 homepage => "http://imager.perl.org/",
50 url => "git://git.imager.perl.org/imager.git",
51 web => "http://git.imager.perl.org/imager.git",
55 web => "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Imager",
56 mailto => 'bug-Imager@rt.cpan.org',
63 if ($BUILDING_IMAGER) {
65 unshift @INC, "../lib";
69 print "TIFF: building independently\n";
70 require Imager::ExtUtils;
71 push @inc, Imager::ExtUtils->includes;
72 $opts{TYPEMAPS} = [ Imager::ExtUtils->typemap ];
74 # Imager required configure through use
75 my @Imager_req = ( Imager => "0.94" );
76 if (eval { ExtUtils::MakeMaker->VERSION('6.46'); 1 }) {
77 $opts{META_MERGE}{prereqs} =
91 "Test::More" => "0.47",
105 "Test::More" => "0.47",
117 require Imager::Probe;
122 inccheck => sub { -e File::Spec->catfile($_[0], "tiffio.h") },
124 testcode => _tiff_test_code(),
125 testcodeheaders => [ "tiffio.h", "stdio.h", "string.h" ],
126 incpath => \@incpaths,
127 libpath => \@libpaths,
131 my $probe_res = Imager::Probe->probe(\%probe);
133 $IMAGER_LIBS{TIFF} = 1;
135 push @inc, $probe_res->{INC};
136 $opts{LIBS} = $probe_res->{LIBS};
137 $opts{DEFINE} .= " $probe_res->{DEFINE}";
140 WriteMakefile(%opts);
143 $IMAGER_LIBS{TIFF} = 0;
145 if ($BUILDING_IMAGER) {
146 ExtUtils::MakeMaker::WriteEmptyMakefile(%opts);
150 die "OS unsupported: TIFF libraries or headers not found\n";
154 sub _tiff_test_code {
156 static const char ver_base[] = ", Version ";
157 static const size_t ver_base_len = sizeof(ver_base) - 1;
158 const char *ver_str = TIFFGetVersion();
159 const char *ver_start = strstr(ver_str, ver_base);
163 if (ver_start && ver_start[ver_base_len] >= '3' && ver_start[ver_base_len] < '9') {
164 ver_start += ver_base_len;
166 while (*ver_end && (*ver_end == '.' || *ver_end >= '0' && *ver_end <= '9'))
168 ver_len = ver_end - ver_start;
171 ver_start = "(unknown)";
172 ver_len = strlen(ver_start);
175 fprintf(stderr, "TIFF: library version %.*s, header version %ld\n", ver_len, ver_start, TIFFLIB_VERSION);
176 if (TIFFLIB_VERSION == 20090820) {
177 fprintf(stderr, "TIFF: this appears to be libtiff 3.9.0 which introduced a serious bug\n");
178 fprintf(stderr, "TIFF: please install 3.9.1\n");