3 use ExtUtils::MakeMaker;
8 use ExtUtils::Manifest qw(maniread);
9 use vars qw(%formats $VERBOSE $INCPATH $LIBPATH $NOLOG $DEBUG_MALLOC $MANUAL $CFLAGS $LFLAGS $DFLAGS);
14 # IM_INCPATH colon seperated list of paths to extra include paths
15 # IM_LIBPATH colon seperated list of paths to extra library paths
17 # IM_VERBOSE turns on verbose mode for the library finding and such
18 # IM_MANUAL to manually select which libraries are used and which not
19 # IM_ENABLE to programmatically select which libraries are used
21 # IM_NOLOG if true logging will not be compiled into the module
22 # IM_DEBUG_MALLOC if true malloc debbuging will be compiled into the module
23 # do not use IM_DEBUG_MALLOC in production - this slows
24 # everything down by alot
25 # IM_CFLAGS Extra flags to pass to the compiler
26 # IM_LFLAGS Extra flags to pass to the linker
27 # IM_DFLAGS Extra flags to pass to the preprocessor
29 my $KEEP_FILES = $ENV{IMAGER_KEEP_FILES};
31 getenv(); # get environment variables
33 my $lext=$Config{'so'}; # Get extensions of libraries
34 my $aext=$Config{'_a'};
36 my $help; # display help if set
37 my @enable; # list of drivers to enable
38 my @disable; # or list of drivers to disable
39 my @incpaths; # places to look for headers
40 my @libpaths; # places to look for libraries
41 my $noexif; # non-zero to disable EXIF parsing of JPEGs
42 my $no_gif_set_version; # disable calling EGifSetGifVersion
43 my $coverage; # build for coverage testing
44 GetOptions("help" => \$help,
45 "enable=s" => \@enable,
46 "disable=s" => \@disable,
47 "incpath=s", \@incpaths,
48 "libpath=s" => \@libpaths,
49 "verbose|v" => \$VERBOSE,
52 "nogifsetversion" => \$no_gif_set_version,
53 'coverage' => \$coverage);
56 print "Verbose mode\n";
58 import Data::Dumper qw(Dumper);
67 if ($NOLOG) { print "Logging not compiled into module\n"; }
69 push @defines, [ IMAGER_LOG => 1, "Logging system" ];
73 push @defines, [ IMAGER_DEBUG_MALLOC => 1, "Use Imager's DEBUG malloc()" ];
74 print "Malloc debugging enabled\n";
77 if (@enable && @disable) {
78 print STDERR "Only --enable or --disable can be used, not both, try --help\n";
84 my @incs; # all the places to look for headers
85 my @libs; # all the places to look for libraries
87 init(); # initialize global data
88 pathcheck(); # Check if directories exist
90 if (exists $ENV{IM_ENABLE}) {
91 my %en = map { $_, 1 } split ' ', $ENV{IM_ENABLE};
92 for my $key (keys %formats) {
93 delete $formats{$key} unless $en{$key};
97 my %en = map { $_ => 1 } map { split /,/ } @enable;
98 for my $key (keys %formats) {
99 delete $formats{$key} unless $en{$key};
103 delete @formats{map { split /,/ } @disable};
106 # Pick what libraries are used
113 # Make sure there isn't a clash between the gif libraries.
120 for my $frmkey (sort { $formats{$a}{order} <=> $formats{$b}{order} } keys %formats) {
121 my $frm = $formats{$frmkey};
122 push @defines, [ $frm->{def}, 1, "$frmkey available" ];
123 $F_OBJECT .= ' ' .$frm->{objfiles};
124 if ($frm->{cflags}) {
125 $lib_cflags .= ' ' .$frm->{cflags};
126 ++$definc{$_} for map { /^-I(.*)$/ ? ($1) : () }
127 grep /^-I./, split ' ', $frm->{cflags};
129 if ($frm->{lflags}) {
130 $lib_lflags .= ' ' . $frm->{lflags};
133 $F_LIBS .= ' ' .$frm->{libfiles};
139 print "EXIF support enabled\n";
140 push @defines, [ 'IMEXIF_ENABLE', 1, "Enable experimental EXIF support" ];
141 $F_OBJECT .= ' imexif.o';
144 my $F_INC = join ' ', map "-I$_", map / / ? qq{"$_"} : $_,
145 grep !$definc{$_}, @incs;
146 $F_LIBS = join(' ',map "-L$_", map / / ? qq{"$_"} : $_,
147 grep !$deflib{$_}++, @libs) . $F_LIBS;
150 my $OSDEF = "-DOS_$^O";
152 if ($^O eq 'hpux') { $OSLIBS .= ' -ldld'; }
153 if (defined $Config{'d_dlsymun'}) { $OSDEF .= ' -DDLSYMUN'; }
155 my @objs = qw(Imager.o draw.o polygon.o image.o io.o iolayer.o
156 log.o gaussian.o conv.o pnm.o raw.o feat.o font.o
157 filters.o dynaload.o stackmach.o datatypes.o
158 regmach.o trans2.o quant.o error.o convert.o
159 map.o tags.o palimg.o maskimg.o img16.o rotate.o
160 bmp.o tga.o color.o fills.o imgdouble.o limits.o hlines.o
161 imext.o scale.o rubthru.o render.o paste.o compose.o);
165 'VERSION_FROM' => 'Imager.pm',
166 'LIBS' => "$LFLAGS -lm $lib_lflags $OSLIBS $F_LIBS",
167 'DEFINE' => "$OSDEF $CFLAGS",
168 'INC' => "$lib_cflags $DFLAGS $F_INC",
169 'OBJECT' => join(' ', @objs, $F_OBJECT),
170 clean => { FILES=>'testout rubthru.c scale.c conv.c filters.c gaussian.c render.c rubthru.c' },
172 PREREQ_PM => { 'Test::More' => 0.47 },
176 if ($Config{gccversion}) {
177 push @ARGV, 'OPTIMIZE=-ftest-coverage -fprofile-arcs';
178 #$opts{dynamic_lib} = { OTHERLDFLAGS => '-ftest-coverage -fprofile-arcs' };
181 die "Don't know the coverage C flags for your compiler\n";
185 # eval to prevent warnings about versions with _ in them
186 my $MM_ver = eval $ExtUtils::MakeMaker::VERSION;
187 if ($MM_ver > 6.06) {
188 $opts{AUTHOR} = 'Tony Cook <tony@imager.perl.org>, Arnar M. Hrafnkelsson';
189 $opts{ABSTRACT} = 'Perl extension for Generating 24 bit Images';
192 if ($MM_ver >= 6.46) {
197 "Parse::RecDescent" => 0
204 make_imconfig(\@defines);
206 if ($VERBOSE) { print Dumper(\%opts); }
207 mkdir('testout',0777); # since we cannot include it in the archive.
209 -d "probe" and rmdir "probe";
211 WriteMakefile(%opts);
218 my $perl = $self->{PERLRUN} ? '$(PERLRUN)' : '$(PERL)';
221 my @ims = grep /\.im$/, keys %$mani;
223 dyntest.$(MYEXTLIB) : dynfilt/Makefile
224 cd dynfilt && $(MAKE) $(PASTHRU)
226 lib/Imager/Regops.pm : regmach.h regops.perl
227 $(PERL) regops.perl regmach.h lib/Imager/Regops.pm
229 imconfig.h : Makefile.PL
230 $(ECHO) "imconfig.h out-of-date with respect to $?"
231 $(PERLRUN) Makefile.PL
232 $(ECHO) "==> Your Makefile has been rebuilt - re-run your make command <=="
234 lib/Imager/APIRef.pod : \$(C_FILES) \$(H_FILES) apidocs.perl
235 $perl apidocs.perl lib/Imager/APIRef.pod
237 !.join('', map _im_rule($perl, $_), @ims)
242 my ($perl, $im) = @_;
244 (my $c = $im) =~ s/\.im$/.c/;
247 $c: $im lib/Imager/Preprocess.pm
248 $perl -Ilib -MImager::Preprocess -epreprocess $im $c
254 # manual configuration of helper libraries
259 Please answer the following questions about
260 which formats are avaliable on your computer
262 press <return> to continue
265 <STDIN>; # eat one return
267 for my $frm(sort { $formats{$b}{order} <=> $formats{$a}{order} } keys %formats) {
269 if ($formats{$frm}{docs}) { print "\n",$formats{$frm}{docs},"\n\n"; }
270 print "Enable $frm support: ";
273 if ($gz =~ m/^(y|yes|n|no)/i) {
274 $gz=substr(lc($gz),0,1);
276 delete $formats{$frm};
283 # automatic configuration of helper libraries
286 print "Automatic probing:\n" if $VERBOSE;
287 for my $frm (sort { $formats{$a}{order} <=> $formats{$b}{order} } keys %formats) {
288 delete $formats{$frm} if !checkformat($frm);
294 if ($formats{'gif'} and $formats{'ungif'}) {
295 print "ungif and gif can not coexist - removing ungif support\n";
296 delete $formats{'ungif'};
299 for my $frm (qw(gif ungif)) {
300 checkformat($frm) if ($MANUAL and $formats{$frm});
304 for my $frm (grep $formats{$_}, qw(gif ungif)) {
305 push(@dirs, @{$formats{$frm}{incdir}}) if $formats{$frm}{incdir};
309 FILES: for my $dir (@dirs) {
310 my $h = "$dir/gif_lib.h";
311 open H, "< $h" or next;
313 if (/GIF_LIB_VERSION\s+"\s*version\s*(\d+)\.(\d+)/i) {
323 # we need the version in a #ifdefable form
325 push @defines, [ IM_GIFMAJOR => $major, "Parsed giflib version" ];
326 push @defines, [ IM_GIFMINOR => $minor ];
327 push @defines, [ IM_NO_SET_GIF_VERSION => 1, "Disable EGifSetGifVersion" ]
328 if $no_gif_set_version;
335 # print "checking path $path\n";
336 if ( !opendir(DH,$path) ) {
337 warn "Cannot open dir $path: $!\n";
340 my @l=grep { $chk->($_) } readdir(DH);
343 return map $path, @l;
347 my ($format, $frm) = @_;
349 my $lib_check=$formats{$frm}{'libcheck'};
350 my $inc_check=$formats{$frm}{'inccheck'};
355 push(@l, grep_directory($lp,$lib_check));
360 push(@i, $ip) if $inc_check->($ip,$frm);
363 printf("%10s: includes %s - libraries %s\n",$frm,(@i?'found':'not found'),(@l?'found':'not found'));
364 $formats{$frm}{incdir} = \@i;
365 $formats{$frm}{libdir} = \@l;
366 return 1 if scalar(@i && @l);
369 printf("%10s: not available\n", $frm);
378 print " checkformat($frm)\n" if $VERBOSE;
380 my $format = $formats{$frm};
383 if (my $code = $format->{'code'}) {
384 if (ref $code eq 'ARRAY') {
385 push @probes, @$code;
391 push @probes, \&_probe_default;
393 print " Calling probe function\n" if $VERBOSE;
395 for my $func (@probes) {
396 if ($func->($format, $frm)) {
404 if ($format->{postcheck}) {
405 print " Calling postcheck function\n" if $VERBOSE;
406 $format->{postcheck}->($format, $frm)
417 print " Include paths:\n";
418 for (@incs) { print $_,"\n"; }
420 @incs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @incs;
423 print "\nLibrary paths:\n";
424 for (@libs) { print $_,"\n"; }
426 @libs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @libs;
431 # Format data initialization
433 # format definition is:
435 # default include path
436 # files needed for include (boolean perl code)
439 # files needed for link (boolean perl code)
440 # object files needed for the format
445 my @definc = qw(/usr/include);
446 @definc{@definc}=(1) x @definc;
449 split(/\Q$Config{path_sep}/, $INCPATH),
450 map _tilde_expand($_), map { split /\Q$Config{path_sep}/ } @incpaths
452 if ($Config{locincpth}) {
453 push @incs, grep -d, split ' ', $Config{locincpth};
455 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
456 push(@incs, split /;/, $ENV{INCLUDE}) if exists $ENV{INCLUDE};
458 if ($Config{incpath}) {
459 push @incs, grep -d, split /\Q$Config{path_sep}/, $Config{incpath};
463 /usr/include/freetype2
464 /usr/local/include/freetype2
465 /usr/local/include/freetype1/freetype
466 /usr/include /usr/local/include /usr/include/freetype
467 /usr/local/include/freetype);
468 if ($Config{ccflags}) {
469 my @hidden = map { /^-I(.*)$/ ? ($1) : () } split ' ', $Config{ccflags};
471 @definc{@hidden} = (1) x @hidden;
474 @libs= ( split(/\Q$Config{path_sep}/,$LIBPATH),
475 map _tilde_expand($_), map { split /\Q$Config{path_sep}/} @libpaths );
476 if ($Config{loclibpth}) {
477 push @libs, grep -d, split ' ', $Config{loclibpth};
480 push @libs, grep -d, qw(/sw/lib), split(/ /, $Config{'libpth'});
481 push @libs, grep -d, split / /, $Config{libspath} if $Config{libspath};
482 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
483 push(@libs, split /;/, $ENV{LIB}) if exists $ENV{LIB};
485 if ($^O eq 'cygwin') {
486 push(@libs, '/usr/lib/w32api') if -d '/usr/lib/w32api';
487 push(@incs, '/usr/include/w32api') if -d '/usr/include/w32api';
489 if ($Config{ldflags}) {
490 # some builds of perl put -Ldir into ldflags without putting it in
491 # loclibpth, let's extract them
492 my @hidden = grep -d, map { /^-L(.*)$/ ? ($1) : () }
493 split ' ', $Config{ldflags};
495 # don't mark them as seen - EU::MM will remove any libraries
496 # it can't find and it doesn't look for -L in ldflags
497 #@deflib{@hidden} = @hidden;
499 push @libs, grep -d, qw(/usr/local/lib);
504 inccheck=>sub { -e catfile($_[0], 'jpeglib.h') },
505 libcheck=>sub { $_[0] eq "libjpeg$aext" or $_ eq "libjpeg.$lext" },
509 In order to use jpeg with this module you need to have libjpeg
510 installed on your computer}
516 inccheck=>sub { -e catfile($_[0], 'tiffio.h') },
517 libcheck=>sub { $_[0] eq "libtiff$aext" or $_ eq "libtiff.$lext" },
521 In order to use tiff with this module you need to have libtiff
522 installed on your computer},
523 postcheck => \&postcheck_tiff,
529 inccheck=>sub { -e catfile($_[0], 'png.h') },
530 libcheck=>sub { $_[0] eq "libpng$aext" or $_[0] eq "libpng.$lext" },
531 libfiles=>$^O eq 'MSWin32' ? '-lpng -lzlib' : '-lpng -lz',
534 Png stands for Portable Network Graphics and is intended as
535 a replacement for gif on the web. It is patent free and
536 is recommended by the w3c, you need libpng to use these formats},
543 inccheck=>sub { -e catfile($_[0], 'gif_lib.h') },
544 libcheck=>sub { $_[0] eq "libgif$aext" or $_[0] eq "libgif.$lext" },
548 gif is the de facto standard for webgraphics at the moment,
549 it does have some patent problems. If you have giflib and
550 are not in violation with the unisys patent you should use
551 this instead of the 'ungif' option. Note that they cannot
552 be in use at the same time}
558 inccheck=>sub { -e catfile($_[0], 'gif_lib.h') },
559 libcheck=>sub { $_[0] eq "libungif$aext" or $_[0] eq "libungif.$lext" },
563 gif is the de facto standard for webgraphics at the moment,
564 it does have some patent problems. If you have libungif and
565 want to create images free from LZW patented compression you
566 should use this option instead of the 'gif' option}
569 $formats{'T1-fonts'}={
572 inccheck=>sub { -e catfile($_[0], 't1lib.h') },
573 libcheck=>sub { $_[0] eq "libt1$aext" or $_[0] eq "libt1.$lext" },
577 postscript t1 fonts are scalable fonts. They can include
578 ligatures and kerning information and generally yield good
579 visual quality. We depend on libt1 to rasterize the fonts
583 $formats{'TT-fonts'}=
587 inccheck=>sub { -e catfile($_[0], 'freetype.h')
588 && !-e catfile($_[0], 'fterrors.h') },
589 libcheck=>sub { $_[0] eq "libttf$aext" or $_[0] eq "libttf.$lext" },
592 code => \&freetype1_probe,
594 Truetype fonts are scalable fonts. They can include
595 kerning and hinting information and generally yield good
596 visual quality esp on low resultions. The freetype library is
597 used to rasterize for us. The only drawback is that there
598 are alot of badly designed fonts out there.}
603 inccheck=>sub { -e catfile($_[0], 'windows.h') },
604 libcheck=>sub { lc $_[0] eq 'gdi32.lib'
605 || lc $_[0] eq 'libgdi32.a' },
606 libfiles=>$^O eq 'cygwin' ? '-lgdi32' : '',
609 Uses the Win32 GDI for rendering text.
611 This currently only works on under normal Win32 and cygwin.
614 $formats{'freetype2'} =
618 # we always use a probe function
619 #inccheck=>sub { -e catfile($_[0], 'ft2build.h') },
620 #libcheck=>sub { $_[0] eq "libfreetype$aext" or $_[0] eq "libfreetype.$lext" },
621 libfiles=>'-lfreetype',
622 objfiles=>'freetyp2.o',
624 Freetype 2 supports both Truetype and Type 1 fonts, both of which are
625 scalable. It also supports a variety of other fonts.
629 \&freetype2_probe_ftconfig,
630 \&freetype2_probe_scan
635 for (keys %formats) { $formats{$_}->{docs} =~ s/^\s+/ /mg; }
642 defined($V) ? $V : "";
646 # Get information from environment variables
658 $DFLAGS) = map { gen $_ } qw(IM_VERBOSE
673 open CONFIG, "> imconfig.h"
674 or die "Cannot create imconfig.h: $!\n";
676 /* This file is automatically generated by Makefile.PL.
677 Don't edit this file, since any changes will be lost */
679 #ifndef IMAGER_IMCONFIG_H
680 #define IMAGER_IMCONFIG_H
682 for my $define (@$defines) {
684 print CONFIG "\n/*\n $define->[2]\n*/\n\n";
686 print CONFIG "#define $define->[0] $define->[1]\n";
688 print CONFIG "\n#endif\n";
692 # use pkg-config to probe for libraries
693 # works around the junk that pkg-config dumps on FreeBSD
697 is_exe('pkg-config') or return;
699 my $redir = $^O eq 'MSWin32' ? '' : '2>/dev/null';
701 !system("pkg-config $pkg --exists $redir");
704 # probes for freetype1 by scanning @incs for the includes and
705 # @libs for the libs. This is done separately because freetype's headers
706 # are stored in a freetype or freetype1 directory under PREFIX/include.
708 # we could find the files with the existing mechanism, but it won't set
709 # -I flags correctly.
711 # This could be extended to freetype2 too, but freetype-config catches
713 sub freetype1_probe {
714 my ($frm, $frmkey) = @_;
718 for my $inc (@incs) {
719 for my $subdir (qw/freetype freetype1/) {
720 my $path = File::Spec->catfile($inc, $subdir, 'freetype.h');
722 $path = File::Spec->catfile($inc, $subdir, 'fterrors.h');
725 $found_inc = File::Spec->catdir($inc, $subdir);
732 for my $lib (@libs) {
733 my $a_path = File::Spec->catfile($lib, "libttf$aext");
734 my $l_path = File::Spec->catfile($lib, "libttf.$lext");
735 if (-e $a_path || -e $l_path) {
741 return unless $found_inc && $found_lib;
742 printf("%10s: includes %s - libraries %s\n", $frmkey,
743 ($found_inc ? 'found' : 'not found'),
744 ($found_lib ? 'found' : 'not found'));
746 $frm->{cflags} = "-I$found_inc";
747 $frm->{libfiles} = "-lttf";
752 # probes for freetype2 by trying to run freetype-config
753 sub freetype2_probe_ftconfig {
754 my ($frm, $frmkey) = @_;
756 is_exe('freetype-config') or return;
758 my $cflags = `freetype-config --cflags`
762 my $lflags = `freetype-config --libs`
766 # before 2.1.5 freetype-config --cflags could output
767 # the -I options in the wrong order, causing a conflict with
768 # freetype1.x installed with the same --prefix
771 # - both -Iprefix/include and -Iprefix/include/freetype2 are in cflags
773 # - freetype 1.x headers are in prefix/include/freetype
774 my @incdirs = map substr($_, 2), grep /^-I/, split ' ', $cflags;
776 && $incdirs[1] eq "$incdirs[0]/freetype2"
777 && -e "$incdirs[0]/freetype/freetype.h"
778 && -e "$incdirs[0]/freetype/fterrid.h") {
779 print "** freetype-config provided -I options out of order, correcting\n"
781 $cflags = join(' ', grep(!/-I/, split ' ', $cflags),
782 map "-I$_", reverse @incdirs);
784 $frm->{cflags} = $cflags;
785 $frm->{lflags} = $lflags;
787 printf "%10s: configured via freetype-config\n", $frmkey;
792 # attempt to probe for freetype2 by scanning directories
793 # we can't use the normal scan since we need to find the directory
794 # containing most of the includes
795 sub freetype2_probe_scan {
796 my ($frm, $frmkey) = @_;
801 for my $inc (@incs) {
802 my $path = File::Spec->catfile($inc, 'ft2build.h');
805 # try to find what it's including
807 open FT2BUILD, "< $path"
810 if (m!^\s*\#\s*include\s+<([\w/.]+)>!
811 || m!^\s*\#\s*include\s+"([\w/.]+)"!) {
819 # non-Unix installs put this directly under the same directory in
821 if (-e File::Spec->catfile($inc, $ftheader)) {
825 for my $subdir (qw/freetype2 freetype/) {
826 $path = File::Spec->catfile($inc, $subdir, 'fterrors.h');
830 $found_inc2 = File::Spec->catdir($inc, $subdir);
837 for my $lib (@libs) {
838 my $a_path = File::Spec->catfile($lib, "libfreetype$aext");
839 my $l_path = File::Spec->catfile($lib, "libfreetype.$lext");
840 if (-e $a_path || -e $l_path) {
846 printf("%10s: includes %s - libraries %s\n", $frmkey,
847 ($found_inc ? 'found' : 'not found'),
848 ($found_lib ? 'found' : 'not found'));
850 return unless $found_inc && $found_lib;
852 $frm->{cflags} = _make_I($found_inc);
853 $frm->{cflags} .= " " . _make_I($found_inc2) if $found_inc2;
854 $frm->{libfiles} = "-lfreetype";
865 $inc_dir =~ / / ? qq!-I"$inc_dir"! : "-I$inc_dir";
868 # probes for libpng via pkg-config
870 my ($frm, $frmkey) = @_;
872 is_exe('pkg-config') or return;
875 for my $check_conf (qw(libpng libpng12 libpng10)) {
876 if (_pkg_probe($check_conf)) {
877 $config = $check_conf;
883 my $cflags = `pkg-config $config --cflags`
886 my $lflags = `pkg-config $config --libs`
891 $frm->{cflags} = $cflags;
892 $frm->{lflags} = $lflags;
894 printf "%10s: configured via `pkg-config $config ...`\n", $frmkey;
900 return File::Spec->catfile(@_);
906 my @exe_suffix = $Config{_exe};
907 if ($^O eq 'MSWin32') {
908 push @exe_suffix, qw/.bat .cmd/;
911 for my $dir (File::Spec->path) {
912 for my $suffix (@exe_suffix) {
913 -x catfile($dir, "$name$suffix")
923 Usage: $0 [--enable feature1,feature2,...] [other options]
924 $0 [--disable feature1,feature2,...] [other options]
926 Possible feature names are:
927 png gif ungif jpeg tiff T1-fonts TT-fonts freetype2
930 Verbose library probing (or set IM_VERBOSE in the environment)
932 Disable logging (or set IM_NOLOG in the environment)
934 Add to the include search path
936 Add to the library search path
942 # generate the PM MM argument
943 # I'd prefer to modify the public version, but there doesn't seem to be
944 # a public API to do that
947 my $instbase = '$(INST_LIBDIR)';
949 # first the basics, .pm and .pod files
950 $pm{"Imager.pm"} = "$instbase/Imager.pm";
952 my $mani = maniread();
954 for my $filename (keys %$mani) {
955 if ($filename =~ m!^lib/! && $filename =~ /\.(pm|pod)$/) {
956 (my $work = $filename) =~ s/^lib//;
957 $pm{$filename} = $instbase . $work;
962 $pm{typemap} = $instbase . '/Imager/typemap';
964 # and the core headers
965 for my $filename (keys %$mani) {
966 if ($filename =~ /^\w+\.h$/) {
967 $pm{$filename} = $instbase . '/Imager/include/' . $filename;
971 # and the generated header
972 $pm{"imconfig.h"} = $instbase . '/Imager/include/imconfig.h';
981 if ($path =~ m!^~[/\\]!) {
982 defined $home or $home = $ENV{HOME};
983 if (!defined $home && $^O eq 'MSWin32'
984 && defined $ENV{HOMEDRIVE} && defined $ENV{HOMEPATH}) {
985 $home = $ENV{HOMEDRIVE} . $ENV{HOMEPATH};
987 unless (defined $home) {
988 $home = eval { (getpwuid($<))[7] };
990 defined $home or die "You supplied $path, but I can't find your home directory\n";
992 $path = File::Spec->catdir($home, $path);
999 my ($format, $frm) = @_;
1001 -d "probe" or mkdir "probe";
1003 my $tiffver_name = "probe/tiffver.txt";
1006 if ($Config{cc} =~ /\b(cl|bcc)\b/) {
1018 incpath => $format->{incdir},
1019 libpath => $format->{libdir},
1021 header => [ qw(stdio.h tiffio.h) ],
1022 function => <<FUNCTION,
1024 const char *vers = TIFFGetVersion();
1025 FILE *f = fopen("$tiffver_name", "wb");
1038 unless ($good && -s $tiffver_name
1039 && open(VERS, "< probe/tiffver.txt")) {
1040 unlink $tiffver_name unless $KEEP_FILES;
1042 **tiff: cannot determine libtiff version number
1048 # version file seems to be there, load it up
1049 my $ver_str = do { local $/; <VERS> };
1051 unlink $tiffver_name unless $KEEP_FILES;
1053 my ($version) = $ver_str =~ /(\d+\.\d+\.\d+)/;
1055 if ($version eq '3.9.0') {
1057 **tiff: libtiff 3.9.0 introduced a serious bug, please install 3.9.1
1066 # This isn't a module, but some broken tools, like
1067 # Module::Depends::Instrusive insist on treating it like one.
1069 # http://rt.cpan.org/Public/Bug/Display.html?id=21229