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);
15 # IM_INCPATH colon seperated list of paths to extra include paths
16 # IM_LIBPATH colon seperated list of paths to extra library paths
18 # IM_VERBOSE turns on verbose mode for the library finding and such
19 # IM_MANUAL to manually select which libraries are used and which not
20 # IM_ENABLE to programmatically select which libraries are used
22 # IM_NOLOG if true logging will not be compiled into the module
23 # IM_DEBUG_MALLOC if true malloc debbuging will be compiled into the module
24 # do not use IM_DEBUG_MALLOC in production - this slows
25 # everything down by alot
26 # IM_CFLAGS Extra flags to pass to the compiler
27 # IM_LFLAGS Extra flags to pass to the linker
28 # IM_DFLAGS Extra flags to pass to the preprocessor
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 my $assert; # build with assertions
46 GetOptions("help" => \$help,
47 "enable=s" => \@enable,
48 "disable=s" => \@disable,
49 "incpath=s", \@incpaths,
50 "libpath=s" => \@libpaths,
51 "verbose|v" => \$VERBOSE,
54 "nogifsetversion" => \$no_gif_set_version,
55 'coverage' => \$coverage,
56 "assert|a" => \$assert);
58 if ($ENV{AUTOMATED_TESTING}) {
63 print "Verbose mode\n";
65 import Data::Dumper qw(Dumper);
74 if ($NOLOG) { print "Logging not compiled into module\n"; }
76 push @defines, [ IMAGER_LOG => 1, "Logging system" ];
80 push @defines, [ IM_ASSERT => 1, "im_assert() are effective" ];
84 push @defines, [ IMAGER_DEBUG_MALLOC => 1, "Use Imager's DEBUG malloc()" ];
85 print "Malloc debugging enabled\n";
88 if (@enable && @disable) {
89 print STDERR "Only --enable or --disable can be used, not both, try --help\n";
95 my @incs; # all the places to look for headers
96 my @libs; # all the places to look for libraries
98 init(); # initialize global data
99 pathcheck(); # Check if directories exist
101 if (exists $ENV{IM_ENABLE}) {
102 my %en = map { $_, 1 } split ' ', $ENV{IM_ENABLE};
103 for my $key (keys %formats) {
104 delete $formats{$key} unless $en{$key};
108 my %en = map { $_ => 1 } map { split /,/ } @enable;
109 for my $key (keys %formats) {
110 delete $formats{$key} unless $en{$key};
114 delete @formats{map { split /,/ } @disable};
117 # Pick what libraries are used
124 # Make sure there isn't a clash between the gif libraries.
131 for my $frmkey (sort { $formats{$a}{order} <=> $formats{$b}{order} } keys %formats) {
132 my $frm = $formats{$frmkey};
133 push @defines, [ $frm->{def}, 1, "$frmkey available" ];
134 $F_OBJECT .= ' ' .$frm->{objfiles};
135 if ($frm->{cflags}) {
136 $lib_cflags .= ' ' .$frm->{cflags};
137 ++$definc{$_} for map { /^-I(.*)$/ ? ($1) : () }
138 grep /^-I./, split ' ', $frm->{cflags};
140 if ($frm->{lflags}) {
141 $lib_lflags .= ' ' . $frm->{lflags};
144 $F_LIBS .= ' ' .$frm->{libfiles};
150 print "EXIF support enabled\n";
151 push @defines, [ 'IMEXIF_ENABLE', 1, "Enable experimental EXIF support" ];
152 $F_OBJECT .= ' imexif.o';
155 my $F_INC = join ' ', map "-I$_", map / / ? qq{"$_"} : $_,
156 grep !$definc{$_}, @incs;
157 $F_LIBS = join(' ',map "-L$_", map / / ? qq{"$_"} : $_,
158 grep !$deflib{$_}++, @libs) . $F_LIBS;
161 my $OSDEF = "-DOS_$^O";
163 if ($^O eq 'hpux') { $OSLIBS .= ' -ldld'; }
164 if (defined $Config{'d_dlsymun'}) { $OSDEF .= ' -DDLSYMUN'; }
166 my @objs = qw(Imager.o draw.o polygon.o image.o io.o iolayer.o
167 log.o gaussian.o conv.o pnm.o raw.o feat.o font.o
168 filters.o dynaload.o stackmach.o datatypes.o
169 regmach.o trans2.o quant.o error.o convert.o
170 map.o tags.o palimg.o maskimg.o img16.o rotate.o
171 bmp.o tga.o color.o fills.o imgdouble.o limits.o hlines.o
172 imext.o scale.o rubthru.o render.o paste.o compose.o flip.o);
176 'VERSION_FROM' => 'Imager.pm',
177 'LIBS' => "$LFLAGS -lm $lib_lflags $OSLIBS $F_LIBS",
178 'DEFINE' => "$OSDEF $CFLAGS",
179 'INC' => "$lib_cflags $DFLAGS $F_INC",
180 'OBJECT' => join(' ', @objs, $F_OBJECT),
181 clean => { FILES=>'testout rubthru.c scale.c conv.c filters.c gaussian.c render.c rubthru.c' },
183 PREREQ_PM => { 'Test::More' => 0.47 },
187 if ($Config{gccversion}) {
188 push @ARGV, 'OPTIMIZE=-ftest-coverage -fprofile-arcs';
189 #$opts{dynamic_lib} = { OTHERLDFLAGS => '-ftest-coverage -fprofile-arcs' };
192 die "Don't know the coverage C flags for your compiler\n";
196 # eval to prevent warnings about versions with _ in them
197 my $MM_ver = eval $ExtUtils::MakeMaker::VERSION;
198 if ($MM_ver > 6.06) {
199 $opts{AUTHOR} = 'Tony Cook <tony@imager.perl.org>, Arnar M. Hrafnkelsson';
200 $opts{ABSTRACT} = 'Perl extension for Generating 24 bit Images';
203 if ($MM_ver >= 6.46) {
208 "Parse::RecDescent" => 0
215 make_imconfig(\@defines);
217 if ($VERBOSE) { print Dumper(\%opts); }
218 mkdir('testout',0777); # since we cannot include it in the archive.
220 -d "probe" and rmdir "probe";
222 WriteMakefile(%opts);
229 my $perl = $self->{PERLRUN} ? '$(PERLRUN)' : '$(PERL)';
232 my @ims = grep /\.im$/, keys %$mani;
234 dyntest.$(MYEXTLIB) : dynfilt/Makefile
235 cd dynfilt && $(MAKE) $(PASTHRU)
237 lib/Imager/Regops.pm : regmach.h regops.perl
238 $(PERL) regops.perl regmach.h lib/Imager/Regops.pm
240 imconfig.h : Makefile.PL
241 $(ECHO) "imconfig.h out-of-date with respect to $?"
242 $(PERLRUN) Makefile.PL
243 $(ECHO) "==> Your Makefile has been rebuilt - re-run your make command <=="
245 lib/Imager/APIRef.pod : \$(C_FILES) \$(H_FILES) apidocs.perl
246 $perl apidocs.perl lib/Imager/APIRef.pod
248 !.join('', map _im_rule($perl, $_), @ims)
253 my ($perl, $im) = @_;
255 (my $c = $im) =~ s/\.im$/.c/;
258 $c: $im lib/Imager/Preprocess.pm
259 $perl -Ilib -MImager::Preprocess -epreprocess $im $c
265 # manual configuration of helper libraries
270 Please answer the following questions about
271 which formats are avaliable on your computer
273 press <return> to continue
276 <STDIN>; # eat one return
278 for my $frm(sort { $formats{$b}{order} <=> $formats{$a}{order} } keys %formats) {
280 if ($formats{$frm}{docs}) { print "\n",$formats{$frm}{docs},"\n\n"; }
281 print "Enable $frm support: ";
284 if ($gz =~ m/^(y|yes|n|no)/i) {
285 $gz=substr(lc($gz),0,1);
287 delete $formats{$frm};
294 # automatic configuration of helper libraries
297 print "Automatic probing:\n" if $VERBOSE;
298 for my $frm (sort { $formats{$a}{order} <=> $formats{$b}{order} } keys %formats) {
299 delete $formats{$frm} if !checkformat($frm);
305 if ($formats{'gif'} and $formats{'ungif'}) {
306 print "ungif and gif can not coexist - removing ungif support\n";
307 delete $formats{'ungif'};
310 for my $frm (qw(gif ungif)) {
311 checkformat($frm) if ($MANUAL and $formats{$frm});
315 for my $frm (grep $formats{$_}, qw(gif ungif)) {
316 push(@dirs, @{$formats{$frm}{incdir}}) if $formats{$frm}{incdir};
320 FILES: for my $dir (@dirs) {
321 my $h = "$dir/gif_lib.h";
322 open H, "< $h" or next;
324 if (/GIF_LIB_VERSION\s+"\s*version\s*(\d+)\.(\d+)/i) {
334 # we need the version in a #ifdefable form
336 push @defines, [ IM_GIFMAJOR => $major, "Parsed giflib version" ];
337 push @defines, [ IM_GIFMINOR => $minor ];
338 push @defines, [ IM_NO_SET_GIF_VERSION => 1, "Disable EGifSetGifVersion" ]
339 if $no_gif_set_version;
346 # print "checking path $path\n";
347 if ( !opendir(DH,$path) ) {
348 warn "Cannot open dir $path: $!\n";
351 my @l=grep { $chk->($_) } readdir(DH);
354 return map $path, @l;
358 my ($format, $frm) = @_;
360 my $lib_check=$formats{$frm}{'libcheck'};
361 my $inc_check=$formats{$frm}{'inccheck'};
366 push(@l, grep_directory($lp,$lib_check));
371 push(@i, $ip) if $inc_check->($ip,$frm);
374 printf("%10s: includes %s - libraries %s\n",$frm,(@i?'found':'not found'),(@l?'found':'not found'));
375 $formats{$frm}{incdir} = \@i;
376 $formats{$frm}{libdir} = \@l;
377 return 1 if scalar(@i && @l);
380 printf("%10s: not available\n", $frm);
389 print " checkformat($frm)\n" if $VERBOSE;
391 my $format = $formats{$frm};
394 if (my $code = $format->{'code'}) {
395 if (ref $code eq 'ARRAY') {
396 push @probes, @$code;
402 push @probes, \&_probe_default;
404 print " Calling probe function\n" if $VERBOSE;
406 for my $func (@probes) {
407 if ($func->($format, $frm)) {
415 if ($format->{postcheck}) {
416 print " Calling postcheck function\n" if $VERBOSE;
417 $format->{postcheck}->($format, $frm)
428 print " Include paths:\n";
429 for (@incs) { print $_,"\n"; }
431 @incs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @incs;
434 print "\nLibrary paths:\n";
435 for (@libs) { print $_,"\n"; }
437 @libs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @libs;
442 # Format data initialization
444 # format definition is:
446 # default include path
447 # files needed for include (boolean perl code)
450 # files needed for link (boolean perl code)
451 # object files needed for the format
456 my @definc = qw(/usr/include);
457 @definc{@definc}=(1) x @definc;
460 split(/\Q$Config{path_sep}/, $INCPATH),
461 map _tilde_expand($_), map { split /\Q$Config{path_sep}/ } @incpaths
463 if ($Config{locincpth}) {
464 push @incs, grep -d, split ' ', $Config{locincpth};
466 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
467 push(@incs, split /;/, $ENV{INCLUDE}) if exists $ENV{INCLUDE};
469 if ($Config{incpath}) {
470 push @incs, grep -d, split /\Q$Config{path_sep}/, $Config{incpath};
474 /usr/include/freetype2
475 /usr/local/include/freetype2
476 /usr/local/include/freetype1/freetype
477 /usr/include /usr/local/include /usr/include/freetype
478 /usr/local/include/freetype);
479 if ($Config{ccflags}) {
480 my @hidden = map { /^-I(.*)$/ ? ($1) : () } split ' ', $Config{ccflags};
482 @definc{@hidden} = (1) x @hidden;
485 @libs= ( split(/\Q$Config{path_sep}/,$LIBPATH),
486 map _tilde_expand($_), map { split /\Q$Config{path_sep}/} @libpaths );
487 if ($Config{loclibpth}) {
488 push @libs, grep -d, split ' ', $Config{loclibpth};
491 push @libs, grep -d, qw(/sw/lib), split(/ /, $Config{'libpth'});
492 push @libs, grep -d, split / /, $Config{libspath} if $Config{libspath};
493 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
494 push(@libs, split /;/, $ENV{LIB}) if exists $ENV{LIB};
496 if ($^O eq 'cygwin') {
497 push(@libs, '/usr/lib/w32api') if -d '/usr/lib/w32api';
498 push(@incs, '/usr/include/w32api') if -d '/usr/include/w32api';
500 if ($Config{ldflags}) {
501 # some builds of perl put -Ldir into ldflags without putting it in
502 # loclibpth, let's extract them
503 my @hidden = grep -d, map { /^-L(.*)$/ ? ($1) : () }
504 split ' ', $Config{ldflags};
506 # don't mark them as seen - EU::MM will remove any libraries
507 # it can't find and it doesn't look for -L in ldflags
508 #@deflib{@hidden} = @hidden;
510 push @libs, grep -d, qw(/usr/local/lib);
515 inccheck=>sub { -e catfile($_[0], 'jpeglib.h') },
516 libcheck=>sub { $_[0] eq "libjpeg$aext" or $_ eq "libjpeg.$lext" },
520 In order to use jpeg with this module you need to have libjpeg
521 installed on your computer}
527 inccheck=>sub { -e catfile($_[0], 'tiffio.h') },
528 libcheck=>sub { $_[0] eq "libtiff$aext" or $_ eq "libtiff.$lext" },
532 In order to use tiff with this module you need to have libtiff
533 installed on your computer},
534 postcheck => \&postcheck_tiff,
540 inccheck=>sub { -e catfile($_[0], 'png.h') },
541 libcheck=>sub { $_[0] eq "libpng$aext" or $_[0] eq "libpng.$lext" },
542 libfiles=>$^O eq 'MSWin32' ? '-lpng -lzlib' : '-lpng -lz',
545 Png stands for Portable Network Graphics and is intended as
546 a replacement for gif on the web. It is patent free and
547 is recommended by the w3c, you need libpng to use these formats},
554 inccheck=>sub { -e catfile($_[0], 'gif_lib.h') },
555 libcheck=>sub { $_[0] eq "libgif$aext" or $_[0] eq "libgif.$lext" },
559 gif is the de facto standard for webgraphics at the moment,
560 it does have some patent problems. If you have giflib and
561 are not in violation with the unisys patent you should use
562 this instead of the 'ungif' option. Note that they cannot
563 be in use at the same time}
569 inccheck=>sub { -e catfile($_[0], 'gif_lib.h') },
570 libcheck=>sub { $_[0] eq "libungif$aext" or $_[0] eq "libungif.$lext" },
574 gif is the de facto standard for webgraphics at the moment,
575 it does have some patent problems. If you have libungif and
576 want to create images free from LZW patented compression you
577 should use this option instead of the 'gif' option}
580 $formats{'T1-fonts'}={
583 inccheck=>sub { -e catfile($_[0], 't1lib.h') },
584 libcheck=>sub { $_[0] eq "libt1$aext" or $_[0] eq "libt1.$lext" },
588 postscript t1 fonts are scalable fonts. They can include
589 ligatures and kerning information and generally yield good
590 visual quality. We depend on libt1 to rasterize the fonts
594 $formats{'TT-fonts'}=
598 inccheck=>sub { -e catfile($_[0], 'freetype.h')
599 && !-e catfile($_[0], 'fterrors.h') },
600 libcheck=>sub { $_[0] eq "libttf$aext" or $_[0] eq "libttf.$lext" },
603 code => \&freetype1_probe,
605 Truetype fonts are scalable fonts. They can include
606 kerning and hinting information and generally yield good
607 visual quality esp on low resultions. The freetype library is
608 used to rasterize for us. The only drawback is that there
609 are alot of badly designed fonts out there.}
614 inccheck=>sub { -e catfile($_[0], 'windows.h') },
615 libcheck=>sub { lc $_[0] eq 'gdi32.lib'
616 || lc $_[0] eq 'libgdi32.a' },
617 libfiles=>$^O eq 'cygwin' ? '-lgdi32' : '',
620 Uses the Win32 GDI for rendering text.
622 This currently only works on under normal Win32 and cygwin.
625 $formats{'freetype2'} =
629 # we always use a probe function
630 #inccheck=>sub { -e catfile($_[0], 'ft2build.h') },
631 #libcheck=>sub { $_[0] eq "libfreetype$aext" or $_[0] eq "libfreetype.$lext" },
632 libfiles=>'-lfreetype',
633 objfiles=>'freetyp2.o',
635 Freetype 2 supports both Truetype and Type 1 fonts, both of which are
636 scalable. It also supports a variety of other fonts.
640 \&freetype2_probe_ftconfig,
641 \&freetype2_probe_scan
646 for (keys %formats) { $formats{$_}->{docs} =~ s/^\s+/ /mg; }
653 defined($V) ? $V : "";
657 # Get information from environment variables
669 $DFLAGS) = map { gen $_ } qw(IM_VERBOSE
684 open CONFIG, "> imconfig.h"
685 or die "Cannot create imconfig.h: $!\n";
687 /* This file is automatically generated by Makefile.PL.
688 Don't edit this file, since any changes will be lost */
690 #ifndef IMAGER_IMCONFIG_H
691 #define IMAGER_IMCONFIG_H
693 for my $define (@$defines) {
695 print CONFIG "\n/*\n $define->[2]\n*/\n\n";
697 print CONFIG "#define $define->[0] $define->[1]\n";
699 print CONFIG "\n#endif\n";
703 # use pkg-config to probe for libraries
704 # works around the junk that pkg-config dumps on FreeBSD
708 is_exe('pkg-config') or return;
710 my $redir = $^O eq 'MSWin32' ? '' : '2>/dev/null';
712 !system("pkg-config $pkg --exists $redir");
715 # probes for freetype1 by scanning @incs for the includes and
716 # @libs for the libs. This is done separately because freetype's headers
717 # are stored in a freetype or freetype1 directory under PREFIX/include.
719 # we could find the files with the existing mechanism, but it won't set
720 # -I flags correctly.
722 # This could be extended to freetype2 too, but freetype-config catches
724 sub freetype1_probe {
725 my ($frm, $frmkey) = @_;
729 for my $inc (@incs) {
730 for my $subdir (qw/freetype freetype1/) {
731 my $path = File::Spec->catfile($inc, $subdir, 'freetype.h');
733 $path = File::Spec->catfile($inc, $subdir, 'fterrors.h');
736 $found_inc = File::Spec->catdir($inc, $subdir);
743 for my $lib (@libs) {
744 my $a_path = File::Spec->catfile($lib, "libttf$aext");
745 my $l_path = File::Spec->catfile($lib, "libttf.$lext");
746 if (-e $a_path || -e $l_path) {
752 return unless $found_inc && $found_lib;
753 printf("%10s: includes %s - libraries %s\n", $frmkey,
754 ($found_inc ? 'found' : 'not found'),
755 ($found_lib ? 'found' : 'not found'));
757 $frm->{cflags} = "-I$found_inc";
758 $frm->{libfiles} = "-lttf";
763 # probes for freetype2 by trying to run freetype-config
764 sub freetype2_probe_ftconfig {
765 my ($frm, $frmkey) = @_;
767 is_exe('freetype-config') or return;
769 my $cflags = `freetype-config --cflags`
773 my $lflags = `freetype-config --libs`
777 # before 2.1.5 freetype-config --cflags could output
778 # the -I options in the wrong order, causing a conflict with
779 # freetype1.x installed with the same --prefix
782 # - both -Iprefix/include and -Iprefix/include/freetype2 are in cflags
784 # - freetype 1.x headers are in prefix/include/freetype
785 my @incdirs = map substr($_, 2), grep /^-I/, split ' ', $cflags;
787 && $incdirs[1] eq "$incdirs[0]/freetype2"
788 && -e "$incdirs[0]/freetype/freetype.h"
789 && -e "$incdirs[0]/freetype/fterrid.h") {
790 print "** freetype-config provided -I options out of order, correcting\n"
792 $cflags = join(' ', grep(!/-I/, split ' ', $cflags),
793 map "-I$_", reverse @incdirs);
795 $frm->{cflags} = $cflags;
796 $frm->{lflags} = $lflags;
798 printf "%10s: configured via freetype-config\n", $frmkey;
803 # attempt to probe for freetype2 by scanning directories
804 # we can't use the normal scan since we need to find the directory
805 # containing most of the includes
806 sub freetype2_probe_scan {
807 my ($frm, $frmkey) = @_;
812 for my $inc (@incs) {
813 my $path = File::Spec->catfile($inc, 'ft2build.h');
816 # try to find what it's including
818 open FT2BUILD, "< $path"
821 if (m!^\s*\#\s*include\s+<([\w/.]+)>!
822 || m!^\s*\#\s*include\s+"([\w/.]+)"!) {
830 # non-Unix installs put this directly under the same directory in
832 if (-e File::Spec->catfile($inc, $ftheader)) {
836 for my $subdir (qw/freetype2 freetype/) {
837 $path = File::Spec->catfile($inc, $subdir, 'fterrors.h');
841 $found_inc2 = File::Spec->catdir($inc, $subdir);
848 for my $lib (@libs) {
849 my $a_path = File::Spec->catfile($lib, "libfreetype$aext");
850 my $l_path = File::Spec->catfile($lib, "libfreetype.$lext");
851 if (-e $a_path || -e $l_path) {
857 printf("%10s: includes %s - libraries %s\n", $frmkey,
858 ($found_inc ? 'found' : 'not found'),
859 ($found_lib ? 'found' : 'not found'));
861 return unless $found_inc && $found_lib;
863 $frm->{cflags} = _make_I($found_inc);
864 $frm->{cflags} .= " " . _make_I($found_inc2) if $found_inc2;
865 $frm->{libfiles} = "-lfreetype";
876 $inc_dir =~ / / ? qq!-I"$inc_dir"! : "-I$inc_dir";
879 # probes for libpng via pkg-config
881 my ($frm, $frmkey) = @_;
883 is_exe('pkg-config') or return;
886 for my $check_conf (qw(libpng libpng12 libpng10)) {
887 if (_pkg_probe($check_conf)) {
888 $config = $check_conf;
894 my $cflags = `pkg-config $config --cflags`
897 my $lflags = `pkg-config $config --libs`
902 $frm->{cflags} = $cflags;
903 $frm->{lflags} = $lflags;
905 printf "%10s: configured via `pkg-config $config ...`\n", $frmkey;
911 return File::Spec->catfile(@_);
917 my @exe_suffix = $Config{_exe};
918 if ($^O eq 'MSWin32') {
919 push @exe_suffix, qw/.bat .cmd/;
922 for my $dir (File::Spec->path) {
923 for my $suffix (@exe_suffix) {
924 -x catfile($dir, "$name$suffix")
934 Usage: $0 [--enable feature1,feature2,...] [other options]
935 $0 [--disable feature1,feature2,...] [other options]
937 Possible feature names are:
938 png gif ungif jpeg tiff T1-fonts TT-fonts freetype2
941 Verbose library probing (or set IM_VERBOSE in the environment)
943 Disable logging (or set IM_NOLOG in the environment)
945 Add to the include search path
947 Add to the library search path
949 Build for coverage testing.
951 Build with assertions active.
953 Disable EXIF parsing.
959 # generate the PM MM argument
960 # I'd prefer to modify the public version, but there doesn't seem to be
961 # a public API to do that
964 my $instbase = '$(INST_LIBDIR)';
966 # first the basics, .pm and .pod files
967 $pm{"Imager.pm"} = "$instbase/Imager.pm";
969 my $mani = maniread();
971 for my $filename (keys %$mani) {
972 if ($filename =~ m!^lib/! && $filename =~ /\.(pm|pod)$/) {
973 (my $work = $filename) =~ s/^lib//;
974 $pm{$filename} = $instbase . $work;
979 $pm{typemap} = $instbase . '/Imager/typemap';
981 # and the core headers
982 for my $filename (keys %$mani) {
983 if ($filename =~ /^\w+\.h$/) {
984 $pm{$filename} = $instbase . '/Imager/include/' . $filename;
988 # and the generated header
989 $pm{"imconfig.h"} = $instbase . '/Imager/include/imconfig.h';
998 if ($path =~ m!^~[/\\]!) {
999 defined $home or $home = $ENV{HOME};
1000 if (!defined $home && $^O eq 'MSWin32'
1001 && defined $ENV{HOMEDRIVE} && defined $ENV{HOMEPATH}) {
1002 $home = $ENV{HOMEDRIVE} . $ENV{HOMEPATH};
1004 unless (defined $home) {
1005 $home = eval { (getpwuid($<))[7] };
1007 defined $home or die "You supplied $path, but I can't find your home directory\n";
1009 $path = File::Spec->catdir($home, $path);
1015 sub postcheck_tiff {
1016 my ($format, $frm) = @_;
1018 -d "probe" or mkdir "probe";
1020 my $tiffver_name = "probe/tiffver.txt";
1023 if ($Config{cc} =~ /\b(cl|bcc)\b/) {
1030 # setup LD_RUN_PATH to match link time
1031 my $lopts = join " " , map("-L$_", @{$format->{libdir}}), " -ltiff";
1032 my ($extra, $bs_load, $ld_load, $ld_run_path) =
1033 ExtUtils::Liblist->ext($lopts, $VERBOSE);
1034 local $ENV{LD_RUN_PATH};
1037 print "Setting LD_RUN_PATH=$ld_run_path for TIFF probe\n" if $VERBOSE;
1038 $ENV{LD_RUN_PATH} = $ld_run_path;
1046 incpath => $format->{incdir},
1047 libpath => $format->{libdir},
1049 header => [ qw(stdio.h tiffio.h) ],
1050 function => <<FUNCTION,
1052 const char *vers = TIFFGetVersion();
1053 FILE *f = fopen("$tiffver_name", "wb");
1066 unless ($good && -s $tiffver_name
1067 && open(VERS, "< $tiffver_name")) {
1068 unlink $tiffver_name unless $KEEP_FILES;
1070 **tiff: cannot determine libtiff version number
1076 # version file seems to be there, load it up
1077 my $ver_str = do { local $/; <VERS> };
1079 unlink $tiffver_name unless $KEEP_FILES;
1081 my ($version) = $ver_str =~ /(\d+\.\d+\.\d+)/;
1083 if ($version eq '3.9.0') {
1085 **tiff: libtiff 3.9.0 introduced a serious bug, please install 3.9.1
1094 # This isn't a module, but some broken tools, like
1095 # Module::Depends::Instrusive insist on treating it like one.
1097 # http://rt.cpan.org/Public/Bug/Display.html?id=21229