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 $coverage; # build for coverage testing
48 my $assert; # build with assertions
49 GetOptions("help" => \$help,
50 "enable=s" => \@enable,
51 "disable=s" => \@disable,
52 "incpath=s", \@incpaths,
53 "libpath=s" => \@libpaths,
54 "verbose|v" => \$VERBOSE,
57 'coverage' => \$coverage,
58 "assert|a" => \$assert);
62 if ($ENV{AUTOMATED_TESTING}) {
67 print "Verbose mode\n";
69 import Data::Dumper qw(Dumper);
78 if ($NOLOG) { print "Logging not compiled into module\n"; }
80 push @defines, [ IMAGER_LOG => 1, "Logging system" ];
84 push @defines, [ IM_ASSERT => 1, "im_assert() are effective" ];
88 push @defines, [ IMAGER_DEBUG_MALLOC => 1, "Use Imager's DEBUG malloc()" ];
89 print "Malloc debugging enabled\n";
92 if (@enable && @disable) {
93 print STDERR "Only --enable or --disable can be used, not both, try --help\n";
99 my @incs; # all the places to look for headers
100 my @libs; # all the places to look for libraries
102 init(); # initialize global data
103 pathcheck(); # Check if directories exist
105 if (exists $ENV{IM_ENABLE}) {
106 my %en = map { $_, 1 } split ' ', $ENV{IM_ENABLE};
107 for my $key (keys %formats) {
108 delete $formats{$key} unless $en{$key};
112 my %en = map { $_ => 1 } map { split /,/ } @enable;
113 for my $key (keys %formats) {
114 delete $formats{$key} unless $en{$key};
118 delete @formats{map { split /,/ } @disable};
121 # Pick what libraries are used
132 for my $frmkey (sort { $formats{$a}{order} <=> $formats{$b}{order} } keys %formats) {
133 my $frm = $formats{$frmkey};
134 push @defines, [ $frm->{def}, 1, "$frmkey available" ];
135 $F_OBJECT .= ' ' .$frm->{objfiles};
136 if ($frm->{cflags}) {
137 $lib_cflags .= ' ' .$frm->{cflags};
138 ++$definc{$_} for map { /^-I(.*)$/ ? ($1) : () }
139 grep /^-I./, split ' ', $frm->{cflags};
141 if ($frm->{lflags}) {
142 $lib_lflags .= ' ' . $frm->{lflags};
145 $F_LIBS .= ' ' .$frm->{libfiles};
151 print "EXIF support enabled\n";
152 push @defines, [ 'IMEXIF_ENABLE', 1, "Enable experimental EXIF support" ];
153 $F_OBJECT .= ' imexif.o';
156 my $F_INC = join ' ', map "-I$_", map / / ? qq{"$_"} : $_,
157 grep !$definc{$_}, @incs;
158 $F_LIBS = join(' ',map "-L$_", map / / ? qq{"$_"} : $_,
159 grep !$deflib{$_}++, @libs) . $F_LIBS;
162 my $OSDEF = "-DOS_$^O";
164 if ($^O eq 'hpux') { $OSLIBS .= ' -ldld'; }
165 if (defined $Config{'d_dlsymun'}) { $OSDEF .= ' -DDLSYMUN'; }
167 my @objs = qw(Imager.o draw.o polygon.o image.o io.o iolayer.o
168 log.o gaussian.o conv.o pnm.o raw.o feat.o font.o
169 filters.o dynaload.o stackmach.o datatypes.o
170 regmach.o trans2.o quant.o error.o convert.o
171 map.o tags.o palimg.o maskimg.o img16.o rotate.o
172 bmp.o tga.o color.o fills.o imgdouble.o limits.o hlines.o
173 imext.o scale.o rubthru.o render.o paste.o compose.o flip.o);
177 'VERSION_FROM' => 'Imager.pm',
178 'LIBS' => "$LFLAGS -lm $lib_lflags $OSLIBS $F_LIBS",
179 'DEFINE' => "$OSDEF $CFLAGS",
180 'INC' => "$lib_cflags $DFLAGS $F_INC",
181 'OBJECT' => join(' ', @objs, $F_OBJECT),
182 clean => { FILES=>'testout rubthru.c scale.c conv.c filters.c gaussian.c render.c rubthru.c' },
184 PREREQ_PM => { 'Test::More' => 0.47 },
188 if ($Config{gccversion}) {
189 push @ARGV, 'OPTIMIZE=-ftest-coverage -fprofile-arcs';
190 #$opts{dynamic_lib} = { OTHERLDFLAGS => '-ftest-coverage -fprofile-arcs' };
193 die "Don't know the coverage C flags for your compiler\n";
197 # eval to prevent warnings about versions with _ in them
198 my $MM_ver = eval $ExtUtils::MakeMaker::VERSION;
199 if ($MM_ver > 6.06) {
200 $opts{AUTHOR} = 'Tony Cook <tony@imager.perl.org>, Arnar M. Hrafnkelsson';
201 $opts{ABSTRACT} = 'Perl extension for Generating 24 bit Images';
204 if ($MM_ver >= 6.46) {
209 "Parse::RecDescent" => 0
223 homepage => "http://imager.perl.org/",
226 url => "http://imager.perl.org/svn/trunk/Imager",
227 web => "http://imager.perl.org/svnweb/public/browse/trunk/Imager",
232 web => "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Imager",
233 mailto => 'bug-Imager@rt.cpan.org',
239 make_imconfig(\@defines);
241 if ($VERBOSE) { print Dumper(\%opts); }
242 mkdir('testout',0777); # since we cannot include it in the archive.
244 -d "probe" and rmdir "probe";
246 WriteMakefile(%opts);
253 my $perl = $self->{PERLRUN} ? '$(PERLRUN)' : '$(PERL)';
256 my @ims = grep /\.im$/, keys %$mani;
258 dyntest.$(MYEXTLIB) : dynfilt/Makefile
259 cd dynfilt && $(MAKE) $(PASTHRU)
261 lib/Imager/Regops.pm : regmach.h regops.perl
262 $(PERL) regops.perl regmach.h lib/Imager/Regops.pm
264 imconfig.h : Makefile.PL
265 $(ECHO) "imconfig.h out-of-date with respect to $?"
266 $(PERLRUN) Makefile.PL
267 $(ECHO) "==> Your Makefile has been rebuilt - re-run your make command <=="
269 lib/Imager/APIRef.pod : \$(C_FILES) \$(H_FILES) apidocs.perl
270 $perl apidocs.perl lib/Imager/APIRef.pod
272 !.join('', map _im_rule($perl, $_), @ims)
277 my ($perl, $im) = @_;
279 (my $c = $im) =~ s/\.im$/.c/;
282 $c: $im lib/Imager/Preprocess.pm
283 $perl -Ilib -MImager::Preprocess -epreprocess $im $c
289 # manual configuration of helper libraries
294 Please answer the following questions about
295 which formats are avaliable on your computer
297 press <return> to continue
300 <STDIN>; # eat one return
302 for my $frm(sort { $formats{$b}{order} <=> $formats{$a}{order} } keys %formats) {
304 if ($formats{$frm}{docs}) { print "\n",$formats{$frm}{docs},"\n\n"; }
305 print "Enable $frm support: ";
308 if ($gz =~ m/^(y|yes|n|no)/i) {
309 $gz=substr(lc($gz),0,1);
311 delete $formats{$frm};
318 # automatic configuration of helper libraries
321 print "Automatic probing:\n" if $VERBOSE;
322 for my $frm (sort { $formats{$a}{order} <=> $formats{$b}{order} } keys %formats) {
323 delete $formats{$frm} if !checkformat($frm);
329 # if ($formats{'gif'} and $formats{'ungif'}) {
330 # print "ungif and gif can not coexist - removing ungif support\n";
331 # delete $formats{'ungif'};
334 # for my $frm (qw(gif ungif)) {
335 # checkformat($frm) if ($MANUAL and $formats{$frm});
339 # for my $frm (grep $formats{$_}, qw(gif ungif)) {
340 # push(@dirs, @{$formats{$frm}{incdir}}) if $formats{$frm}{incdir};
344 # FILES: for my $dir (@dirs) {
345 # my $h = "$dir/gif_lib.h";
346 # open H, "< $h" or next;
348 # if (/GIF_LIB_VERSION\s+"\s*version\s*(\d+)\.(\d+)/i) {
358 # # we need the version in a #ifdefable form
360 # push @defines, [ IM_GIFMAJOR => $major, "Parsed giflib version" ];
361 # push @defines, [ IM_GIFMINOR => $minor ];
362 # push @defines, [ IM_NO_SET_GIF_VERSION => 1, "Disable EGifSetGifVersion" ]
363 # if $no_gif_set_version;
370 # print "checking path $path\n";
371 if ( !opendir(DH,$path) ) {
372 warn "Cannot open dir $path: $!\n";
375 my @l=grep { $chk->($_) } readdir(DH);
378 return map $path, @l;
382 my ($format, $frm) = @_;
384 my $lib_check=$formats{$frm}{'libcheck'};
385 my $inc_check=$formats{$frm}{'inccheck'};
390 push(@l, grep_directory($lp,$lib_check));
395 push(@i, $ip) if $inc_check->($ip,$frm);
398 printf("%10s: includes %s - libraries %s\n",$frm,(@i?'found':'not found'),(@l?'found':'not found'));
399 $formats{$frm}{incdir} = \@i;
400 $formats{$frm}{libdir} = \@l;
401 return 1 if scalar(@i && @l);
404 printf("%10s: not available\n", $frm);
413 print " checkformat($frm)\n" if $VERBOSE;
415 my $format = $formats{$frm};
418 if (my $code = $format->{'code'}) {
419 if (ref $code eq 'ARRAY') {
420 push @probes, @$code;
426 push @probes, \&_probe_default;
428 print " Calling probe function\n" if $VERBOSE;
430 for my $func (@probes) {
431 if ($func->($format, $frm)) {
439 if ($format->{postcheck}) {
440 print " Calling postcheck function\n" if $VERBOSE;
441 $format->{postcheck}->($format, $frm)
452 print " Include paths:\n";
453 for (@incs) { print $_,"\n"; }
455 @incs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @incs;
458 print "\nLibrary paths:\n";
459 for (@libs) { print $_,"\n"; }
461 @libs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @libs;
466 # Format data initialization
468 # format definition is:
470 # default include path
471 # files needed for include (boolean perl code)
474 # files needed for link (boolean perl code)
475 # object files needed for the format
480 my @definc = qw(/usr/include);
481 @definc{@definc}=(1) x @definc;
484 split(/\Q$Config{path_sep}/, $INCPATH),
485 map _tilde_expand($_), map { split /\Q$Config{path_sep}/ } @incpaths
487 if ($Config{locincpth}) {
488 push @incs, grep -d, split ' ', $Config{locincpth};
490 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
491 push(@incs, split /;/, $ENV{INCLUDE}) if exists $ENV{INCLUDE};
493 if ($Config{incpath}) {
494 push @incs, grep -d, split /\Q$Config{path_sep}/, $Config{incpath};
498 /usr/include/freetype2
499 /usr/local/include/freetype2
500 /usr/local/include/freetype1/freetype
501 /usr/include /usr/local/include /usr/include/freetype
502 /usr/local/include/freetype);
503 if ($Config{ccflags}) {
504 my @hidden = map { /^-I(.*)$/ ? ($1) : () } split ' ', $Config{ccflags};
506 @definc{@hidden} = (1) x @hidden;
509 @libs= ( split(/\Q$Config{path_sep}/,$LIBPATH),
510 map _tilde_expand($_), map { split /\Q$Config{path_sep}/} @libpaths );
511 if ($Config{loclibpth}) {
512 push @libs, grep -d, split ' ', $Config{loclibpth};
515 push @libs, grep -d, qw(/sw/lib), split(/ /, $Config{'libpth'});
516 push @libs, grep -d, split / /, $Config{libspath} if $Config{libspath};
517 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
518 push(@libs, split /;/, $ENV{LIB}) if exists $ENV{LIB};
520 if ($^O eq 'cygwin') {
521 push(@libs, '/usr/lib/w32api') if -d '/usr/lib/w32api';
522 push(@incs, '/usr/include/w32api') if -d '/usr/include/w32api';
524 if ($Config{ldflags}) {
525 # some builds of perl put -Ldir into ldflags without putting it in
526 # loclibpth, let's extract them
527 my @hidden = grep -d, map { /^-L(.*)$/ ? ($1) : () }
528 split ' ', $Config{ldflags};
530 # don't mark them as seen - EU::MM will remove any libraries
531 # it can't find and it doesn't look for -L in ldflags
532 #@deflib{@hidden} = @hidden;
534 push @libs, grep -d, qw(/usr/local/lib);
539 inccheck=>sub { -e catfile($_[0], 'jpeglib.h') },
540 libcheck=>sub { $_[0] eq "libjpeg$aext" or $_ eq "libjpeg.$lext" },
544 In order to use jpeg with this module you need to have libjpeg
545 installed on your computer}
551 inccheck=>sub { -e catfile($_[0], 'tiffio.h') },
552 libcheck=>sub { $_[0] eq "libtiff$aext" or $_ eq "libtiff.$lext" },
556 In order to use tiff with this module you need to have libtiff
557 installed on your computer},
558 postcheck => \&postcheck_tiff,
563 # def=>'HAVE_LIBPNG',
564 # inccheck=>sub { -e catfile($_[0], 'png.h') },
565 # libcheck=>sub { $_[0] eq "libpng$aext" or $_[0] eq "libpng.$lext" },
566 # libfiles=>$^O eq 'MSWin32' ? '-lpng -lzlib' : '-lpng -lz',
569 # Png stands for Portable Network Graphics and is intended as
570 # a replacement for gif on the web. It is patent free and
571 # is recommended by the w3c, you need libpng to use these formats},
572 # code => \&png_probe,
577 # def=>'HAVE_LIBGIF',
578 # inccheck=>sub { -e catfile($_[0], 'gif_lib.h') },
579 # libcheck=>sub { $_[0] eq "libgif$aext" or $_[0] eq "libgif.$lext" },
583 # gif is the de facto standard for webgraphics at the moment,
584 # it does have some patent problems. If you have giflib and
585 # are not in violation with the unisys patent you should use
586 # this instead of the 'ungif' option. Note that they cannot
587 # be in use at the same time}
590 # $formats{'ungif'}={
592 # def=>'HAVE_LIBGIF',
593 # inccheck=>sub { -e catfile($_[0], 'gif_lib.h') },
594 # libcheck=>sub { $_[0] eq "libungif$aext" or $_[0] eq "libungif.$lext" },
595 # libfiles=>'-lungif',
598 # gif is the de facto standard for webgraphics at the moment,
599 # it does have some patent problems. If you have libungif and
600 # want to create images free from LZW patented compression you
601 # should use this option instead of the 'gif' option}
604 $formats{'T1-fonts'}={
607 inccheck=>sub { -e catfile($_[0], 't1lib.h') },
608 libcheck=>sub { $_[0] eq "libt1$aext" or $_[0] eq "libt1.$lext" },
612 postscript t1 fonts are scalable fonts. They can include
613 ligatures and kerning information and generally yield good
614 visual quality. We depend on libt1 to rasterize the fonts
618 $formats{'TT-fonts'}=
622 inccheck=>sub { -e catfile($_[0], 'freetype.h')
623 && !-e catfile($_[0], 'fterrors.h') },
624 libcheck=>sub { $_[0] eq "libttf$aext" or $_[0] eq "libttf.$lext" },
627 code => \&freetype1_probe,
629 Truetype fonts are scalable fonts. They can include
630 kerning and hinting information and generally yield good
631 visual quality esp on low resultions. The freetype library is
632 used to rasterize for us. The only drawback is that there
633 are alot of badly designed fonts out there.}
638 inccheck=>sub { -e catfile($_[0], 'windows.h') },
639 libcheck=>sub { lc $_[0] eq 'gdi32.lib'
640 || lc $_[0] eq 'libgdi32.a' },
641 libfiles=>$^O eq 'cygwin' ? '-lgdi32' : '',
644 Uses the Win32 GDI for rendering text.
646 This currently only works on under normal Win32 and cygwin.
649 $formats{'freetype2'} =
653 # we always use a probe function
654 #inccheck=>sub { -e catfile($_[0], 'ft2build.h') },
655 #libcheck=>sub { $_[0] eq "libfreetype$aext" or $_[0] eq "libfreetype.$lext" },
656 libfiles=>'-lfreetype',
657 objfiles=>'freetyp2.o',
659 Freetype 2 supports both Truetype and Type 1 fonts, both of which are
660 scalable. It also supports a variety of other fonts.
664 \&freetype2_probe_ftconfig,
665 \&freetype2_probe_scan
670 for (keys %formats) { $formats{$_}->{docs} =~ s/^\s+/ /mg; }
677 defined($V) ? $V : "";
681 # Get information from environment variables
693 $DFLAGS) = map { gen $_ } qw(IM_VERBOSE
705 # populate the environment so that sub-modules get the same info
707 $ENV{IM_VERBOSE} = 1 if $VERBOSE;
708 $ENV{IM_INCPATH} = join $Config{path_sep}, @incpaths if @incpaths;
709 $ENV{IM_LIBPATH} = join $Config{path_sep}, @libpaths if @libpaths;
715 open CONFIG, "> imconfig.h"
716 or die "Cannot create imconfig.h: $!\n";
718 /* This file is automatically generated by Makefile.PL.
719 Don't edit this file, since any changes will be lost */
721 #ifndef IMAGER_IMCONFIG_H
722 #define IMAGER_IMCONFIG_H
724 for my $define (@$defines) {
726 print CONFIG "\n/*\n $define->[2]\n*/\n\n";
728 print CONFIG "#define $define->[0] $define->[1]\n";
730 print CONFIG "\n#endif\n";
734 # use pkg-config to probe for libraries
735 # works around the junk that pkg-config dumps on FreeBSD
739 is_exe('pkg-config') or return;
741 my $redir = $^O eq 'MSWin32' ? '' : '2>/dev/null';
743 !system("pkg-config $pkg --exists $redir");
746 # probes for freetype1 by scanning @incs for the includes and
747 # @libs for the libs. This is done separately because freetype's headers
748 # are stored in a freetype or freetype1 directory under PREFIX/include.
750 # we could find the files with the existing mechanism, but it won't set
751 # -I flags correctly.
753 # This could be extended to freetype2 too, but freetype-config catches
755 sub freetype1_probe {
756 my ($frm, $frmkey) = @_;
760 for my $inc (@incs) {
761 for my $subdir (qw/freetype freetype1/) {
762 my $path = File::Spec->catfile($inc, $subdir, 'freetype.h');
764 $path = File::Spec->catfile($inc, $subdir, 'fterrors.h');
767 $found_inc = File::Spec->catdir($inc, $subdir);
774 for my $lib (@libs) {
775 my $a_path = File::Spec->catfile($lib, "libttf$aext");
776 my $l_path = File::Spec->catfile($lib, "libttf.$lext");
777 if (-e $a_path || -e $l_path) {
783 return unless $found_inc && $found_lib;
784 printf("%10s: includes %s - libraries %s\n", $frmkey,
785 ($found_inc ? 'found' : 'not found'),
786 ($found_lib ? 'found' : 'not found'));
788 $frm->{cflags} = "-I$found_inc";
789 $frm->{libfiles} = "-lttf";
794 # probes for freetype2 by trying to run freetype-config
795 sub freetype2_probe_ftconfig {
796 my ($frm, $frmkey) = @_;
798 is_exe('freetype-config') or return;
800 my $cflags = `freetype-config --cflags`
804 my $lflags = `freetype-config --libs`
808 # before 2.1.5 freetype-config --cflags could output
809 # the -I options in the wrong order, causing a conflict with
810 # freetype1.x installed with the same --prefix
813 # - both -Iprefix/include and -Iprefix/include/freetype2 are in cflags
815 # - freetype 1.x headers are in prefix/include/freetype
816 my @incdirs = map substr($_, 2), grep /^-I/, split ' ', $cflags;
818 && $incdirs[1] eq "$incdirs[0]/freetype2"
819 && -e "$incdirs[0]/freetype/freetype.h"
820 && -e "$incdirs[0]/freetype/fterrid.h") {
821 print "** freetype-config provided -I options out of order, correcting\n"
823 $cflags = join(' ', grep(!/-I/, split ' ', $cflags),
824 map "-I$_", reverse @incdirs);
826 $frm->{cflags} = $cflags;
827 $frm->{lflags} = $lflags;
829 printf "%10s: configured via freetype-config\n", $frmkey;
834 # attempt to probe for freetype2 by scanning directories
835 # we can't use the normal scan since we need to find the directory
836 # containing most of the includes
837 sub freetype2_probe_scan {
838 my ($frm, $frmkey) = @_;
843 for my $inc (@incs) {
844 my $path = File::Spec->catfile($inc, 'ft2build.h');
847 # try to find what it's including
849 open FT2BUILD, "< $path"
852 if (m!^\s*\#\s*include\s+<([\w/.]+)>!
853 || m!^\s*\#\s*include\s+"([\w/.]+)"!) {
861 # non-Unix installs put this directly under the same directory in
863 if (-e File::Spec->catfile($inc, $ftheader)) {
867 for my $subdir (qw/freetype2 freetype/) {
868 $path = File::Spec->catfile($inc, $subdir, 'fterrors.h');
872 $found_inc2 = File::Spec->catdir($inc, $subdir);
879 for my $lib (@libs) {
880 my $a_path = File::Spec->catfile($lib, "libfreetype$aext");
881 my $l_path = File::Spec->catfile($lib, "libfreetype.$lext");
882 if (-e $a_path || -e $l_path) {
888 printf("%10s: includes %s - libraries %s\n", $frmkey,
889 ($found_inc ? 'found' : 'not found'),
890 ($found_lib ? 'found' : 'not found'));
892 return unless $found_inc && $found_lib;
894 $frm->{cflags} = _make_I($found_inc);
895 $frm->{cflags} .= " " . _make_I($found_inc2) if $found_inc2;
896 $frm->{libfiles} = "-lfreetype";
907 $inc_dir =~ / / ? qq!-I"$inc_dir"! : "-I$inc_dir";
910 # probes for libpng via pkg-config
912 my ($frm, $frmkey) = @_;
914 is_exe('pkg-config') or return;
917 for my $check_conf (qw(libpng libpng12 libpng10)) {
918 if (_pkg_probe($check_conf)) {
919 $config = $check_conf;
925 my $cflags = `pkg-config $config --cflags`
928 my $lflags = `pkg-config $config --libs`
933 $frm->{cflags} = $cflags;
934 $frm->{lflags} = $lflags;
936 printf "%10s: configured via `pkg-config $config ...`\n", $frmkey;
942 return File::Spec->catfile(@_);
948 my @exe_suffix = $Config{_exe};
949 if ($^O eq 'MSWin32') {
950 push @exe_suffix, qw/.bat .cmd/;
953 for my $dir (File::Spec->path) {
954 for my $suffix (@exe_suffix) {
955 -x catfile($dir, "$name$suffix")
965 Usage: $0 [--enable feature1,feature2,...] [other options]
966 $0 [--disable feature1,feature2,...] [other options]
968 Possible feature names are:
969 jpeg tiff T1-fonts TT-fonts freetype2
972 Verbose library probing (or set IM_VERBOSE in the environment)
974 Disable logging (or set IM_NOLOG in the environment)
976 Add to the include search path
978 Add to the library search path
980 Build for coverage testing.
982 Build with assertions active.
984 Disable EXIF parsing.
990 # generate the PM MM argument
991 # I'd prefer to modify the public version, but there doesn't seem to be
992 # a public API to do that
995 my $instbase = '$(INST_LIBDIR)';
997 # first the basics, .pm and .pod files
998 $pm{"Imager.pm"} = "$instbase/Imager.pm";
1000 my $mani = maniread();
1002 for my $filename (keys %$mani) {
1003 if ($filename =~ m!^lib/! && $filename =~ /\.(pm|pod)$/) {
1004 (my $work = $filename) =~ s/^lib//;
1005 $pm{$filename} = $instbase . $work;
1010 $pm{typemap} = $instbase . '/Imager/typemap';
1012 # and the core headers
1013 for my $filename (keys %$mani) {
1014 if ($filename =~ /^\w+\.h$/) {
1015 $pm{$filename} = $instbase . '/Imager/include/' . $filename;
1019 # and the generated header
1020 $pm{"imconfig.h"} = $instbase . '/Imager/include/imconfig.h';
1029 if ($path =~ m!^~[/\\]!) {
1030 defined $home or $home = $ENV{HOME};
1031 if (!defined $home && $^O eq 'MSWin32'
1032 && defined $ENV{HOMEDRIVE} && defined $ENV{HOMEPATH}) {
1033 $home = $ENV{HOMEDRIVE} . $ENV{HOMEPATH};
1035 unless (defined $home) {
1036 $home = eval { (getpwuid($<))[7] };
1038 defined $home or die "You supplied $path, but I can't find your home directory\n";
1040 $path = File::Spec->catdir($home, $path);
1046 sub postcheck_tiff {
1047 my ($format, $frm) = @_;
1049 -d "probe" or mkdir "probe";
1051 my $tiffver_name = "probe/tiffver.txt";
1054 if ($Config{cc} =~ /\b(cl|bcc)\b/) {
1061 # setup LD_RUN_PATH to match link time
1062 my $lopts = join " " , map("-L$_", @{$format->{libdir}}), " -ltiff";
1063 my ($extra, $bs_load, $ld_load, $ld_run_path) =
1064 ExtUtils::Liblist->ext($lopts, $VERBOSE);
1065 local $ENV{LD_RUN_PATH};
1068 print "Setting LD_RUN_PATH=$ld_run_path for TIFF probe\n" if $VERBOSE;
1069 $ENV{LD_RUN_PATH} = $ld_run_path;
1077 incpath => $format->{incdir},
1078 libpath => $format->{libdir},
1080 header => [ qw(stdio.h tiffio.h) ],
1081 function => <<FUNCTION,
1083 const char *vers = TIFFGetVersion();
1084 FILE *f = fopen("$tiffver_name", "wb");
1097 unless ($good && -s $tiffver_name
1098 && open(VERS, "< $tiffver_name")) {
1099 unlink $tiffver_name unless $KEEP_FILES;
1101 **tiff: cannot determine libtiff version number
1107 # version file seems to be there, load it up
1108 my $ver_str = do { local $/; <VERS> };
1110 unlink $tiffver_name unless $KEEP_FILES;
1112 my ($version) = $ver_str =~ /(\d+\.\d+\.\d+)/;
1114 if ($version eq '3.9.0') {
1116 **tiff: libtiff 3.9.0 introduced a serious bug, please install 3.9.1
1125 # This isn't a module, but some broken tools, like
1126 # Module::Depends::Instrusive insist on treating it like one.
1128 # http://rt.cpan.org/Public/Bug/Display.html?id=21229