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
28 # IM_SUPPRESS_PROMPT Suppress the prompt asking about gif support
30 my $KEEP_FILES = $ENV{IMAGER_KEEP_FILES};
32 getenv(); # get environment variables
34 my $lext=$Config{'so'}; # Get extensions of libraries
35 my $aext=$Config{'_a'};
37 my $help; # display help if set
38 my @enable; # list of drivers to enable
39 my @disable; # or list of drivers to disable
40 my @incpaths; # places to look for headers
41 my @libpaths; # places to look for libraries
42 my $noexif; # non-zero to disable EXIF parsing of JPEGs
43 my $no_gif_set_version; # disable calling EGifSetGifVersion
44 my $coverage; # build for coverage testing
45 GetOptions("help" => \$help,
46 "enable=s" => \@enable,
47 "disable=s" => \@disable,
48 "incpath=s", \@incpaths,
49 "libpath=s" => \@libpaths,
50 "verbose|v" => \$VERBOSE,
53 "nogifsetversion" => \$no_gif_set_version,
54 'coverage' => \$coverage);
57 print "Verbose mode\n";
59 import Data::Dumper qw(Dumper);
68 if ($NOLOG) { print "Logging not compiled into module\n"; }
70 push @defines, [ IMAGER_LOG => 1, "Logging system" ];
74 push @defines, [ IMAGER_DEBUG_MALLOC => 1, "Use Imager's DEBUG malloc()" ];
75 print "Malloc debugging enabled\n";
78 if (@enable && @disable) {
79 print STDERR "Only --enable or --disable can be used, not both, try --help\n";
85 my @incs; # all the places to look for headers
86 my @libs; # all the places to look for libraries
88 init(); # initialize global data
89 pathcheck(); # Check if directories exist
91 if (exists $ENV{IM_ENABLE}) {
92 my %en = map { $_, 1 } split ' ', $ENV{IM_ENABLE};
93 for my $key (keys %formats) {
94 delete $formats{$key} unless $en{$key};
98 my %en = map { $_ => 1 } map { split /,/ } @enable;
99 for my $key (keys %formats) {
100 delete $formats{$key} unless $en{$key};
104 delete @formats{map { split /,/ } @disable};
107 # Pick what libraries are used
114 # Make sure there isn't a clash between the gif libraries.
121 for my $frmkey (sort { $formats{$a}{order} <=> $formats{$b}{order} } keys %formats) {
122 my $frm = $formats{$frmkey};
123 push @defines, [ $frm->{def}, 1, "$frmkey available" ];
124 $F_OBJECT .= ' ' .$frm->{objfiles};
125 if ($frm->{cflags}) {
126 $lib_cflags .= ' ' .$frm->{cflags};
127 ++$definc{$_} for map { /^-I(.*)$/ ? ($1) : () }
128 grep /^-I./, split ' ', $frm->{cflags};
130 if ($frm->{lflags}) {
131 $lib_lflags .= ' ' . $frm->{lflags};
134 $F_LIBS .= ' ' .$frm->{libfiles};
140 print "EXIF support enabled\n";
141 push @defines, [ 'IMEXIF_ENABLE', 1, "Enable experimental EXIF support" ];
142 $F_OBJECT .= ' imexif.o';
145 my $F_INC = join ' ', map "-I$_", map / / ? qq{"$_"} : $_,
146 grep !$definc{$_}, @incs;
147 $F_LIBS = join(' ',map "-L$_", map / / ? qq{"$_"} : $_,
148 grep !$deflib{$_}++, @libs) . $F_LIBS;
151 my $OSDEF = "-DOS_$^O";
153 if ($^O eq 'hpux') { $OSLIBS .= ' -ldld'; }
154 if (defined $Config{'d_dlsymun'}) { $OSDEF .= ' -DDLSYMUN'; }
156 my @objs = qw(Imager.o draw.o polygon.o image.o io.o iolayer.o
157 log.o gaussian.o conv.o pnm.o raw.o feat.o font.o
158 filters.o dynaload.o stackmach.o datatypes.o
159 regmach.o trans2.o quant.o error.o convert.o
160 map.o tags.o palimg.o maskimg.o img16.o rotate.o
161 bmp.o tga.o color.o fills.o imgdouble.o limits.o hlines.o
162 imext.o scale.o rubthru.o render.o paste.o compose.o);
166 'VERSION_FROM' => 'Imager.pm',
167 'LIBS' => "$LFLAGS -lm $lib_lflags $OSLIBS $F_LIBS",
168 'DEFINE' => "$OSDEF $CFLAGS",
169 'INC' => "$lib_cflags $DFLAGS $F_INC",
170 'OBJECT' => join(' ', @objs, $F_OBJECT),
171 clean => { FILES=>'testout rubthru.c scale.c conv.c filters.c gaussian.c render.c rubthru.c' },
173 PREREQ_PM => { 'Test::More' => 0.47 },
177 if ($Config{gccversion}) {
178 push @ARGV, 'OPTIMIZE=-ftest-coverage -fprofile-arcs';
179 #$opts{dynamic_lib} = { OTHERLDFLAGS => '-ftest-coverage -fprofile-arcs' };
182 die "Don't know the coverage C flags for your compiler\n";
186 # eval to prevent warnings about versions with _ in them
187 my $MM_ver = eval $ExtUtils::MakeMaker::VERSION;
188 if ($MM_ver > 6.06) {
189 $opts{AUTHOR} = 'Tony Cook <tony@imager.perl.org>, Arnar M. Hrafnkelsson';
190 $opts{ABSTRACT} = 'Perl extension for Generating 24 bit Images';
193 if ($MM_ver >= 6.46) {
198 "Parse::RecDescent" => 0
205 make_imconfig(\@defines);
207 if ($VERBOSE) { print Dumper(\%opts); }
208 mkdir('testout',0777); # since we cannot include it in the archive.
210 -d "probe" and rmdir "probe";
212 WriteMakefile(%opts);
219 my $perl = $self->{PERLRUN} ? '$(PERLRUN)' : '$(PERL)';
222 my @ims = grep /\.im$/, keys %$mani;
224 dyntest.$(MYEXTLIB) : dynfilt/Makefile
225 cd dynfilt && $(MAKE) $(PASTHRU)
227 lib/Imager/Regops.pm : regmach.h regops.perl
228 $(PERL) regops.perl regmach.h lib/Imager/Regops.pm
230 imconfig.h : Makefile.PL
231 $(ECHO) "imconfig.h out-of-date with respect to $?"
232 $(PERLRUN) Makefile.PL
233 $(ECHO) "==> Your Makefile has been rebuilt - re-run your make command <=="
235 lib/Imager/APIRef.pod : \$(C_FILES) apidocs.perl
236 $perl apidocs.perl lib/Imager/APIRef.pod
238 !.join('', map _im_rule($perl, $_), @ims)
243 my ($perl, $im) = @_;
245 (my $c = $im) =~ s/\.im$/.c/;
248 $c: $im lib/Imager/Preprocess.pm
249 $perl -Ilib -MImager::Preprocess -epreprocess $im $c
255 # manual configuration of helper libraries
260 Please answer the following questions about
261 which formats are avaliable on your computer
263 press <return> to continue
266 <STDIN>; # eat one return
268 for my $frm(sort { $formats{$b}{order} <=> $formats{$a}{order} } keys %formats) {
270 if ($formats{$frm}{docs}) { print "\n",$formats{$frm}{docs},"\n\n"; }
271 print "Enable $frm support: ";
274 if ($gz =~ m/^(y|yes|n|no)/i) {
275 $gz=substr(lc($gz),0,1);
277 delete $formats{$frm};
284 # automatic configuration of helper libraries
287 print "Automatic probing:\n" if $VERBOSE;
288 for my $frm (sort { $formats{$a}{order} <=> $formats{$b}{order} } keys %formats) {
289 delete $formats{$frm} if !checkformat($frm);
295 if ($formats{'gif'} and $formats{'ungif'}) {
296 print "ungif and gif can not coexist - removing ungif support\n";
297 delete $formats{'ungif'};
300 for my $frm (qw(gif ungif)) {
301 checkformat($frm) if ($MANUAL and $formats{$frm});
305 for my $frm (grep $formats{$_}, qw(gif ungif)) {
306 push(@dirs, @{$formats{$frm}{incdir}}) if $formats{$frm}{incdir};
310 FILES: for my $dir (@dirs) {
311 my $h = "$dir/gif_lib.h";
312 open H, "< $h" or next;
314 if (/GIF_LIB_VERSION\s+"\s*version\s*(\d+)\.(\d+)/i) {
324 # we need the version in a #ifdefable form
326 push @defines, [ IM_GIFMAJOR => $major, "Parsed giflib version" ];
327 push @defines, [ IM_GIFMINOR => $minor ];
328 push @defines, [ IM_NO_SET_GIF_VERSION => 1, "Disable EGifSetGifVersion" ]
329 if $no_gif_set_version;
336 # print "checking path $path\n";
337 if ( !opendir(DH,$path) ) {
338 warn "Cannot open dir $path: $!\n";
341 my @l=grep { $chk->($_) } readdir(DH);
344 return map $path, @l;
348 my ($format, $frm) = @_;
350 my $lib_check=$formats{$frm}{'libcheck'};
351 my $inc_check=$formats{$frm}{'inccheck'};
356 push(@l, grep_directory($lp,$lib_check));
361 push(@i, $ip) if $inc_check->($ip,$frm);
364 printf("%10s: includes %s - libraries %s\n",$frm,(@i?'found':'not found'),(@l?'found':'not found'));
365 $formats{$frm}{incdir} = \@i;
366 $formats{$frm}{libdir} = \@l;
367 return 1 if scalar(@i && @l);
370 printf("%10s: not available\n", $frm);
379 print " checkformat($frm)\n" if $VERBOSE;
381 my $format = $formats{$frm};
384 if (my $code = $format->{'code'}) {
385 if (ref $code eq 'ARRAY') {
386 push @probes, @$code;
392 push @probes, \&_probe_default;
394 print " Calling probe function\n" if $VERBOSE;
396 for my $func (@probes) {
397 if ($func->($format, $frm)) {
405 if ($format->{postcheck}) {
406 print " Calling postcheck function\n" if $VERBOSE;
407 $format->{postcheck}->($format, $frm)
418 print " Include paths:\n";
419 for (@incs) { print $_,"\n"; }
421 @incs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @incs;
424 print "\nLibrary paths:\n";
425 for (@libs) { print $_,"\n"; }
427 @libs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @libs;
432 # Format data initialization
434 # format definition is:
436 # default include path
437 # files needed for include (boolean perl code)
440 # files needed for link (boolean perl code)
441 # object files needed for the format
446 my @definc = qw(/usr/include);
447 @definc{@definc}=(1) x @definc;
450 split(/\Q$Config{path_sep}/, $INCPATH),
451 map _tilde_expand($_), map { split /\Q$Config{path_sep}/ } @incpaths
453 if ($Config{locincpth}) {
454 push @incs, grep -d, split ' ', $Config{locincpth};
456 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
457 push(@incs, split /;/, $ENV{INCLUDE}) if exists $ENV{INCLUDE};
459 if ($Config{incpath}) {
460 push @incs, grep -d, split /\Q$Config{path_sep}/, $Config{incpath};
464 /usr/include/freetype2
465 /usr/local/include/freetype2
466 /usr/local/include/freetype1/freetype
467 /usr/include /usr/local/include /usr/include/freetype
468 /usr/local/include/freetype);
469 if ($Config{ccflags}) {
470 my @hidden = map { /^-I(.*)$/ ? ($1) : () } split ' ', $Config{ccflags};
472 @definc{@hidden} = (1) x @hidden;
475 @libs= ( split(/\Q$Config{path_sep}/,$LIBPATH),
476 map _tilde_expand($_), map { split /\Q$Config{path_sep}/} @libpaths );
477 if ($Config{loclibpth}) {
478 push @libs, grep -d, split ' ', $Config{loclibpth};
481 push @libs, grep -d, qw(/sw/lib), split(/ /, $Config{'libpth'});
482 push @libs, grep -d, split / /, $Config{libspath} if $Config{libspath};
483 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
484 push(@libs, split /;/, $ENV{LIB}) if exists $ENV{LIB};
486 if ($^O eq 'cygwin') {
487 push(@libs, '/usr/lib/w32api') if -d '/usr/lib/w32api';
488 push(@incs, '/usr/include/w32api') if -d '/usr/include/w32api';
490 if ($Config{ldflags}) {
491 # some builds of perl put -Ldir into ldflags without putting it in
492 # loclibpth, let's extract them
493 my @hidden = grep -d, map { /^-L(.*)$/ ? ($1) : () }
494 split ' ', $Config{ldflags};
496 # don't mark them as seen - EU::MM will remove any libraries
497 # it can't find and it doesn't look for -L in ldflags
498 #@deflib{@hidden} = @hidden;
500 push @libs, grep -d, qw(/usr/local/lib);
505 inccheck=>sub { -e catfile($_[0], 'jpeglib.h') },
506 libcheck=>sub { $_[0] eq "libjpeg$aext" or $_ eq "libjpeg.$lext" },
510 In order to use jpeg with this module you need to have libjpeg
511 installed on your computer}
517 inccheck=>sub { -e catfile($_[0], 'tiffio.h') },
518 libcheck=>sub { $_[0] eq "libtiff$aext" or $_ eq "libtiff.$lext" },
522 In order to use tiff with this module you need to have libtiff
523 installed on your computer},
524 postcheck => \&postcheck_tiff,
530 inccheck=>sub { -e catfile($_[0], 'png.h') },
531 libcheck=>sub { $_[0] eq "libpng$aext" or $_[0] eq "libpng.$lext" },
532 libfiles=>$^O eq 'MSWin32' ? '-lpng -lzlib' : '-lpng -lz',
535 Png stands for Portable Network Graphics and is intended as
536 a replacement for gif on the web. It is patent free and
537 is recommended by the w3c, you need libpng to use these formats},
544 inccheck=>sub { -e catfile($_[0], 'gif_lib.h') },
545 libcheck=>sub { $_[0] eq "libgif$aext" or $_[0] eq "libgif.$lext" },
549 gif is the de facto standard for webgraphics at the moment,
550 it does have some patent problems. If you have giflib and
551 are not in violation with the unisys patent you should use
552 this instead of the 'ungif' option. Note that they cannot
553 be in use at the same time}
559 inccheck=>sub { -e catfile($_[0], 'gif_lib.h') },
560 libcheck=>sub { $_[0] eq "libungif$aext" or $_[0] eq "libungif.$lext" },
564 gif is the de facto standard for webgraphics at the moment,
565 it does have some patent problems. If you have libungif and
566 want to create images free from LZW patented compression you
567 should use this option instead of the 'gif' option}
570 $formats{'T1-fonts'}={
573 inccheck=>sub { -e catfile($_[0], 't1lib.h') },
574 libcheck=>sub { $_[0] eq "libt1$aext" or $_[0] eq "libt1.$lext" },
578 postscript t1 fonts are scalable fonts. They can include
579 ligatures and kerning information and generally yield good
580 visual quality. We depend on libt1 to rasterize the fonts
584 $formats{'TT-fonts'}=
588 inccheck=>sub { -e catfile($_[0], 'freetype.h')
589 && !-e catfile($_[0], 'fterrors.h') },
590 libcheck=>sub { $_[0] eq "libttf$aext" or $_[0] eq "libttf.$lext" },
593 code => \&freetype1_probe,
595 Truetype fonts are scalable fonts. They can include
596 kerning and hinting information and generally yield good
597 visual quality esp on low resultions. The freetype library is
598 used to rasterize for us. The only drawback is that there
599 are alot of badly designed fonts out there.}
604 inccheck=>sub { -e catfile($_[0], 'windows.h') },
605 libcheck=>sub { lc $_[0] eq 'gdi32.lib'
606 || lc $_[0] eq 'libgdi32.a' },
607 libfiles=>$^O eq 'cygwin' ? '-lgdi32' : '',
610 Uses the Win32 GDI for rendering text.
612 This currently only works on under normal Win32 and cygwin.
615 $formats{'freetype2'} =
619 # we always use a probe function
620 #inccheck=>sub { -e catfile($_[0], 'ft2build.h') },
621 #libcheck=>sub { $_[0] eq "libfreetype$aext" or $_[0] eq "libfreetype.$lext" },
622 libfiles=>'-lfreetype',
623 objfiles=>'freetyp2.o',
625 Freetype 2 supports both Truetype and Type 1 fonts, both of which are
626 scalable. It also supports a variety of other fonts.
630 \&freetype2_probe_ftconfig,
631 \&freetype2_probe_scan
636 for (keys %formats) { $formats{$_}->{docs} =~ s/^\s+/ /mg; }
643 defined($V) ? $V : "";
647 # Get information from environment variables
659 $DFLAGS) = map { gen $_ } qw(IM_VERBOSE
674 open CONFIG, "> imconfig.h"
675 or die "Cannot create imconfig.h: $!\n";
677 /* This file is automatically generated by Makefile.PL.
678 Don't edit this file, since any changes will be lost */
680 #ifndef IMAGER_IMCONFIG_H
681 #define IMAGER_IMCONFIG_H
683 for my $define (@$defines) {
685 print CONFIG "\n/*\n $define->[2]\n*/\n\n";
687 print CONFIG "#define $define->[0] $define->[1]\n";
689 print CONFIG "\n#endif\n";
693 # use pkg-config to probe for libraries
694 # works around the junk that pkg-config dumps on FreeBSD
698 is_exe('pkg-config') or return;
700 my $redir = $^O eq 'MSWin32' ? '' : '2>/dev/null';
702 !system("pkg-config $pkg --exists $redir");
705 # probes for freetype1 by scanning @incs for the includes and
706 # @libs for the libs. This is done separately because freetype's headers
707 # are stored in a freetype or freetype1 directory under PREFIX/include.
709 # we could find the files with the existing mechanism, but it won't set
710 # -I flags correctly.
712 # This could be extended to freetype2 too, but freetype-config catches
714 sub freetype1_probe {
715 my ($frm, $frmkey) = @_;
719 for my $inc (@incs) {
720 for my $subdir (qw/freetype freetype1/) {
721 my $path = File::Spec->catfile($inc, $subdir, 'freetype.h');
723 $path = File::Spec->catfile($inc, $subdir, 'fterrors.h');
726 $found_inc = File::Spec->catdir($inc, $subdir);
733 for my $lib (@libs) {
734 my $a_path = File::Spec->catfile($lib, "libttf$aext");
735 my $l_path = File::Spec->catfile($lib, "libttf.$lext");
736 if (-e $a_path || -e $l_path) {
742 return unless $found_inc && $found_lib;
743 printf("%10s: includes %s - libraries %s\n", $frmkey,
744 ($found_inc ? 'found' : 'not found'),
745 ($found_lib ? 'found' : 'not found'));
747 $frm->{cflags} = "-I$found_inc";
748 $frm->{libfiles} = "-lttf";
753 # probes for freetype2 by trying to run freetype-config
754 sub freetype2_probe_ftconfig {
755 my ($frm, $frmkey) = @_;
757 is_exe('freetype-config') or return;
759 my $cflags = `freetype-config --cflags`
763 my $lflags = `freetype-config --libs`
767 # before 2.1.5 freetype-config --cflags could output
768 # the -I options in the wrong order, causing a conflict with
769 # freetype1.x installed with the same --prefix
772 # - both -Iprefix/include and -Iprefix/include/freetype2 are in cflags
774 # - freetype 1.x headers are in prefix/include/freetype
775 my @incdirs = map substr($_, 2), grep /^-I/, split ' ', $cflags;
777 && $incdirs[1] eq "$incdirs[0]/freetype2"
778 && -e "$incdirs[0]/freetype/freetype.h"
779 && -e "$incdirs[0]/freetype/fterrid.h") {
780 print "** freetype-config provided -I options out of order, correcting\n"
782 $cflags = join(' ', grep(!/-I/, split ' ', $cflags),
783 map "-I$_", reverse @incdirs);
785 $frm->{cflags} = $cflags;
786 $frm->{lflags} = $lflags;
788 printf "%10s: configured via freetype-config\n", $frmkey;
793 # attempt to probe for freetype2 by scanning directories
794 # we can't use the normal scan since we need to find the directory
795 # containing most of the includes
796 sub freetype2_probe_scan {
797 my ($frm, $frmkey) = @_;
802 for my $inc (@incs) {
803 my $path = File::Spec->catfile($inc, 'ft2build.h');
806 # try to find what it's including
808 open FT2BUILD, "< $path"
811 if (m!^\s*\#\s*include\s+<([\w/.]+)>!
812 || m!^\s*\#\s*include\s+"([\w/.]+)"!) {
820 # non-Unix installs put this directly under the same directory in
822 if (-e File::Spec->catfile($inc, $ftheader)) {
826 for my $subdir (qw/freetype2 freetype/) {
827 $path = File::Spec->catfile($inc, $subdir, 'fterrors.h');
831 $found_inc2 = File::Spec->catdir($inc, $subdir);
838 for my $lib (@libs) {
839 my $a_path = File::Spec->catfile($lib, "libfreetype$aext");
840 my $l_path = File::Spec->catfile($lib, "libfreetype.$lext");
841 if (-e $a_path || -e $l_path) {
847 printf("%10s: includes %s - libraries %s\n", $frmkey,
848 ($found_inc ? 'found' : 'not found'),
849 ($found_lib ? 'found' : 'not found'));
851 return unless $found_inc && $found_lib;
853 $frm->{cflags} = _make_I($found_inc);
854 $frm->{cflags} .= " " . _make_I($found_inc2) if $found_inc2;
855 $frm->{libfiles} = "-lfreetype";
866 $inc_dir =~ / / ? qq!-I"$inc_dir"! : "-I$inc_dir";
869 # probes for libpng via pkg-config
871 my ($frm, $frmkey) = @_;
873 is_exe('pkg-config') or return;
876 for my $check_conf (qw(libpng libpng12 libpng10)) {
877 if (_pkg_probe($check_conf)) {
878 $config = $check_conf;
884 my $cflags = `pkg-config $config --cflags`
887 my $lflags = `pkg-config $config --libs`
892 $frm->{cflags} = $cflags;
893 $frm->{lflags} = $lflags;
895 printf "%10s: configured via `pkg-config $config ...`\n", $frmkey;
901 return File::Spec->catfile(@_);
907 my @exe_suffix = $Config{_exe};
908 if ($^O eq 'MSWin32') {
909 push @exe_suffix, qw/.bat .cmd/;
912 for my $dir (File::Spec->path) {
913 for my $suffix (@exe_suffix) {
914 -x catfile($dir, "$name$suffix")
924 Usage: $0 [--enable feature1,feature2,...] [other options]
925 $0 [--disable feature1,feature2,...] [other options]
927 Possible feature names are:
928 png gif ungif jpeg tiff T1-fonts TT-fonts freetype2
931 Verbose library probing (or set IM_VERBOSE in the environment)
933 Disable logging (or set IM_NOLOG in the environment)
935 Add to the include search path
937 Add to the library search path
943 # generate the PM MM argument
944 # I'd prefer to modify the public version, but there doesn't seem to be
945 # a public API to do that
948 my $instbase = '$(INST_LIBDIR)';
950 # first the basics, .pm and .pod files
951 $pm{"Imager.pm"} = "$instbase/Imager.pm";
953 my $mani = maniread();
955 for my $filename (keys %$mani) {
956 if ($filename =~ m!^lib/! && $filename =~ /\.(pm|pod)$/) {
957 (my $work = $filename) =~ s/^lib//;
958 $pm{$filename} = $instbase . $work;
963 $pm{typemap} = $instbase . '/Imager/typemap';
965 # and the core headers
966 for my $filename (keys %$mani) {
967 if ($filename =~ /^\w+\.h$/) {
968 $pm{$filename} = $instbase . '/Imager/include/' . $filename;
972 # and the generated header
973 $pm{"imconfig.h"} = $instbase . '/Imager/include/imconfig.h';
982 if ($path =~ m!^~[/\\]!) {
983 defined $home or $home = $ENV{HOME};
984 if (!defined $home && $^O eq 'MSWin32'
985 && defined $ENV{HOMEDRIVE} && defined $ENV{HOMEPATH}) {
986 $home = $ENV{HOMEDRIVE} . $ENV{HOMEPATH};
988 unless (defined $home) {
989 $home = eval { (getpwuid($<))[7] };
991 defined $home or die "You supplied $path, but I can't find your home directory\n";
993 $path = File::Spec->catdir($home, $path);
1000 my ($format, $frm) = @_;
1002 -d "probe" or mkdir "probe";
1004 my $tiffver_name = "probe/tiffver.txt";
1007 if ($Config{cc} =~ /\b(cl|bcc)\b/) {
1019 incpath => $format->{incdir},
1020 libpath => $format->{libdir},
1022 header => [ qw(stdio.h tiffio.h) ],
1023 function => <<FUNCTION,
1025 const char *vers = TIFFGetVersion();
1026 FILE *f = fopen("$tiffver_name", "wb");
1039 unless ($good && -s $tiffver_name
1040 && open(VERS, "< probe/tiffver.txt")) {
1041 unlink $tiffver_name unless $KEEP_FILES;
1043 **tiff: cannot determine libtiff version number
1049 # version file seems to be there, load it up
1050 my $ver_str = do { local $/; <VERS> };
1052 unlink $tiffver_name unless $KEEP_FILES;
1054 my ($version) = $ver_str =~ /(\d+\.\d+\.\d+)/;
1056 if ($version eq '3.9.0') {
1058 **tiff: libtiff 3.9.0 introduced a serious bug, please install 3.9.1
1067 # This isn't a module, but some broken tools, like
1068 # Module::Depends::Instrusive insist on treating it like one.
1070 # http://rt.cpan.org/Public/Bug/Display.html?id=21229