Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 546 lines (449 sloc) 14.658 kB
ea9e6c3 - the Win32 font driver now uses DEFAULT_CHARSET rather than
Tony Cook authored
1 #!perl -w
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
2 use ExtUtils::MakeMaker;
3 use Cwd;
4 use Config;
07ea6c2 - Makefile.PL now attempts to use freetype-config to configure freety…
Tony Cook authored
5 use File::Spec;
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
6
7 #
8 # IM_INCPATH colon seperated list of paths to extra include paths
9 # IM_LIBPATH colon seperated list of paths to extra library paths
10 #
11 # IM_VERBOSE turns on verbose mode for the library finding and such
12 # IM_MANUAL to manually select which libraries are used and which not
13 # IM_ENABLE to programmatically select which libraries are used
14 # and which are not
15 # IM_NOLOG if true logging will not be compiled into the module
16 # IM_DEBUG_MALLOC if true malloc debbuging will be compiled into the module
17 # do not use IM_DEBUG_MALLOC in production - this slows
18 # everything down by alot
19 # IM_CFLAGS Extra flags to pass to the compiler
20 # IM_LFLAGS Extra flags to pass to the linker
21 # IM_DFLAGS Extra flags to pass to the preprocessor
f4dbac5 make it possible to run automated tests by adding the IM_SUPPRESS_PRO…
Tony Cook authored
22 # IM_SUPPRESS_PROMPT Suppress the prompt asking about gif support
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
23
24
25 getenv(); # get environment variables
26 init(); # initialize global data
27 pathcheck(); # Check if directories exist
28
29 # Pick what libraries are used
30 if ($MANUAL) {
31 manual();
32 } else {
33 automatic();
34 if (exists $ENV{IM_ENABLE}) {
35 my %en = map { $_, 1 } split ' ', $ENV{IM_ENABLE};
36 for my $key (keys %formats) {
37 delete $formats{$key} unless $en{$key};
38 }
39 }
40 }
41
42 # Make sure there isn't a clash between the gif libraries.
43 gifcheck();
44
07ea6c2 - Makefile.PL now attempts to use freetype-config to configure freety…
Tony Cook authored
45 my $lib_cflags = '';
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
46 for $frm(values %formats) {
47 $F_DEFINE .= ' -D'.$frm->{def};
48 $F_LIBS .= ' ' .$frm->{libfiles};
49 $F_OBJECT .= ' ' .$frm->{objfiles};
07ea6c2 - Makefile.PL now attempts to use freetype-config to configure freety…
Tony Cook authored
50 $lib_cflags .= ' ' .$frm->{cflags} if $frm->{cflags};
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
51 }
52
ea9e6c3 - the Win32 font driver now uses DEFAULT_CHARSET rather than
Tony Cook authored
53 $F_INC = join ' ', map "-I$_", map / / ? qq{"$_"} : $_,
54 grep !exists $definc{$_}, @incs;
55 $F_LIBS = join(' ',map "-L$_", map / / ? qq{"$_"} : $_, @libs) . $F_LIBS;
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
56
57 $OSLIBS = '';
58 $OSDEF = "-DOS_$^O";
59
60 if ($^O eq 'hpux') { $OSLIBS .= ' -ldld'; }
61 if (defined $Config{'d_dlsymun'}) { $OSDEF .= ' -DDLSYMUN'; }
62
9982a30 Finished antialiased polygon drawing routines.
Arnar Mar Hrafnkelsson authored
63 @objs = qw(Imager.o draw.o polygon.o image.o io.o iolayer.o
64 log.o gaussian.o conv.o pnm.o raw.o feat.o font.o
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
65 filters.o dynaload.o stackmach.o datatypes.o
2df3535 Added map.c which implements mapping images through tables.
Arnar Mar Hrafnkelsson authored
66 regmach.o trans2.o quant.o error.o convert.o
261f91c start of bmp support (just writing so far)
Tony Cook authored
67 map.o tags.o palimg.o maskimg.o img16.o rotate.o
737a830 Added read support for sgi .rgb files.
Arnar Mar Hrafnkelsson authored
68 bmp.o tga.o rgb.o color.o fills.o imgdouble.o);
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
69
70 %opts=(
71 'NAME' => 'Imager',
72 'VERSION_FROM' => 'Imager.pm',
73 'LIBS' => "$LFLAGS -lm $OSLIBS $F_LIBS",
74 'DEFINE' => "$F_DEFINE $EXTDEF $OSDEF $CFLAGS",
07ea6c2 - Makefile.PL now attempts to use freetype-config to configure freety…
Tony Cook authored
75 'INC' => "$lib_cflags $DFLAGS $F_INC",
de2b8ba remove testout on make clean
Tony Cook authored
76 'OBJECT' => join(' ', @objs, $F_OBJECT),
77 clean => { FILES=>'testout' },
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
78 );
79
29316bd - make the inclusion of NO_META dependent on the version of EU::MM.
Tony Cook authored
80 if ($ExtUtils::MakeMaker::VERSION > 6.06) {
81 $opts{AUTHOR} = 'Tony Cook <tony@imager.perl.org>, Arnar M. Hrafnkelsson';
ca50810 add the extra attributes that PPDs want
Tony Cook authored
82 $opts{ABSTRACT} = 'Perl extension for Generating 24 bit Images';
83 }
29316bd - make the inclusion of NO_META dependent on the version of EU::MM.
Tony Cook authored
84 if ($ExtUtils::MakeMaker::VERSION > 6.10) {
85 $opts{NO_META} = 1;
86 }
ca50810 add the extra attributes that PPDs want
Tony Cook authored
87
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
88 if ($VERBOSE) { print Dumper(\%opts); }
89 mkdir('testout',0777); # since we cannot include it in the archive.
90 WriteMakefile(%opts);
4dce694 Made Makefile.PL run $Config{make} lib/Imager/Regops.pm so it exists
Arnar Mar Hrafnkelsson authored
91
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
92 exit;
93
94
95 sub MY::postamble {
96 '
faa9b3e Egads
Tony Cook authored
97 dyntest.$(MYEXTLIB) : dynfilt/Makefile
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
98 cd dynfilt && $(MAKE) $(PASTHRU)
99
100 lib/Imager/Regops.pm : regmach.h regops.perl
101 $(PERL) regops.perl regmach.h lib/Imager/Regops.pm
102 ';
103 }
104
105 # manual configuration of helper libraries
106
107 sub manual {
108 print <<EOF;
109
110 Please answer the following questions about
111 which formats are avaliable on your computer
112
113 press <return> to continue
114 EOF
115
116 <STDIN>; # eat one return
117
2646b26 - Makefile.PL now checks the directories specified by $Config{locincpth}
Tony Cook authored
118 for my $frm(sort { $formats{$b}{order} <=> $formats{$a}{order} } keys %formats) {
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
119 SWX:
120 if ($formats{$frm}{docs}) { print "\n",$formats{$frm}{docs},"\n\n"; }
121 print "Enable $frm support: ";
09fd346 Fixed so that IM_MANUAL doesn't lose the giflib version check.
Arnar Mar Hrafnkelsson authored
122 $gz = <STDIN>;
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
123 chomp($gz);
124 if ($gz =~ m/^(y|yes|n|no)/i) {
125 $gz=substr(lc($gz),0,1);
126 if ($gz eq 'n') {
127 delete $formats{$frm};
128 }
129 } else { goto SWX; }
130 }
131 }
132
133
134 # automatic configuration of helper libraries
135
136 sub automatic {
137 for $frm(keys %formats) {
138 delete $formats{$frm} if !checkformat($frm);
139 }
140 }
141
142
143 sub gifcheck {
5f5fe73 Added mng to the TOOD, and added a warning to the Makefile.PL if gif/…
Arnar Mar Hrafnkelsson authored
144 if ($formats{'gif'} and $formats{'ungif'}) {
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
145 print "ungif and gif can not coexist - removing ungif support\n";
146 delete $formats{'ungif'};
147 }
5f5fe73 Added mng to the TOOD, and added a warning to the Makefile.PL if gif/…
Arnar Mar Hrafnkelsson authored
148
149 RETR:
f4dbac5 make it possible to run automated tests by adding the IM_SUPPRESS_PRO…
Tony Cook authored
150 if (($formats{'gif'} or $formats{'ungif'}) && !$ENV{IM_SUPPRESS_PROMPT}) {
5f5fe73 Added mng to the TOOD, and added a warning to the Makefile.PL if gif/…
Arnar Mar Hrafnkelsson authored
151 print <<EOFF;
152
153 You have libgif or libungif installed. They are both known to have
154 bugs. Imager can crash or display other strange behaviour after
155 reading or writing gif images. Some of the gif tests can even fail
156 since they stress some parts of the buggy code.
157
f1967c1 update information about giflib bugs
Tony Cook authored
158 libungif 4.1.2 and later is safe. giflib 4.1.3 needs at least one
159 patch to have all the bugs fixed, see README for details.
160
161 Of course it's possible your operating system distributor has patched
162 all of these problems and you have nothing to worry about.
0b836ff - more information on gif library versions in README and Makefile.PL
Tony Cook authored
163
5f5fe73 Added mng to the TOOD, and added a warning to the Makefile.PL if gif/…
Arnar Mar Hrafnkelsson authored
164 Do you want to remove gif support? [Y/n]
165 EOFF
166 my $resp = <STDIN>;
167 chomp($resp);
168 if ($resp ne "n") {
169 delete $formats{'gif'};
170 delete $formats{'ungif'};
09fd346 Fixed so that IM_MANUAL doesn't lose the giflib version check.
Arnar Mar Hrafnkelsson authored
171 return;
5f5fe73 Added mng to the TOOD, and added a warning to the Makefile.PL if gif/…
Arnar Mar Hrafnkelsson authored
172 }
173 }
09fd346 Fixed so that IM_MANUAL doesn't lose the giflib version check.
Arnar Mar Hrafnkelsson authored
174
175 for my $frm (qw(gif ungif)) {
176 checkformat($frm) if ($MANUAL and $formats{$frm});
177 }
178
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
179 my @dirs;
180 for my $frm (grep $formats{$_}, qw(gif ungif)) {
181 push(@dirs, @{$formats{$frm}{incdir}}) if $formats{$frm}{incdir};
182 }
183 my $minor = 0;
184 my $major = 0;
185 FILES: for my $dir (@dirs) {
186 my $h = "$dir/gif_lib.h";
187 open H, "< $h" or next;
188 while (<H>) {
189 if (/GIF_LIB_VERSION\s+"\s*version\s*(\d+)\.(\d+)/i) {
190 $major = $1;
191 $minor = $2;
192 close H;
193 last FILES;
194 }
195 }
196 close H;
197 }
198
199 # we need the version in a #ifdefable form
4dce694 Made Makefile.PL run $Config{make} lib/Imager/Regops.pm so it exists
Arnar Mar Hrafnkelsson authored
200
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
201 $F_DEFINE .= "-DIM_GIFMAJOR=$major -DIM_GIFMINOR=$minor";
202 }
203
204
205 sub gd {
206 my($path,$chk)=@_;
207
208 # print "checking path $path\n";
209 if ( !opendir(DH,$path) ) {
210 warn "Cannot open dir $path: $!\n";
211 return;
212 }
213 my @l=grep { $chk->($_) } readdir(DH);
214 # print @l;
215 close(DH);
216 return map $path, @l;
217 }
218
219
220 sub checkformat {
221 my $frm=shift;
2646b26 - Makefile.PL now checks the directories specified by $Config{locincpth}
Tony Cook authored
222
07ea6c2 - Makefile.PL now attempts to use freetype-config to configure freety…
Tony Cook authored
223 my $code = $formats{$frm}{'code'};
224 if ($code) {
225 return 1 if $code->($formats{$frm}, $frm);
226 }
227
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
228 my $libchk=$formats{$frm}{'libcheck'};
229 my $incchk=$formats{$frm}{'inccheck'};
230
231 my @l;
232 for my $lp (@libs) {
233 push(@l, gd($lp,$libchk));
234 }
235
236 my @i;
237 for my $ip (@incs) {
238 push(@i, gd($ip,$incchk));
239 }
240
241 printf("%10s: includes %s - libraries %s\n",$frm,(@i?'found':'not found'),(@l?'found':'not found'));
242 $formats{$frm}{incdir} = \@i;
243 $formats{$frm}{libdir} = \@l;
244 return scalar(@i && @l);
245 }
246
247
248
249
250 sub pathcheck {
251 if ($VERBOSE) {
252 print "pathcheck\n";
253 print " Include paths:\n";
254 for (@incs) { print $_,"\n"; }
255 }
3a6bb91 All the little fixup changes for the 0.42 release.
Arnar Mar Hrafnkelsson authored
256 @incs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @incs;
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
257
258 if ($VERBOSE) {
259 print "\nLibrary paths:\n";
260 for (@incs) { print $_,"\n"; }
261 }
3a6bb91 All the little fixup changes for the 0.42 release.
Arnar Mar Hrafnkelsson authored
262 @libs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @libs;
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
263 print "\ndone.\n";
264 }
265
266
267 # Format data initialization
268
269 # format definition is:
270 # defines needed
271 # default include path
272 # files needed for include (boolean perl code)
273 # default lib path
274 # libs needed
275 # files needed for link (boolean perl code)
276 # object files needed for the format
277
278
279 sub init {
280
281 @definc{'/usr/include'}=();
2646b26 - Makefile.PL now checks the directories specified by $Config{locincpth}
Tony Cook authored
282 @incs=(split(/\Q$Config{path_sep}/, $INCPATH));
283 if ($Config{locincpth}) {
6552acf - avoid complaining about include/lib directories we pull from
Tony Cook authored
284 push @incs, grep -d, split ' ', $Config{locincpth};
2646b26 - Makefile.PL now checks the directories specified by $Config{locincpth}
Tony Cook authored
285 }
88a763e libpng support for Win32
Tony Cook authored
286 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
287 push(@incs, split /;/, $ENV{INCLUDE}) if exists $ENV{INCLUDE};
2646b26 - Makefile.PL now checks the directories specified by $Config{locincpth}
Tony Cook authored
288 }
6552acf - avoid complaining about include/lib directories we pull from
Tony Cook authored
289 push @incs, grep -d,
2646b26 - Makefile.PL now checks the directories specified by $Config{locincpth}
Tony Cook authored
290 qw(/sw/include
291 /usr/include/freetype2
292 /usr/local/include/freetype2
293 /usr/local/include/freetype1/freetype
294 /usr/include /usr/local/include /usr/include/freetype
295 /usr/local/include/freetype);
296
297 @libs= split(/\Q$Config{path_sep}/,$LIBPATH);
298 if ($Config{loclibpth}) {
6552acf - avoid complaining about include/lib directories we pull from
Tony Cook authored
299 push @libs, grep -d, split ' ', $Config{loclibpth};
2646b26 - Makefile.PL now checks the directories specified by $Config{locincpth}
Tony Cook authored
300 }
6552acf - avoid complaining about include/lib directories we pull from
Tony Cook authored
301 push @libs, grep -d, qw(/sw/lib), split(/ /, $Config{'libpth'});
2646b26 - Makefile.PL now checks the directories specified by $Config{locincpth}
Tony Cook authored
302 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
88a763e libpng support for Win32
Tony Cook authored
303 push(@libs, split /;/, $ENV{LIB}) if exists $ENV{LIB};
304 }
faa9b3e Egads
Tony Cook authored
305 if ($^O eq 'cygwin') {
306 push(@libs, '/usr/lib/w32api') if -d '/usr/lib/w32api';
307 push(@incs, '/usr/include/w32api') if -d '/usr/lib/w32api';
308 }
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
309
2646b26 - Makefile.PL now checks the directories specified by $Config{locincpth}
Tony Cook authored
310 my $lext=$Config{'so'}; # Get extensions of libraries
311 my $aext=$Config{'_a'};
312
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
313 $formats{'jpeg'}={
314 order=>'21',
315 def=>'HAVE_LIBJPEG',
316 inccheck=>sub { $_[0] eq 'jpeglib.h' },
50ee6f9 Win32 jpeg support
Tony Cook authored
317 libcheck=>sub { $_[0] eq "libjpeg$aext" or $_ eq "libjpeg.$lext" },
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
318 libfiles=>'-ljpeg',
319 objfiles=>'jpeg.o',
320 docs=>q{
321 In order to use jpeg with this module you need to have libjpeg
322 installed on your computer}
323 };
324
325 $formats{'tiff'}={
326 order=>'23',
327 def=>'HAVE_LIBTIFF',
328 inccheck=>sub { $_[0] eq 'tiffio.h' },
76c8a0a Win32 handling for checking for libtiff
Tony Cook authored
329 libcheck=>sub { $_[0] eq "libtiff$aext" or $_ eq "libtiff.$lext" },
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
330 libfiles=>'-ltiff',
331 objfiles=>'tiff.o',
332 docs=>q{
333 In order to use tiff with this module you need to have libtiff
334 installed on your computer}
335 };
336
337 $formats{'png'}={
338 order=>'22',
339 def=>'HAVE_LIBPNG',
340 inccheck=>sub { $_[0] eq 'png.h' },
88a763e libpng support for Win32
Tony Cook authored
341 libcheck=>sub { $_[0] eq "libpng$aext" or $_[0] eq "libpng.$lext" },
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
342 libfiles=>'-lpng -lz',
343 objfiles=>'png.o',
344 docs=>q{
345 Png stands for Portable Network Graphics and is intended as
346 a replacement for gif on the web. It is patent free and
07ea6c2 - Makefile.PL now attempts to use freetype-config to configure freety…
Tony Cook authored
347 is recommended by the w3c, you need libpng to use these formats},
348 code => \&png_probe,
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
349 };
350
351 $formats{'gif'}={
352 order=>'20',
353 def=>'HAVE_LIBGIF',
354 inccheck=>sub { $_[0] eq 'gif_lib.h' },
e02451e added low-level error handling module
Tony Cook authored
355 libcheck=>sub { $_[0] eq "libgif$aext" or $_[0] eq "libgif.$lext" },
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
356 libfiles=>'-lgif',
357 objfiles=>'gif.o',
358 docs=>q{
359 gif is the de facto standard for webgraphics at the moment,
360 it does have some patent problems. If you have giflib and
361 are not in violation with the unisys patent you should use
362 this instead of the 'ungif' option. Note that they cannot
363 be in use at the same time}
364 };
365
366 $formats{'ungif'}={
367 order=>'21',
368 def=>'HAVE_LIBGIF',
369 inccheck=>sub { $_[0] eq 'gif_lib.h' },
e02451e added low-level error handling module
Tony Cook authored
370 libcheck=>sub { $_[0] eq "libungif$aext" or $_[0] eq "libungif.$lext" },
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
371 libfiles=>'-lungif',
372 objfiles=>'gif.o',
373 docs=>q{
374 gif is the de facto standard for webgraphics at the moment,
375 it does have some patent problems. If you have libungif and
376 want to create images free from LZW patented compression you
377 should use this option instead of the 'gif' option}
378 };
379
380 $formats{'T1-fonts'}={
381 order=>'30',
382 def=>'HAVE_LIBT1',
383 inccheck=>sub { $_[0] eq 't1lib.h' },
faa9b3e Egads
Tony Cook authored
384 libcheck=>sub { $_[0] eq "libt1$aext" or $_[0] eq "libt1.$lext" },
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
385 libfiles=>'-lt1',
386 objfiles=>'',
387 docs=>q{
388 postscript t1 fonts are scalable fonts. They can include
389 ligatures and kerning information and generally yield good
390 visual quality. We depend on libt1 to rasterize the fonts
391 for use in images.}
392 };
393
394 $formats{'TT-fonts'}={
395 order=>'31',
396 def=>'HAVE_LIBTT',
397 inccheck=>sub { $_[0] eq 'freetype.h' },
faa9b3e Egads
Tony Cook authored
398 libcheck=>sub { $_[0] eq "libttf$aext" or $_[0] eq "libttf.$lext" },
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
399 libfiles=>'-lttf',
400 objfiles=>'',
401 docs=>q{
402 Truetype fonts are scalable fonts. They can include
403 kerning and hinting information and generally yield good
404 visual quality esp on low resultions. The freetype library is
405 used to rasterize for us. The only drawback is that there
406 are alot of badly designed fonts out there.}
407 };
faa9b3e Egads
Tony Cook authored
408 $formats{'w32'} = {
409 order=>40,
410 def=>'HAVE_WIN32',
411 inccheck=>sub { lc $_[0] eq 'windows.h' },
412 libcheck=>sub { lc $_[0] eq 'gdi32.lib'
413 || lc $_[0] eq 'libgdi32.a' },
414 libfiles=>$^O eq 'cygwin' ? '-lgdi32' : '',
415 objfiles=>'win32.o',
416 docs => <<DOCS
417 Uses the Win32 GDI for rendering text.
418
419 This currently only works on under normal Win32 and cygwin.
420 DOCS
421 };
422 $formats{'freetype2'} = {
423 order=>'29',
424 def=>'HAVE_FT2',
425 inccheck=>sub { lc $_[0] eq 'ft2build.h' },
426 libcheck=>sub { $_[0] eq "libfreetype$aext" or $_[0] eq "libfreetype.$lext" },
427 libfiles=>'-lfreetype',
428 objfiles=>'freetyp2.o',
07ea6c2 - Makefile.PL now attempts to use freetype-config to configure freety…
Tony Cook authored
429 docs=><<DOCS,
faa9b3e Egads
Tony Cook authored
430 Freetype 2 supports both Truetype and Type 1 fonts, both of which are
431 scalable.
432 DOCS
07ea6c2 - Makefile.PL now attempts to use freetype-config to configure freety…
Tony Cook authored
433 code => \&freetype2_probe,
faa9b3e Egads
Tony Cook authored
434 };
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
435 # Make fix indent
436 for (keys %formats) { $formats{$_}->{docs} =~ s/^\s+/ /mg; }
437 }
438
439
440
441 sub gen {
442 my $V = $ENV{$_[0]};
443 defined($V) ? $V : "";
444 }
445
446
447 # Get information from environment variables
448
449 sub getenv {
450
451 ($VERBOSE,
452 $INCPATH,
453 $LIBPATH,
454 $NOLOG,
455 $DEBUG_MALLOC,
456 $MANUAL,
457 $CFLAGS,
458 $LFLAGS,
459 $DFLAGS) = map { gen $_ } qw(IM_VERBOSE
460 IM_INCPATH
461 IM_LIBPATH
462 IM_NOLOG
463 IM_DEBUG_MALLOC
464 IM_MANUAL
465 IM_CFLAGS
466 IM_LFLAGS
467 IM_DFLAGS);
468
469 if ($VERBOSE) { print "Verbose mode\n"; require Data::Dumper; import Data::Dumper qw(Dumper);}
470
471 if ($NOLOG) { print "Logging not compiled into module\n"; }
472 else { $EXTDEF.=' -DIMAGER_LOG'; }
473
474 if ($DEBUG_MALLOC) {
475 $EXTDEF.=' -DIMAGER_DEBUG_MALLOC';
476 print "Malloc debugging enabled\n";
477 }
478
479 }
07ea6c2 - Makefile.PL now attempts to use freetype-config to configure freety…
Tony Cook authored
480
481 # probes for freetype2 by trying to run freetype-config
482 sub freetype2_probe {
483 my ($frm, $frmkey) = @_;
484
485 is_exe('freetype-config') or return;
486
487 my $cflags = `freetype-config --cflags`
488 and !$? or return;
489 chomp $cflags;
490
491 $frm->{cflags} = $cflags;
492 my $lflags = `freetype-config --libs`
493 and !$? or return;
494 chomp $lflags;
495 $frm->{libfiles} = $lflags;
496
497 printf "%10s: configured via freetype-config\n", $frmkey;
498
499 return 1;
500 }
501
502 # probes for libpng via pkg-config
503 sub png_probe {
504 my ($frm, $frmkey) = @_;
505
506 is_exe('pkg-config') or return;
507
508 my $cflags;
509 my $config;
510 for my $check_conf (qw(libpng libpng12 libpng10)) {
511 $cflags = `pkg-config $check_conf --cflags`;
512 if ($cflags && !$?) {
513 $config = $check_conf;
514 last;
515 }
516 }
517 $config or return;
518
519 my $lflags = `pkg-config $config --libs`
520 and !$? or return;
521
522 chomp $cflags;
523 chomp $lflags;
524 $frm->{cflags} = $cflags;
525 $frm->{libfiles} = $lflags;
526
527 printf "%10s: configured via `pkg-config $config ...`\n", $frmkey;
528
529 return 1;
530 }
531
532 sub catfile {
533 return File::Spec->catfile(@_);
534 }
535
536 sub is_exe {
537 my ($name) = @_;
538
539 for my $dir (File::Spec->path) {
540 -x catfile($dir, "$name$Config{_exe}")
541 and return 1;
542 }
543
544 return;
545 }
Something went wrong with that request. Please try again.