3 use ExtUtils::MakeMaker;
8 use ExtUtils::Manifest qw(maniread);
10 use vars qw(%formats $VERBOSE $INCPATH $LIBPATH $NOLOG $DEBUG_MALLOC $MANUAL $CFLAGS $LFLAGS $DFLAGS);
14 # EU::MM runs Makefile.PL all in the same process, so sub-modules will
16 our $BUILDING_IMAGER = 1;
19 # IM_INCPATH colon seperated list of paths to extra include paths
20 # IM_LIBPATH colon seperated list of paths to extra library paths
22 # IM_VERBOSE turns on verbose mode for the library finding and such
23 # IM_MANUAL to manually select which libraries are used and which not
24 # IM_ENABLE to programmatically select which libraries are used
26 # IM_NOLOG if true logging will not be compiled into the module
27 # IM_DEBUG_MALLOC if true malloc debbuging will be compiled into the module
28 # do not use IM_DEBUG_MALLOC in production - this slows
29 # everything down by alot
30 # IM_CFLAGS Extra flags to pass to the compiler
31 # IM_LFLAGS Extra flags to pass to the linker
32 # IM_DFLAGS Extra flags to pass to the preprocessor
34 my $KEEP_FILES = $ENV{IMAGER_KEEP_FILES};
36 getenv(); # get environment variables
38 my $lext=$Config{'so'}; # Get extensions of libraries
39 my $aext=$Config{'_a'};
41 my $help; # display help if set
42 my @enable; # list of drivers to enable
43 my @disable; # or list of drivers to disable
44 my @incpaths; # places to look for headers
45 my @libpaths; # places to look for libraries
46 my $noexif; # non-zero to disable EXIF parsing of JPEGs
47 my $no_gif_set_version; # disable calling EGifSetGifVersion
48 my $coverage; # build for coverage testing
49 my $assert; # build with assertions
50 GetOptions("help" => \$help,
51 "enable=s" => \@enable,
52 "disable=s" => \@disable,
53 "incpath=s", \@incpaths,
54 "libpath=s" => \@libpaths,
55 "verbose|v" => \$VERBOSE,
58 "nogifsetversion" => \$no_gif_set_version,
59 'coverage' => \$coverage,
60 "assert|a" => \$assert);
64 if ($ENV{AUTOMATED_TESTING}) {
69 print "Verbose mode\n";
71 import Data::Dumper qw(Dumper);
80 if ($NOLOG) { print "Logging not compiled into module\n"; }
82 push @defines, [ IMAGER_LOG => 1, "Logging system" ];
86 push @defines, [ IM_ASSERT => 1, "im_assert() are effective" ];
90 push @defines, [ IMAGER_DEBUG_MALLOC => 1, "Use Imager's DEBUG malloc()" ];
91 print "Malloc debugging enabled\n";
94 if (@enable && @disable) {
95 print STDERR "Only --enable or --disable can be used, not both, try --help\n";
101 my @incs; # all the places to look for headers
102 my @libs; # all the places to look for libraries
104 init(); # initialize global data
105 pathcheck(); # Check if directories exist
107 if (exists $ENV{IM_ENABLE}) {
108 my %en = map { $_, 1 } split ' ', $ENV{IM_ENABLE};
109 for my $key (keys %formats) {
110 delete $formats{$key} unless $en{$key};
114 my %en = map { $_ => 1 } map { split /,/ } @enable;
115 for my $key (keys %formats) {
116 delete $formats{$key} unless $en{$key};
120 delete @formats{map { split /,/ } @disable};
123 # Pick what libraries are used
130 # Make sure there isn't a clash between the gif libraries.
137 for my $frmkey (sort { $formats{$a}{order} <=> $formats{$b}{order} } keys %formats) {
138 my $frm = $formats{$frmkey};
139 push @defines, [ $frm->{def}, 1, "$frmkey available" ];
140 $F_OBJECT .= ' ' .$frm->{objfiles};
141 if ($frm->{cflags}) {
142 $lib_cflags .= ' ' .$frm->{cflags};
143 ++$definc{$_} for map { /^-I(.*)$/ ? ($1) : () }
144 grep /^-I./, split ' ', $frm->{cflags};
146 if ($frm->{lflags}) {
147 $lib_lflags .= ' ' . $frm->{lflags};
150 $F_LIBS .= ' ' .$frm->{libfiles};
156 print "EXIF support enabled\n";
157 push @defines, [ 'IMEXIF_ENABLE', 1, "Enable experimental EXIF support" ];
158 $F_OBJECT .= ' imexif.o';
161 my $F_INC = join ' ', map "-I$_", map / / ? qq{"$_"} : $_,
162 grep !$definc{$_}, @incs;
163 $F_LIBS = join(' ',map "-L$_", map / / ? qq{"$_"} : $_,
164 grep !$deflib{$_}++, @libs) . $F_LIBS;
167 my $OSDEF = "-DOS_$^O";
169 if ($^O eq 'hpux') { $OSLIBS .= ' -ldld'; }
170 if (defined $Config{'d_dlsymun'}) { $OSDEF .= ' -DDLSYMUN'; }
172 my @objs = qw(Imager.o draw.o polygon.o image.o io.o iolayer.o
173 log.o gaussian.o conv.o pnm.o raw.o feat.o font.o
174 filters.o dynaload.o stackmach.o datatypes.o
175 regmach.o trans2.o quant.o error.o convert.o
176 map.o tags.o palimg.o maskimg.o img16.o rotate.o
177 bmp.o tga.o color.o fills.o imgdouble.o limits.o hlines.o
178 imext.o scale.o rubthru.o render.o paste.o compose.o flip.o);
182 'VERSION_FROM' => 'Imager.pm',
183 'LIBS' => "$LFLAGS -lm $lib_lflags $OSLIBS $F_LIBS",
184 'DEFINE' => "$OSDEF $CFLAGS",
185 'INC' => "$lib_cflags $DFLAGS $F_INC",
186 'OBJECT' => join(' ', @objs, $F_OBJECT),
187 clean => { FILES=>'testout rubthru.c scale.c conv.c filters.c gaussian.c render.c rubthru.c' },
189 PREREQ_PM => { 'Test::More' => 0.47 },
193 if ($Config{gccversion}) {
194 push @ARGV, 'OPTIMIZE=-ftest-coverage -fprofile-arcs';
195 #$opts{dynamic_lib} = { OTHERLDFLAGS => '-ftest-coverage -fprofile-arcs' };
198 die "Don't know the coverage C flags for your compiler\n";
202 # eval to prevent warnings about versions with _ in them
203 my $MM_ver = eval $ExtUtils::MakeMaker::VERSION;
204 if ($MM_ver > 6.06) {
205 $opts{AUTHOR} = 'Tony Cook <tony@imager.perl.org>, Arnar M. Hrafnkelsson';
206 $opts{ABSTRACT} = 'Perl extension for Generating 24 bit Images';
209 if ($MM_ver >= 6.46) {
214 "Parse::RecDescent" => 0
227 homepage => "http://imager.perl.org/",
230 url => "http://imager.perl.org/svn/trunk/Imager",
231 web => "http://imager.perl.org/svnweb/public/browse/trunk/Imager",
236 web => "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Imager",
237 mailto => 'bug-Imager@rt.cpan.org',
243 make_imconfig(\@defines);
245 if ($VERBOSE) { print Dumper(\%opts); }
246 mkdir('testout',0777); # since we cannot include it in the archive.
248 -d "probe" and rmdir "probe";
250 WriteMakefile(%opts);
257 my $perl = $self->{PERLRUN} ? '$(PERLRUN)' : '$(PERL)';
260 my @ims = grep /\.im$/, keys %$mani;
262 dyntest.$(MYEXTLIB) : dynfilt/Makefile
263 cd dynfilt && $(MAKE) $(PASTHRU)
265 lib/Imager/Regops.pm : regmach.h regops.perl
266 $(PERL) regops.perl regmach.h lib/Imager/Regops.pm
268 imconfig.h : Makefile.PL
269 $(ECHO) "imconfig.h out-of-date with respect to $?"
270 $(PERLRUN) Makefile.PL
271 $(ECHO) "==> Your Makefile has been rebuilt - re-run your make command <=="
273 lib/Imager/APIRef.pod : \$(C_FILES) \$(H_FILES) apidocs.perl
274 $perl apidocs.perl lib/Imager/APIRef.pod
276 !.join('', map _im_rule($perl, $_), @ims)
281 my ($perl, $im) = @_;
283 (my $c = $im) =~ s/\.im$/.c/;
286 $c: $im lib/Imager/Preprocess.pm
287 $perl -Ilib -MImager::Preprocess -epreprocess $im $c
293 # manual configuration of helper libraries
298 Please answer the following questions about
299 which formats are avaliable on your computer
301 press <return> to continue
304 <STDIN>; # eat one return
306 for my $frm(sort { $formats{$b}{order} <=> $formats{$a}{order} } keys %formats) {
308 if ($formats{$frm}{docs}) { print "\n",$formats{$frm}{docs},"\n\n"; }
309 print "Enable $frm support: ";
312 if ($gz =~ m/^(y|yes|n|no)/i) {
313 $gz=substr(lc($gz),0,1);
315 delete $formats{$frm};
322 # automatic configuration of helper libraries
325 print "Automatic probing:\n" if $VERBOSE;
326 for my $frm (sort { $formats{$a}{order} <=> $formats{$b}{order} } keys %formats) {
327 delete $formats{$frm} if !checkformat($frm);
333 if ($formats{'gif'} and $formats{'ungif'}) {
334 print "ungif and gif can not coexist - removing ungif support\n";
335 delete $formats{'ungif'};
338 for my $frm (qw(gif ungif)) {
339 checkformat($frm) if ($MANUAL and $formats{$frm});
343 for my $frm (grep $formats{$_}, qw(gif ungif)) {
344 push(@dirs, @{$formats{$frm}{incdir}}) if $formats{$frm}{incdir};
348 FILES: for my $dir (@dirs) {
349 my $h = "$dir/gif_lib.h";
350 open H, "< $h" or next;
352 if (/GIF_LIB_VERSION\s+"\s*version\s*(\d+)\.(\d+)/i) {
362 # we need the version in a #ifdefable form
364 push @defines, [ IM_GIFMAJOR => $major, "Parsed giflib version" ];
365 push @defines, [ IM_GIFMINOR => $minor ];
366 push @defines, [ IM_NO_SET_GIF_VERSION => 1, "Disable EGifSetGifVersion" ]
367 if $no_gif_set_version;
374 # print "checking path $path\n";
375 if ( !opendir(DH,$path) ) {
376 warn "Cannot open dir $path: $!\n";
379 my @l=grep { $chk->($_) } readdir(DH);
382 return map $path, @l;
386 my ($format, $frm) = @_;
388 my $lib_check=$formats{$frm}{'libcheck'};
389 my $inc_check=$formats{$frm}{'inccheck'};
394 push(@l, grep_directory($lp,$lib_check));
399 push(@i, $ip) if $inc_check->($ip,$frm);
402 printf("%10s: includes %s - libraries %s\n",$frm,(@i?'found':'not found'),(@l?'found':'not found'));
403 $formats{$frm}{incdir} = \@i;
404 $formats{$frm}{libdir} = \@l;
405 return 1 if scalar(@i && @l);
408 printf("%10s: not available\n", $frm);
417 print " checkformat($frm)\n" if $VERBOSE;
419 my $format = $formats{$frm};
422 if (my $code = $format->{'code'}) {
423 if (ref $code eq 'ARRAY') {
424 push @probes, @$code;
430 push @probes, \&_probe_default;
432 print " Calling probe function\n" if $VERBOSE;
434 for my $func (@probes) {
435 if ($func->($format, $frm)) {
443 if ($format->{postcheck}) {
444 print " Calling postcheck function\n" if $VERBOSE;
445 $format->{postcheck}->($format, $frm)
456 print " Include paths:\n";
457 for (@incs) { print $_,"\n"; }
459 @incs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @incs;
462 print "\nLibrary paths:\n";
463 for (@libs) { print $_,"\n"; }
465 @libs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @libs;
470 # Format data initialization
472 # format definition is:
474 # default include path
475 # files needed for include (boolean perl code)
478 # files needed for link (boolean perl code)
479 # object files needed for the format
484 my @definc = qw(/usr/include);
485 @definc{@definc}=(1) x @definc;
488 split(/\Q$Config{path_sep}/, $INCPATH),
489 map _tilde_expand($_), map { split /\Q$Config{path_sep}/ } @incpaths
491 if ($Config{locincpth}) {
492 push @incs, grep -d, split ' ', $Config{locincpth};
494 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
495 push(@incs, split /;/, $ENV{INCLUDE}) if exists $ENV{INCLUDE};
497 if ($Config{incpath}) {
498 push @incs, grep -d, split /\Q$Config{path_sep}/, $Config{incpath};
502 /usr/include/freetype2
503 /usr/local/include/freetype2
504 /usr/local/include/freetype1/freetype
505 /usr/include /usr/local/include /usr/include/freetype
506 /usr/local/include/freetype);
507 if ($Config{ccflags}) {
508 my @hidden = map { /^-I(.*)$/ ? ($1) : () } split ' ', $Config{ccflags};
510 @definc{@hidden} = (1) x @hidden;
513 @libs= ( split(/\Q$Config{path_sep}/,$LIBPATH),
514 map _tilde_expand($_), map { split /\Q$Config{path_sep}/} @libpaths );
515 if ($Config{loclibpth}) {
516 push @libs, grep -d, split ' ', $Config{loclibpth};
519 push @libs, grep -d, qw(/sw/lib), split(/ /, $Config{'libpth'});
520 push @libs, grep -d, split / /, $Config{libspath} if $Config{libspath};
521 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
522 push(@libs, split /;/, $ENV{LIB}) if exists $ENV{LIB};
524 if ($^O eq 'cygwin') {
525 push(@libs, '/usr/lib/w32api') if -d '/usr/lib/w32api';
526 push(@incs, '/usr/include/w32api') if -d '/usr/include/w32api';
528 if ($Config{ldflags}) {
529 # some builds of perl put -Ldir into ldflags without putting it in
530 # loclibpth, let's extract them
531 my @hidden = grep -d, map { /^-L(.*)$/ ? ($1) : () }
532 split ' ', $Config{ldflags};
534 # don't mark them as seen - EU::MM will remove any libraries
535 # it can't find and it doesn't look for -L in ldflags
536 #@deflib{@hidden} = @hidden;
538 push @libs, grep -d, qw(/usr/local/lib);
543 inccheck=>sub { -e catfile($_[0], 'jpeglib.h') },
544 libcheck=>sub { $_[0] eq "libjpeg$aext" or $_ eq "libjpeg.$lext" },
548 In order to use jpeg with this module you need to have libjpeg
549 installed on your computer}
555 inccheck=>sub { -e catfile($_[0], 'tiffio.h') },
556 libcheck=>sub { $_[0] eq "libtiff$aext" or $_ eq "libtiff.$lext" },
560 In order to use tiff with this module you need to have libtiff
561 installed on your computer},
562 postcheck => \&postcheck_tiff,
567 # def=>'HAVE_LIBPNG',
568 # inccheck=>sub { -e catfile($_[0], 'png.h') },
569 # libcheck=>sub { $_[0] eq "libpng$aext" or $_[0] eq "libpng.$lext" },
570 # libfiles=>$^O eq 'MSWin32' ? '-lpng -lzlib' : '-lpng -lz',
573 # Png stands for Portable Network Graphics and is intended as
574 # a replacement for gif on the web. It is patent free and
575 # is recommended by the w3c, you need libpng to use these formats},
576 # code => \&png_probe,
582 inccheck=>sub { -e catfile($_[0], 'gif_lib.h') },
583 libcheck=>sub { $_[0] eq "libgif$aext" or $_[0] eq "libgif.$lext" },
587 gif is the de facto standard for webgraphics at the moment,
588 it does have some patent problems. If you have giflib and
589 are not in violation with the unisys patent you should use
590 this instead of the 'ungif' option. Note that they cannot
591 be in use at the same time}
597 inccheck=>sub { -e catfile($_[0], 'gif_lib.h') },
598 libcheck=>sub { $_[0] eq "libungif$aext" or $_[0] eq "libungif.$lext" },
602 gif is the de facto standard for webgraphics at the moment,
603 it does have some patent problems. If you have libungif and
604 want to create images free from LZW patented compression you
605 should use this option instead of the 'gif' option}
608 $formats{'T1-fonts'}={
611 inccheck=>sub { -e catfile($_[0], 't1lib.h') },
612 libcheck=>sub { $_[0] eq "libt1$aext" or $_[0] eq "libt1.$lext" },
616 postscript t1 fonts are scalable fonts. They can include
617 ligatures and kerning information and generally yield good
618 visual quality. We depend on libt1 to rasterize the fonts
622 $formats{'TT-fonts'}=
626 inccheck=>sub { -e catfile($_[0], 'freetype.h')
627 && !-e catfile($_[0], 'fterrors.h') },
628 libcheck=>sub { $_[0] eq "libttf$aext" or $_[0] eq "libttf.$lext" },
631 code => \&freetype1_probe,
633 Truetype fonts are scalable fonts. They can include
634 kerning and hinting information and generally yield good
635 visual quality esp on low resultions. The freetype library is
636 used to rasterize for us. The only drawback is that there
637 are alot of badly designed fonts out there.}
642 inccheck=>sub { -e catfile($_[0], 'windows.h') },
643 libcheck=>sub { lc $_[0] eq 'gdi32.lib'
644 || lc $_[0] eq 'libgdi32.a' },
645 libfiles=>$^O eq 'cygwin' ? '-lgdi32' : '',
648 Uses the Win32 GDI for rendering text.
650 This currently only works on under normal Win32 and cygwin.
653 $formats{'freetype2'} =
657 # we always use a probe function
658 #inccheck=>sub { -e catfile($_[0], 'ft2build.h') },
659 #libcheck=>sub { $_[0] eq "libfreetype$aext" or $_[0] eq "libfreetype.$lext" },
660 libfiles=>'-lfreetype',
661 objfiles=>'freetyp2.o',
663 Freetype 2 supports both Truetype and Type 1 fonts, both of which are
664 scalable. It also supports a variety of other fonts.
668 \&freetype2_probe_ftconfig,
669 \&freetype2_probe_scan
674 for (keys %formats) { $formats{$_}->{docs} =~ s/^\s+/ /mg; }
681 defined($V) ? $V : "";
685 # Get information from environment variables
697 $DFLAGS) = map { gen $_ } qw(IM_VERBOSE
709 # populate the environment so that sub-modules get the same info
711 $ENV{IM_VERBOSE} = 1 if $VERBOSE;
712 $ENV{IM_INCPATH} = join $Config{path_sep}, @incpaths if @incpaths;
713 $ENV{IM_LIBPATH} = join $Config{path_sep}, @libpaths if @libpaths;
719 open CONFIG, "> imconfig.h"
720 or die "Cannot create imconfig.h: $!\n";
722 /* This file is automatically generated by Makefile.PL.
723 Don't edit this file, since any changes will be lost */
725 #ifndef IMAGER_IMCONFIG_H
726 #define IMAGER_IMCONFIG_H
728 for my $define (@$defines) {
730 print CONFIG "\n/*\n $define->[2]\n*/\n\n";
732 print CONFIG "#define $define->[0] $define->[1]\n";
734 print CONFIG "\n#endif\n";
738 # use pkg-config to probe for libraries
739 # works around the junk that pkg-config dumps on FreeBSD
743 is_exe('pkg-config') or return;
745 my $redir = $^O eq 'MSWin32' ? '' : '2>/dev/null';
747 !system("pkg-config $pkg --exists $redir");
750 # probes for freetype1 by scanning @incs for the includes and
751 # @libs for the libs. This is done separately because freetype's headers
752 # are stored in a freetype or freetype1 directory under PREFIX/include.
754 # we could find the files with the existing mechanism, but it won't set
755 # -I flags correctly.
757 # This could be extended to freetype2 too, but freetype-config catches
759 sub freetype1_probe {
760 my ($frm, $frmkey) = @_;
764 for my $inc (@incs) {
765 for my $subdir (qw/freetype freetype1/) {
766 my $path = File::Spec->catfile($inc, $subdir, 'freetype.h');
768 $path = File::Spec->catfile($inc, $subdir, 'fterrors.h');
771 $found_inc = File::Spec->catdir($inc, $subdir);
778 for my $lib (@libs) {
779 my $a_path = File::Spec->catfile($lib, "libttf$aext");
780 my $l_path = File::Spec->catfile($lib, "libttf.$lext");
781 if (-e $a_path || -e $l_path) {
787 return unless $found_inc && $found_lib;
788 printf("%10s: includes %s - libraries %s\n", $frmkey,
789 ($found_inc ? 'found' : 'not found'),
790 ($found_lib ? 'found' : 'not found'));
792 $frm->{cflags} = "-I$found_inc";
793 $frm->{libfiles} = "-lttf";
798 # probes for freetype2 by trying to run freetype-config
799 sub freetype2_probe_ftconfig {
800 my ($frm, $frmkey) = @_;
802 is_exe('freetype-config') or return;
804 my $cflags = `freetype-config --cflags`
808 my $lflags = `freetype-config --libs`
812 # before 2.1.5 freetype-config --cflags could output
813 # the -I options in the wrong order, causing a conflict with
814 # freetype1.x installed with the same --prefix
817 # - both -Iprefix/include and -Iprefix/include/freetype2 are in cflags
819 # - freetype 1.x headers are in prefix/include/freetype
820 my @incdirs = map substr($_, 2), grep /^-I/, split ' ', $cflags;
822 && $incdirs[1] eq "$incdirs[0]/freetype2"
823 && -e "$incdirs[0]/freetype/freetype.h"
824 && -e "$incdirs[0]/freetype/fterrid.h") {
825 print "** freetype-config provided -I options out of order, correcting\n"
827 $cflags = join(' ', grep(!/-I/, split ' ', $cflags),
828 map "-I$_", reverse @incdirs);
830 $frm->{cflags} = $cflags;
831 $frm->{lflags} = $lflags;
833 printf "%10s: configured via freetype-config\n", $frmkey;
838 # attempt to probe for freetype2 by scanning directories
839 # we can't use the normal scan since we need to find the directory
840 # containing most of the includes
841 sub freetype2_probe_scan {
842 my ($frm, $frmkey) = @_;
847 for my $inc (@incs) {
848 my $path = File::Spec->catfile($inc, 'ft2build.h');
851 # try to find what it's including
853 open FT2BUILD, "< $path"
856 if (m!^\s*\#\s*include\s+<([\w/.]+)>!
857 || m!^\s*\#\s*include\s+"([\w/.]+)"!) {
865 # non-Unix installs put this directly under the same directory in
867 if (-e File::Spec->catfile($inc, $ftheader)) {
871 for my $subdir (qw/freetype2 freetype/) {
872 $path = File::Spec->catfile($inc, $subdir, 'fterrors.h');
876 $found_inc2 = File::Spec->catdir($inc, $subdir);
883 for my $lib (@libs) {
884 my $a_path = File::Spec->catfile($lib, "libfreetype$aext");
885 my $l_path = File::Spec->catfile($lib, "libfreetype.$lext");
886 if (-e $a_path || -e $l_path) {
892 printf("%10s: includes %s - libraries %s\n", $frmkey,
893 ($found_inc ? 'found' : 'not found'),
894 ($found_lib ? 'found' : 'not found'));
896 return unless $found_inc && $found_lib;
898 $frm->{cflags} = _make_I($found_inc);
899 $frm->{cflags} .= " " . _make_I($found_inc2) if $found_inc2;
900 $frm->{libfiles} = "-lfreetype";
911 $inc_dir =~ / / ? qq!-I"$inc_dir"! : "-I$inc_dir";
914 # probes for libpng via pkg-config
916 my ($frm, $frmkey) = @_;
918 is_exe('pkg-config') or return;
921 for my $check_conf (qw(libpng libpng12 libpng10)) {
922 if (_pkg_probe($check_conf)) {
923 $config = $check_conf;
929 my $cflags = `pkg-config $config --cflags`
932 my $lflags = `pkg-config $config --libs`
937 $frm->{cflags} = $cflags;
938 $frm->{lflags} = $lflags;
940 printf "%10s: configured via `pkg-config $config ...`\n", $frmkey;
946 return File::Spec->catfile(@_);
952 my @exe_suffix = $Config{_exe};
953 if ($^O eq 'MSWin32') {
954 push @exe_suffix, qw/.bat .cmd/;
957 for my $dir (File::Spec->path) {
958 for my $suffix (@exe_suffix) {
959 -x catfile($dir, "$name$suffix")
969 Usage: $0 [--enable feature1,feature2,...] [other options]
970 $0 [--disable feature1,feature2,...] [other options]
972 Possible feature names are:
973 png gif ungif jpeg tiff T1-fonts TT-fonts freetype2
976 Verbose library probing (or set IM_VERBOSE in the environment)
978 Disable logging (or set IM_NOLOG in the environment)
980 Add to the include search path
982 Add to the library search path
984 Build for coverage testing.
986 Build with assertions active.
988 Disable EXIF parsing.
994 # generate the PM MM argument
995 # I'd prefer to modify the public version, but there doesn't seem to be
996 # a public API to do that
999 my $instbase = '$(INST_LIBDIR)';
1001 # first the basics, .pm and .pod files
1002 $pm{"Imager.pm"} = "$instbase/Imager.pm";
1004 my $mani = maniread();
1006 for my $filename (keys %$mani) {
1007 if ($filename =~ m!^lib/! && $filename =~ /\.(pm|pod)$/) {
1008 (my $work = $filename) =~ s/^lib//;
1009 $pm{$filename} = $instbase . $work;
1014 $pm{typemap} = $instbase . '/Imager/typemap';
1016 # and the core headers
1017 for my $filename (keys %$mani) {
1018 if ($filename =~ /^\w+\.h$/) {
1019 $pm{$filename} = $instbase . '/Imager/include/' . $filename;
1023 # and the generated header
1024 $pm{"imconfig.h"} = $instbase . '/Imager/include/imconfig.h';
1033 if ($path =~ m!^~[/\\]!) {
1034 defined $home or $home = $ENV{HOME};
1035 if (!defined $home && $^O eq 'MSWin32'
1036 && defined $ENV{HOMEDRIVE} && defined $ENV{HOMEPATH}) {
1037 $home = $ENV{HOMEDRIVE} . $ENV{HOMEPATH};
1039 unless (defined $home) {
1040 $home = eval { (getpwuid($<))[7] };
1042 defined $home or die "You supplied $path, but I can't find your home directory\n";
1044 $path = File::Spec->catdir($home, $path);
1050 sub postcheck_tiff {
1051 my ($format, $frm) = @_;
1053 -d "probe" or mkdir "probe";
1055 my $tiffver_name = "probe/tiffver.txt";
1058 if ($Config{cc} =~ /\b(cl|bcc)\b/) {
1065 # setup LD_RUN_PATH to match link time
1066 my $lopts = join " " , map("-L$_", @{$format->{libdir}}), " -ltiff";
1067 my ($extra, $bs_load, $ld_load, $ld_run_path) =
1068 ExtUtils::Liblist->ext($lopts, $VERBOSE);
1069 local $ENV{LD_RUN_PATH};
1072 print "Setting LD_RUN_PATH=$ld_run_path for TIFF probe\n" if $VERBOSE;
1073 $ENV{LD_RUN_PATH} = $ld_run_path;
1081 incpath => $format->{incdir},
1082 libpath => $format->{libdir},
1084 header => [ qw(stdio.h tiffio.h) ],
1085 function => <<FUNCTION,
1087 const char *vers = TIFFGetVersion();
1088 FILE *f = fopen("$tiffver_name", "wb");
1101 unless ($good && -s $tiffver_name
1102 && open(VERS, "< $tiffver_name")) {
1103 unlink $tiffver_name unless $KEEP_FILES;
1105 **tiff: cannot determine libtiff version number
1111 # version file seems to be there, load it up
1112 my $ver_str = do { local $/; <VERS> };
1114 unlink $tiffver_name unless $KEEP_FILES;
1116 my ($version) = $ver_str =~ /(\d+\.\d+\.\d+)/;
1118 if ($version eq '3.9.0') {
1120 **tiff: libtiff 3.9.0 introduced a serious bug, please install 3.9.1
1129 # This isn't a module, but some broken tools, like
1130 # Module::Depends::Instrusive insist on treating it like one.
1132 # http://rt.cpan.org/Public/Bug/Display.html?id=21229