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 my $assert; # build with assertions
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,
55 "assert|a" => \$assert);
57 if ($ENV{AUTOMATED_TESTING}) {
62 print "Verbose mode\n";
64 import Data::Dumper qw(Dumper);
73 if ($NOLOG) { print "Logging not compiled into module\n"; }
75 push @defines, [ IMAGER_LOG => 1, "Logging system" ];
79 push @defines, [ IM_ASSERT => 1, "im_assert() are effective" ];
83 push @defines, [ IMAGER_DEBUG_MALLOC => 1, "Use Imager's DEBUG malloc()" ];
84 print "Malloc debugging enabled\n";
87 if (@enable && @disable) {
88 print STDERR "Only --enable or --disable can be used, not both, try --help\n";
94 my @incs; # all the places to look for headers
95 my @libs; # all the places to look for libraries
97 init(); # initialize global data
98 pathcheck(); # Check if directories exist
100 if (exists $ENV{IM_ENABLE}) {
101 my %en = map { $_, 1 } split ' ', $ENV{IM_ENABLE};
102 for my $key (keys %formats) {
103 delete $formats{$key} unless $en{$key};
107 my %en = map { $_ => 1 } map { split /,/ } @enable;
108 for my $key (keys %formats) {
109 delete $formats{$key} unless $en{$key};
113 delete @formats{map { split /,/ } @disable};
116 # Pick what libraries are used
123 # Make sure there isn't a clash between the gif libraries.
130 for my $frmkey (sort { $formats{$a}{order} <=> $formats{$b}{order} } keys %formats) {
131 my $frm = $formats{$frmkey};
132 push @defines, [ $frm->{def}, 1, "$frmkey available" ];
133 $F_OBJECT .= ' ' .$frm->{objfiles};
134 if ($frm->{cflags}) {
135 $lib_cflags .= ' ' .$frm->{cflags};
136 ++$definc{$_} for map { /^-I(.*)$/ ? ($1) : () }
137 grep /^-I./, split ' ', $frm->{cflags};
139 if ($frm->{lflags}) {
140 $lib_lflags .= ' ' . $frm->{lflags};
143 $F_LIBS .= ' ' .$frm->{libfiles};
149 print "EXIF support enabled\n";
150 push @defines, [ 'IMEXIF_ENABLE', 1, "Enable experimental EXIF support" ];
151 $F_OBJECT .= ' imexif.o';
154 my $F_INC = join ' ', map "-I$_", map / / ? qq{"$_"} : $_,
155 grep !$definc{$_}, @incs;
156 $F_LIBS = join(' ',map "-L$_", map / / ? qq{"$_"} : $_,
157 grep !$deflib{$_}++, @libs) . $F_LIBS;
160 my $OSDEF = "-DOS_$^O";
162 if ($^O eq 'hpux') { $OSLIBS .= ' -ldld'; }
163 if (defined $Config{'d_dlsymun'}) { $OSDEF .= ' -DDLSYMUN'; }
165 my @objs = qw(Imager.o draw.o polygon.o image.o io.o iolayer.o
166 log.o gaussian.o conv.o pnm.o raw.o feat.o font.o
167 filters.o dynaload.o stackmach.o datatypes.o
168 regmach.o trans2.o quant.o error.o convert.o
169 map.o tags.o palimg.o maskimg.o img16.o rotate.o
170 bmp.o tga.o color.o fills.o imgdouble.o limits.o hlines.o
171 imext.o scale.o rubthru.o render.o paste.o compose.o flip.o);
175 'VERSION_FROM' => 'Imager.pm',
176 'LIBS' => "$LFLAGS -lm $lib_lflags $OSLIBS $F_LIBS",
177 'DEFINE' => "$OSDEF $CFLAGS",
178 'INC' => "$lib_cflags $DFLAGS $F_INC",
179 'OBJECT' => join(' ', @objs, $F_OBJECT),
180 clean => { FILES=>'testout rubthru.c scale.c conv.c filters.c gaussian.c render.c rubthru.c' },
182 PREREQ_PM => { 'Test::More' => 0.47 },
186 if ($Config{gccversion}) {
187 push @ARGV, 'OPTIMIZE=-ftest-coverage -fprofile-arcs';
188 #$opts{dynamic_lib} = { OTHERLDFLAGS => '-ftest-coverage -fprofile-arcs' };
191 die "Don't know the coverage C flags for your compiler\n";
195 # eval to prevent warnings about versions with _ in them
196 my $MM_ver = eval $ExtUtils::MakeMaker::VERSION;
197 if ($MM_ver > 6.06) {
198 $opts{AUTHOR} = 'Tony Cook <tony@imager.perl.org>, Arnar M. Hrafnkelsson';
199 $opts{ABSTRACT} = 'Perl extension for Generating 24 bit Images';
202 if ($MM_ver >= 6.46) {
207 "Parse::RecDescent" => 0
214 make_imconfig(\@defines);
216 if ($VERBOSE) { print Dumper(\%opts); }
217 mkdir('testout',0777); # since we cannot include it in the archive.
219 -d "probe" and rmdir "probe";
221 WriteMakefile(%opts);
228 my $perl = $self->{PERLRUN} ? '$(PERLRUN)' : '$(PERL)';
231 my @ims = grep /\.im$/, keys %$mani;
233 dyntest.$(MYEXTLIB) : dynfilt/Makefile
234 cd dynfilt && $(MAKE) $(PASTHRU)
236 lib/Imager/Regops.pm : regmach.h regops.perl
237 $(PERL) regops.perl regmach.h lib/Imager/Regops.pm
239 imconfig.h : Makefile.PL
240 $(ECHO) "imconfig.h out-of-date with respect to $?"
241 $(PERLRUN) Makefile.PL
242 $(ECHO) "==> Your Makefile has been rebuilt - re-run your make command <=="
244 lib/Imager/APIRef.pod : \$(C_FILES) \$(H_FILES) apidocs.perl
245 $perl apidocs.perl lib/Imager/APIRef.pod
247 !.join('', map _im_rule($perl, $_), @ims)
252 my ($perl, $im) = @_;
254 (my $c = $im) =~ s/\.im$/.c/;
257 $c: $im lib/Imager/Preprocess.pm
258 $perl -Ilib -MImager::Preprocess -epreprocess $im $c
264 # manual configuration of helper libraries
269 Please answer the following questions about
270 which formats are avaliable on your computer
272 press <return> to continue
275 <STDIN>; # eat one return
277 for my $frm(sort { $formats{$b}{order} <=> $formats{$a}{order} } keys %formats) {
279 if ($formats{$frm}{docs}) { print "\n",$formats{$frm}{docs},"\n\n"; }
280 print "Enable $frm support: ";
283 if ($gz =~ m/^(y|yes|n|no)/i) {
284 $gz=substr(lc($gz),0,1);
286 delete $formats{$frm};
293 # automatic configuration of helper libraries
296 print "Automatic probing:\n" if $VERBOSE;
297 for my $frm (sort { $formats{$a}{order} <=> $formats{$b}{order} } keys %formats) {
298 delete $formats{$frm} if !checkformat($frm);
304 if ($formats{'gif'} and $formats{'ungif'}) {
305 print "ungif and gif can not coexist - removing ungif support\n";
306 delete $formats{'ungif'};
309 for my $frm (qw(gif ungif)) {
310 checkformat($frm) if ($MANUAL and $formats{$frm});
314 for my $frm (grep $formats{$_}, qw(gif ungif)) {
315 push(@dirs, @{$formats{$frm}{incdir}}) if $formats{$frm}{incdir};
319 FILES: for my $dir (@dirs) {
320 my $h = "$dir/gif_lib.h";
321 open H, "< $h" or next;
323 if (/GIF_LIB_VERSION\s+"\s*version\s*(\d+)\.(\d+)/i) {
333 # we need the version in a #ifdefable form
335 push @defines, [ IM_GIFMAJOR => $major, "Parsed giflib version" ];
336 push @defines, [ IM_GIFMINOR => $minor ];
337 push @defines, [ IM_NO_SET_GIF_VERSION => 1, "Disable EGifSetGifVersion" ]
338 if $no_gif_set_version;
345 # print "checking path $path\n";
346 if ( !opendir(DH,$path) ) {
347 warn "Cannot open dir $path: $!\n";
350 my @l=grep { $chk->($_) } readdir(DH);
353 return map $path, @l;
357 my ($format, $frm) = @_;
359 my $lib_check=$formats{$frm}{'libcheck'};
360 my $inc_check=$formats{$frm}{'inccheck'};
365 push(@l, grep_directory($lp,$lib_check));
370 push(@i, $ip) if $inc_check->($ip,$frm);
373 printf("%10s: includes %s - libraries %s\n",$frm,(@i?'found':'not found'),(@l?'found':'not found'));
374 $formats{$frm}{incdir} = \@i;
375 $formats{$frm}{libdir} = \@l;
376 return 1 if scalar(@i && @l);
379 printf("%10s: not available\n", $frm);
388 print " checkformat($frm)\n" if $VERBOSE;
390 my $format = $formats{$frm};
393 if (my $code = $format->{'code'}) {
394 if (ref $code eq 'ARRAY') {
395 push @probes, @$code;
401 push @probes, \&_probe_default;
403 print " Calling probe function\n" if $VERBOSE;
405 for my $func (@probes) {
406 if ($func->($format, $frm)) {
414 if ($format->{postcheck}) {
415 print " Calling postcheck function\n" if $VERBOSE;
416 $format->{postcheck}->($format, $frm)
427 print " Include paths:\n";
428 for (@incs) { print $_,"\n"; }
430 @incs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @incs;
433 print "\nLibrary paths:\n";
434 for (@libs) { print $_,"\n"; }
436 @libs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @libs;
441 # Format data initialization
443 # format definition is:
445 # default include path
446 # files needed for include (boolean perl code)
449 # files needed for link (boolean perl code)
450 # object files needed for the format
455 my @definc = qw(/usr/include);
456 @definc{@definc}=(1) x @definc;
459 split(/\Q$Config{path_sep}/, $INCPATH),
460 map _tilde_expand($_), map { split /\Q$Config{path_sep}/ } @incpaths
462 if ($Config{locincpth}) {
463 push @incs, grep -d, split ' ', $Config{locincpth};
465 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
466 push(@incs, split /;/, $ENV{INCLUDE}) if exists $ENV{INCLUDE};
468 if ($Config{incpath}) {
469 push @incs, grep -d, split /\Q$Config{path_sep}/, $Config{incpath};
473 /usr/include/freetype2
474 /usr/local/include/freetype2
475 /usr/local/include/freetype1/freetype
476 /usr/include /usr/local/include /usr/include/freetype
477 /usr/local/include/freetype);
478 if ($Config{ccflags}) {
479 my @hidden = map { /^-I(.*)$/ ? ($1) : () } split ' ', $Config{ccflags};
481 @definc{@hidden} = (1) x @hidden;
484 @libs= ( split(/\Q$Config{path_sep}/,$LIBPATH),
485 map _tilde_expand($_), map { split /\Q$Config{path_sep}/} @libpaths );
486 if ($Config{loclibpth}) {
487 push @libs, grep -d, split ' ', $Config{loclibpth};
490 push @libs, grep -d, qw(/sw/lib), split(/ /, $Config{'libpth'});
491 push @libs, grep -d, split / /, $Config{libspath} if $Config{libspath};
492 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
493 push(@libs, split /;/, $ENV{LIB}) if exists $ENV{LIB};
495 if ($^O eq 'cygwin') {
496 push(@libs, '/usr/lib/w32api') if -d '/usr/lib/w32api';
497 push(@incs, '/usr/include/w32api') if -d '/usr/include/w32api';
499 if ($Config{ldflags}) {
500 # some builds of perl put -Ldir into ldflags without putting it in
501 # loclibpth, let's extract them
502 my @hidden = grep -d, map { /^-L(.*)$/ ? ($1) : () }
503 split ' ', $Config{ldflags};
505 # don't mark them as seen - EU::MM will remove any libraries
506 # it can't find and it doesn't look for -L in ldflags
507 #@deflib{@hidden} = @hidden;
509 push @libs, grep -d, qw(/usr/local/lib);
514 inccheck=>sub { -e catfile($_[0], 'jpeglib.h') },
515 libcheck=>sub { $_[0] eq "libjpeg$aext" or $_ eq "libjpeg.$lext" },
519 In order to use jpeg with this module you need to have libjpeg
520 installed on your computer}
526 inccheck=>sub { -e catfile($_[0], 'tiffio.h') },
527 libcheck=>sub { $_[0] eq "libtiff$aext" or $_ eq "libtiff.$lext" },
531 In order to use tiff with this module you need to have libtiff
532 installed on your computer},
533 postcheck => \&postcheck_tiff,
539 inccheck=>sub { -e catfile($_[0], 'png.h') },
540 libcheck=>sub { $_[0] eq "libpng$aext" or $_[0] eq "libpng.$lext" },
541 libfiles=>$^O eq 'MSWin32' ? '-lpng -lzlib' : '-lpng -lz',
544 Png stands for Portable Network Graphics and is intended as
545 a replacement for gif on the web. It is patent free and
546 is recommended by the w3c, you need libpng to use these formats},
553 inccheck=>sub { -e catfile($_[0], 'gif_lib.h') },
554 libcheck=>sub { $_[0] eq "libgif$aext" or $_[0] eq "libgif.$lext" },
558 gif is the de facto standard for webgraphics at the moment,
559 it does have some patent problems. If you have giflib and
560 are not in violation with the unisys patent you should use
561 this instead of the 'ungif' option. Note that they cannot
562 be in use at the same time}
568 inccheck=>sub { -e catfile($_[0], 'gif_lib.h') },
569 libcheck=>sub { $_[0] eq "libungif$aext" or $_[0] eq "libungif.$lext" },
573 gif is the de facto standard for webgraphics at the moment,
574 it does have some patent problems. If you have libungif and
575 want to create images free from LZW patented compression you
576 should use this option instead of the 'gif' option}
579 $formats{'T1-fonts'}={
582 inccheck=>sub { -e catfile($_[0], 't1lib.h') },
583 libcheck=>sub { $_[0] eq "libt1$aext" or $_[0] eq "libt1.$lext" },
587 postscript t1 fonts are scalable fonts. They can include
588 ligatures and kerning information and generally yield good
589 visual quality. We depend on libt1 to rasterize the fonts
593 $formats{'TT-fonts'}=
597 inccheck=>sub { -e catfile($_[0], 'freetype.h')
598 && !-e catfile($_[0], 'fterrors.h') },
599 libcheck=>sub { $_[0] eq "libttf$aext" or $_[0] eq "libttf.$lext" },
602 code => \&freetype1_probe,
604 Truetype fonts are scalable fonts. They can include
605 kerning and hinting information and generally yield good
606 visual quality esp on low resultions. The freetype library is
607 used to rasterize for us. The only drawback is that there
608 are alot of badly designed fonts out there.}
613 inccheck=>sub { -e catfile($_[0], 'windows.h') },
614 libcheck=>sub { lc $_[0] eq 'gdi32.lib'
615 || lc $_[0] eq 'libgdi32.a' },
616 libfiles=>$^O eq 'cygwin' ? '-lgdi32' : '',
619 Uses the Win32 GDI for rendering text.
621 This currently only works on under normal Win32 and cygwin.
624 $formats{'freetype2'} =
628 # we always use a probe function
629 #inccheck=>sub { -e catfile($_[0], 'ft2build.h') },
630 #libcheck=>sub { $_[0] eq "libfreetype$aext" or $_[0] eq "libfreetype.$lext" },
631 libfiles=>'-lfreetype',
632 objfiles=>'freetyp2.o',
634 Freetype 2 supports both Truetype and Type 1 fonts, both of which are
635 scalable. It also supports a variety of other fonts.
639 \&freetype2_probe_ftconfig,
640 \&freetype2_probe_scan
645 for (keys %formats) { $formats{$_}->{docs} =~ s/^\s+/ /mg; }
652 defined($V) ? $V : "";
656 # Get information from environment variables
668 $DFLAGS) = map { gen $_ } qw(IM_VERBOSE
683 open CONFIG, "> imconfig.h"
684 or die "Cannot create imconfig.h: $!\n";
686 /* This file is automatically generated by Makefile.PL.
687 Don't edit this file, since any changes will be lost */
689 #ifndef IMAGER_IMCONFIG_H
690 #define IMAGER_IMCONFIG_H
692 for my $define (@$defines) {
694 print CONFIG "\n/*\n $define->[2]\n*/\n\n";
696 print CONFIG "#define $define->[0] $define->[1]\n";
698 print CONFIG "\n#endif\n";
702 # use pkg-config to probe for libraries
703 # works around the junk that pkg-config dumps on FreeBSD
707 is_exe('pkg-config') or return;
709 my $redir = $^O eq 'MSWin32' ? '' : '2>/dev/null';
711 !system("pkg-config $pkg --exists $redir");
714 # probes for freetype1 by scanning @incs for the includes and
715 # @libs for the libs. This is done separately because freetype's headers
716 # are stored in a freetype or freetype1 directory under PREFIX/include.
718 # we could find the files with the existing mechanism, but it won't set
719 # -I flags correctly.
721 # This could be extended to freetype2 too, but freetype-config catches
723 sub freetype1_probe {
724 my ($frm, $frmkey) = @_;
728 for my $inc (@incs) {
729 for my $subdir (qw/freetype freetype1/) {
730 my $path = File::Spec->catfile($inc, $subdir, 'freetype.h');
732 $path = File::Spec->catfile($inc, $subdir, 'fterrors.h');
735 $found_inc = File::Spec->catdir($inc, $subdir);
742 for my $lib (@libs) {
743 my $a_path = File::Spec->catfile($lib, "libttf$aext");
744 my $l_path = File::Spec->catfile($lib, "libttf.$lext");
745 if (-e $a_path || -e $l_path) {
751 return unless $found_inc && $found_lib;
752 printf("%10s: includes %s - libraries %s\n", $frmkey,
753 ($found_inc ? 'found' : 'not found'),
754 ($found_lib ? 'found' : 'not found'));
756 $frm->{cflags} = "-I$found_inc";
757 $frm->{libfiles} = "-lttf";
762 # probes for freetype2 by trying to run freetype-config
763 sub freetype2_probe_ftconfig {
764 my ($frm, $frmkey) = @_;
766 is_exe('freetype-config') or return;
768 my $cflags = `freetype-config --cflags`
772 my $lflags = `freetype-config --libs`
776 # before 2.1.5 freetype-config --cflags could output
777 # the -I options in the wrong order, causing a conflict with
778 # freetype1.x installed with the same --prefix
781 # - both -Iprefix/include and -Iprefix/include/freetype2 are in cflags
783 # - freetype 1.x headers are in prefix/include/freetype
784 my @incdirs = map substr($_, 2), grep /^-I/, split ' ', $cflags;
786 && $incdirs[1] eq "$incdirs[0]/freetype2"
787 && -e "$incdirs[0]/freetype/freetype.h"
788 && -e "$incdirs[0]/freetype/fterrid.h") {
789 print "** freetype-config provided -I options out of order, correcting\n"
791 $cflags = join(' ', grep(!/-I/, split ' ', $cflags),
792 map "-I$_", reverse @incdirs);
794 $frm->{cflags} = $cflags;
795 $frm->{lflags} = $lflags;
797 printf "%10s: configured via freetype-config\n", $frmkey;
802 # attempt to probe for freetype2 by scanning directories
803 # we can't use the normal scan since we need to find the directory
804 # containing most of the includes
805 sub freetype2_probe_scan {
806 my ($frm, $frmkey) = @_;
811 for my $inc (@incs) {
812 my $path = File::Spec->catfile($inc, 'ft2build.h');
815 # try to find what it's including
817 open FT2BUILD, "< $path"
820 if (m!^\s*\#\s*include\s+<([\w/.]+)>!
821 || m!^\s*\#\s*include\s+"([\w/.]+)"!) {
829 # non-Unix installs put this directly under the same directory in
831 if (-e File::Spec->catfile($inc, $ftheader)) {
835 for my $subdir (qw/freetype2 freetype/) {
836 $path = File::Spec->catfile($inc, $subdir, 'fterrors.h');
840 $found_inc2 = File::Spec->catdir($inc, $subdir);
847 for my $lib (@libs) {
848 my $a_path = File::Spec->catfile($lib, "libfreetype$aext");
849 my $l_path = File::Spec->catfile($lib, "libfreetype.$lext");
850 if (-e $a_path || -e $l_path) {
856 printf("%10s: includes %s - libraries %s\n", $frmkey,
857 ($found_inc ? 'found' : 'not found'),
858 ($found_lib ? 'found' : 'not found'));
860 return unless $found_inc && $found_lib;
862 $frm->{cflags} = _make_I($found_inc);
863 $frm->{cflags} .= " " . _make_I($found_inc2) if $found_inc2;
864 $frm->{libfiles} = "-lfreetype";
875 $inc_dir =~ / / ? qq!-I"$inc_dir"! : "-I$inc_dir";
878 # probes for libpng via pkg-config
880 my ($frm, $frmkey) = @_;
882 is_exe('pkg-config') or return;
885 for my $check_conf (qw(libpng libpng12 libpng10)) {
886 if (_pkg_probe($check_conf)) {
887 $config = $check_conf;
893 my $cflags = `pkg-config $config --cflags`
896 my $lflags = `pkg-config $config --libs`
901 $frm->{cflags} = $cflags;
902 $frm->{lflags} = $lflags;
904 printf "%10s: configured via `pkg-config $config ...`\n", $frmkey;
910 return File::Spec->catfile(@_);
916 my @exe_suffix = $Config{_exe};
917 if ($^O eq 'MSWin32') {
918 push @exe_suffix, qw/.bat .cmd/;
921 for my $dir (File::Spec->path) {
922 for my $suffix (@exe_suffix) {
923 -x catfile($dir, "$name$suffix")
933 Usage: $0 [--enable feature1,feature2,...] [other options]
934 $0 [--disable feature1,feature2,...] [other options]
936 Possible feature names are:
937 png gif ungif jpeg tiff T1-fonts TT-fonts freetype2
940 Verbose library probing (or set IM_VERBOSE in the environment)
942 Disable logging (or set IM_NOLOG in the environment)
944 Add to the include search path
946 Add to the library search path
948 Build for coverage testing.
950 Build with assertions active.
952 Disable EXIF parsing.
958 # generate the PM MM argument
959 # I'd prefer to modify the public version, but there doesn't seem to be
960 # a public API to do that
963 my $instbase = '$(INST_LIBDIR)';
965 # first the basics, .pm and .pod files
966 $pm{"Imager.pm"} = "$instbase/Imager.pm";
968 my $mani = maniread();
970 for my $filename (keys %$mani) {
971 if ($filename =~ m!^lib/! && $filename =~ /\.(pm|pod)$/) {
972 (my $work = $filename) =~ s/^lib//;
973 $pm{$filename} = $instbase . $work;
978 $pm{typemap} = $instbase . '/Imager/typemap';
980 # and the core headers
981 for my $filename (keys %$mani) {
982 if ($filename =~ /^\w+\.h$/) {
983 $pm{$filename} = $instbase . '/Imager/include/' . $filename;
987 # and the generated header
988 $pm{"imconfig.h"} = $instbase . '/Imager/include/imconfig.h';
997 if ($path =~ m!^~[/\\]!) {
998 defined $home or $home = $ENV{HOME};
999 if (!defined $home && $^O eq 'MSWin32'
1000 && defined $ENV{HOMEDRIVE} && defined $ENV{HOMEPATH}) {
1001 $home = $ENV{HOMEDRIVE} . $ENV{HOMEPATH};
1003 unless (defined $home) {
1004 $home = eval { (getpwuid($<))[7] };
1006 defined $home or die "You supplied $path, but I can't find your home directory\n";
1008 $path = File::Spec->catdir($home, $path);
1014 sub postcheck_tiff {
1015 my ($format, $frm) = @_;
1017 -d "probe" or mkdir "probe";
1019 my $tiffver_name = "probe/tiffver.txt";
1022 if ($Config{cc} =~ /\b(cl|bcc)\b/) {
1034 incpath => $format->{incdir},
1035 libpath => $format->{libdir},
1037 header => [ qw(stdio.h tiffio.h) ],
1038 function => <<FUNCTION,
1040 const char *vers = TIFFGetVersion();
1041 FILE *f = fopen("$tiffver_name", "wb");
1054 unless ($good && -s $tiffver_name
1055 && open(VERS, "< probe/tiffver.txt")) {
1056 unlink $tiffver_name unless $KEEP_FILES;
1058 **tiff: cannot determine libtiff version number
1064 # version file seems to be there, load it up
1065 my $ver_str = do { local $/; <VERS> };
1067 unlink $tiffver_name unless $KEEP_FILES;
1069 my ($version) = $ver_str =~ /(\d+\.\d+\.\d+)/;
1071 if ($version eq '3.9.0') {
1073 **tiff: libtiff 3.9.0 introduced a serious bug, please install 3.9.1
1082 # This isn't a module, but some broken tools, like
1083 # Module::Depends::Instrusive insist on treating it like one.
1085 # http://rt.cpan.org/Public/Bug/Display.html?id=21229