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::GIF',
23 VERSION_FROM => 'GIF.pm',
24 OBJECT => 'GIF.o imgif.o',
25 clean => { FILES => 'testout' },
29 if ($BUILDING_IMAGER) {
31 unshift @INC, "../lib";
35 print "GIF: 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.86" );
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;
74 inccheck => sub { -e File::Spec->catfile($_[0], "gif_lib.h") },
76 testcode => _gif_test_code(),
77 testcodeheaders => [ "gif_lib.h", "stdio.h" ],
78 incpath => \@incpaths,
79 libpath => \@libpaths,
82 my $probe_res = Imager::Probe->probe(\%probe);
84 $IMAGER_LIBS{GIF} = 1;
86 push @inc, $probe_res->{INC};
87 $opts{LIBS} = $probe_res->{LIBS};
88 $opts{DEFINE} = $probe_res->{DEFINE};
92 $opts{AUTHOR} = 'Tony Cook <tonyc@cpan.org>';
93 $opts{ABSTRACT} = 'GIF Image file support';
99 $IMAGER_LIBS{GIF} = 0;
101 if ($BUILDING_IMAGER) {
102 ExtUtils::MakeMaker::WriteEmptyMakefile(%opts);
106 die "OS unsupported: GIF libraries or headers not found\n";
112 /* TODO: test DGifOpen() and processing with callbacks */
114 #ifdef GIF_LIB_VERSION
115 const char vers[] = GIF_LIB_VERSION;
116 const char *versp = vers;
120 int ver_maj = GIFLIB_MAJOR;
121 int ver_min = GIFLIB_MINOR;
123 gf=DGifOpenFileName("testimg/expected.gif");
125 fprintf(stderr, "GIF: Cannot open testimg/expected.gif\n");
128 if (gf->SWidth != 16 || gf->SHeight != 16) {
129 fprintf(stderr, "GIF: bad screen description (%d x %d)\n", gf->SWidth, gf->SHeight);
132 /* crashes in older versions of giflib */
133 EGifSetGifVersion("89a");
134 EGifSetGifVersion("87a");
136 #ifdef GIF_LIB_VERSION
137 /* skip the " Version " */
138 while (*versp && (*versp < '0' || *versp > '9'))
141 fprintf(stderr, "GIF: Cannot find version number in '%s'\n", vers);
145 while (*versp && *versp >= '0' && *versp <= '9') {
147 ver_maj += *versp++ - '0';
149 if (*versp != '.' || versp[1] < '0' || versp[1] > '9') {
150 fprintf(stderr, "Cannot parse major version number in '%s'\n", vers);
153 ++versp; /* skip '.' */
155 while (*versp && *versp >= '0' && *versp <= '9') {
157 ver_min += *versp++ - '0';
161 fprintf(stderr, "GIF: gif lib version 3 is no longer supported\n");
164 if (ver_maj == 4 && ver_min < 1) {
165 fprintf(stderr, "GIF: you need at least giflib 4.1\n");
168 fprintf(stderr, "GIF: Major %d, Minor %d\n", ver_maj, ver_min);