- start of external Imager API access:
[imager.git] / Makefile.PL
1 #!perl -w
2 use ExtUtils::MakeMaker;
3 use Cwd;
4 use Config;
5 use File::Spec;
6 use Getopt::Long;
7 use vars qw(%Recommends);
8 require "metafile.pl";
9 use ExtUtils::Manifest qw(maniread);
10
11 #
12 # IM_INCPATH      colon seperated list of paths to extra include paths
13 # IM_LIBPATH      colon seperated list of paths to extra library paths
14 #
15 # IM_VERBOSE      turns on verbose mode for the library finding and such
16 # IM_MANUAL       to manually select which libraries are used and which not
17 # IM_ENABLE       to programmatically select which libraries are used
18 #                 and which are not
19 # IM_NOLOG        if true logging will not be compiled into the module
20 # IM_DEBUG_MALLOC if true malloc debbuging will be compiled into the module
21 #                 do not use IM_DEBUG_MALLOC in production - this slows
22 #                 everything down by alot
23 # IM_CFLAGS       Extra flags to pass to the compiler
24 # IM_LFLAGS       Extra flags to pass to the linker
25 # IM_DFLAGS       Extra flags to pass to the preprocessor
26 # IM_SUPPRESS_PROMPT  Suppress the prompt asking about gif support
27
28 getenv();     # get environment variables
29
30 my $help;
31 my @enable;
32 my @disable;
33 my @incpaths;
34 my @libpaths;
35 my $noprobe;
36 my $noexif;
37 GetOptions("help" => \$help,
38            "enable=s" => \@enable,
39            "disable=s" => \@disable,
40            "incpath=s", \@incpaths,
41            "libpath=s" => \@libpaths,
42            "noprobe" => \$noprobe,
43            "verbose|v" => \$VERBOSE,
44            "nolog" => \$NOLOG,
45            "noexif" => \$noexif);
46
47 if ($VERBOSE) { 
48   print "Verbose mode\n"; 
49   require Data::Dumper; 
50   import Data::Dumper qw(Dumper);
51 }
52
53 if ($help) {
54   usage();
55 }
56
57 my @defines;
58
59 if ($NOLOG)   { print "Logging not compiled into module\n"; }
60 else { 
61   push @defines, [ IMAGER_LOG => 1, "Logging system" ];
62 }
63
64 if ($DEBUG_MALLOC) {
65   push @defines, [ IMAGER_DEBUG_MALLOC => 1, "Use Imager's DEBUG malloc()" ];
66   print "Malloc debugging enabled\n";
67 }
68
69 if (@enable && @disable) {
70   print STDERR "Only --enable or --disable can be used, not both, try --help\n";
71   exit 1;
72 }
73
74 init();       # initialize global data
75 pathcheck();  # Check if directories exist
76
77 if (exists $ENV{IM_ENABLE}) {
78   my %en = map { $_, 1 } split ' ', $ENV{IM_ENABLE};
79   for my $key (keys %formats) {
80     delete $formats{$key} unless $en{$key};
81   }
82 }
83 if (@enable) {
84   my %en = map { $_ => 1 } map { split /,/ } @enable;
85   for my $key (keys %formats) {
86     delete $formats{$key} unless $en{$key};
87   }
88 }
89 elsif (@disable) {
90   delete @formats{map { split /,/ } @disable};
91 }
92
93 # Pick what libraries are used
94 if ($MANUAL) {
95   manual();
96 } else {
97   automatic();
98 }
99
100 # Make sure there isn't a clash between the gif libraries.
101 gifcheck();
102
103 my $lib_cflags = '';
104 my $F_LIBS = '';
105 my $F_OBJECT = '';
106 for my $frmkey (keys %formats) {
107   my $frm = $formats{$frmkey};
108   push @defines, [ $frm->{def}, 1, "$frmkey available" ];
109   $F_LIBS   .= ' '  .$frm->{libfiles};
110   $F_OBJECT .= ' '  .$frm->{objfiles};
111   $lib_cflags   .= ' '  .$frm->{cflags} if $frm->{cflags};
112 }
113 unless ($noexif) {
114   print "EXIF support enabled\n";
115   push @defines, [ 'IMEXIF_ENABLE', 1, "Enable experimental EXIF support" ];
116   $F_OBJECT .= ' imexif.o';
117 }
118
119 $F_INC  = join ' ', map "-I$_", map / / ? qq{"$_"} : $_, 
120   grep !exists $definc{$_}, @incs;
121 $F_LIBS = join(' ',map "-L$_", map / / ? qq{"$_"} : $_, @libs) . $F_LIBS;
122
123 $OSLIBS = '';
124 $OSDEF  = "-DOS_$^O";
125
126 if ($^O eq 'hpux')                { $OSLIBS .= ' -ldld'; }
127 if (defined $Config{'d_dlsymun'}) { $OSDEF  .= ' -DDLSYMUN'; }
128
129 @objs = qw(Imager.o draw.o polygon.o image.o io.o iolayer.o
130            log.o gaussian.o conv.o pnm.o raw.o feat.o font.o
131            filters.o dynaload.o stackmach.o datatypes.o
132            regmach.o trans2.o quant.o error.o convert.o
133            map.o tags.o palimg.o maskimg.o img16.o rotate.o
134            bmp.o tga.o rgb.o color.o fills.o imgdouble.o limits.o hlines.o
135            imext.o);
136
137 $Recommends{Imager} =
138   { 'Parse::RecDescent' => 0 };
139
140 %opts=(
141        'NAME'         => 'Imager',
142        'VERSION_FROM' => 'Imager.pm',
143        'LIBS'         => "$LFLAGS -lm $OSLIBS $F_LIBS",
144        'DEFINE'       => "$OSDEF $CFLAGS",
145        'INC'          => "$lib_cflags $DFLAGS $F_INC",
146        'OBJECT'       => join(' ', @objs, $F_OBJECT),
147        clean          => { FILES=>'testout meta.tmp' },
148        PM             => gen_PM(),
149       );
150
151 if ($ExtUtils::MakeMaker::VERSION > 6.06) {
152   $opts{AUTHOR} = 'Tony Cook <tony@imager.perl.org>, Arnar M. Hrafnkelsson';
153   $opts{ABSTRACT} = 'Perl extension for Generating 24 bit Images';
154 }
155
156 make_imconfig(\@defines);
157
158 if ($VERBOSE) { print Dumper(\%opts); }
159 mkdir('testout',0777); # since we cannot include it in the archive.
160 WriteMakefile(%opts);
161
162 exit;
163
164
165 sub MY::postamble {
166 '
167 dyntest.$(MYEXTLIB) : dynfilt/Makefile
168         cd dynfilt && $(MAKE) $(PASTHRU)
169
170 lib/Imager/Regops.pm : regmach.h regops.perl
171         $(PERL) regops.perl regmach.h lib/Imager/Regops.pm
172
173 imconfig.h : Makefile.PL
174         $(ECHO) "imconfig.h out-of-date with respect to $?"
175         $(PERLRUN) Makefile.PL
176         $(ECHO) "==> Your Makefile has been rebuilt - re-run your make command <=="
177
178 lib/Imager/APIRef.pm : $(C_FILES) apidocs.perl
179         $(PERLRUN) apidocs.perl lib/Imager/APIRef.pm
180
181 ';
182
183 }
184
185 # manual configuration of helper libraries
186
187 sub manual {
188   print <<EOF;
189
190       Please answer the following questions about
191       which formats are avaliable on your computer
192
193 press <return> to continue
194 EOF
195
196   <STDIN>; # eat one return
197
198   for my $frm(sort { $formats{$b}{order} <=> $formats{$a}{order} } keys %formats) {
199   SWX:
200     if ($formats{$frm}{docs}) { print "\n",$formats{$frm}{docs},"\n\n"; }
201     print "Enable $frm support: ";
202     $gz = <STDIN>;
203     chomp($gz);
204     if ($gz =~ m/^(y|yes|n|no)/i) {
205       $gz=substr(lc($gz),0,1);
206       if ($gz eq 'n') {
207         delete $formats{$frm};
208       }
209     } else { goto SWX; }
210   }
211 }
212
213
214 # automatic configuration of helper libraries
215
216 sub automatic {
217   for $frm(keys %formats) {
218     delete $formats{$frm} if !checkformat($frm);        
219   }
220 }
221
222
223 sub gifcheck {
224   if ($formats{'gif'} and $formats{'ungif'}) {
225     print "ungif and gif can not coexist - removing ungif support\n";
226     delete $formats{'ungif'};
227   }
228
229  RETR:
230   if (($formats{'gif'} or $formats{'ungif'}) && !$ENV{IM_SUPPRESS_PROMPT}) {
231     print <<EOFF;
232
233 You have libgif or libungif installed.  They are both known to have
234 bugs.  Imager can crash or display other strange behaviour after
235 reading or writing gif images.  Some of the gif tests can even fail
236 since they stress some parts of the buggy code.
237
238 libungif 4.1.2 and later is safe.  giflib 4.1.3 needs at least one
239 patch to have all the bugs fixed, see README for details.
240
241 Of course it's possible your operating system distributor has patched
242 all of these problems and you have nothing to worry about.
243
244 Do you want to remove gif support? [Y/n]
245 EOFF
246     my $resp = <STDIN>;
247     chomp($resp);
248     if ($resp ne "n") {
249       delete $formats{'gif'};
250       delete $formats{'ungif'};
251       return;
252     }
253   }
254
255   for my $frm (qw(gif ungif)) {
256     checkformat($frm) if ($MANUAL and $formats{$frm});
257   }
258
259   my @dirs;
260   for my $frm (grep $formats{$_}, qw(gif ungif)) {
261     push(@dirs, @{$formats{$frm}{incdir}}) if $formats{$frm}{incdir};
262   }
263   my $minor = 0;
264   my $major = 0;
265   FILES: for my $dir (@dirs) {
266     my $h = "$dir/gif_lib.h";
267     open H, "< $h" or next;
268     while (<H>) {
269       if (/GIF_LIB_VERSION\s+"\s*version\s*(\d+)\.(\d+)/i) {
270         $major = $1;
271         $minor = $2;
272         close H;
273         last FILES;
274       }
275     }
276     close H;
277   }
278
279   # we need the version in a #ifdefable form
280
281   push @defines, [ IM_GIFMAJOR, $major, "Parsed giflib version" ];
282   push @defines, [ IM_GIFMINOR, $minor ];
283 }
284
285
286 sub gd {
287   my($path,$chk)=@_;
288
289 #    print "checking path $path\n";
290   if ( !opendir(DH,$path) ) {
291     warn "Cannot open dir $path: $!\n";
292     return;
293   }
294   my @l=grep { $chk->($_) } readdir(DH);
295   #    print @l;
296   close(DH);
297   return map $path, @l;
298 }
299
300
301 sub checkformat {
302   my $frm=shift;
303   
304   my $code = $formats{$frm}{'code'};
305   if ($code && !$noprobe) {
306     return 1 if $code->($formats{$frm}, $frm);
307   }
308
309   my $libchk=$formats{$frm}{'libcheck'};
310   my $incchk=$formats{$frm}{'inccheck'};
311
312   my @l;
313   for my $lp (@libs) {
314     push(@l, gd($lp,$libchk));
315   }
316
317   my @i;
318   for my $ip (@incs) {
319     push(@i, $ip) if $incchk->($ip,$frm);
320   }
321
322   printf("%10s: includes %s - libraries %s\n",$frm,(@i?'found':'not found'),(@l?'found':'not found'));
323   $formats{$frm}{incdir} = \@i;
324   $formats{$frm}{libdir} = \@l;
325   return scalar(@i && @l);
326 }
327
328
329 sub pathcheck {
330   if ($VERBOSE) {
331     print "pathcheck\n";
332     print "  Include paths:\n";
333     for (@incs) { print $_,"\n"; }
334   }
335   @incs=grep { -d $_ && -r _ && -x _ or ( print("  $_ doesnt exist or is unaccessible - removed.\n"),0) } @incs;
336
337   if ($VERBOSE) {
338     print "\nLibrary paths:\n";
339     for (@libs) { print $_,"\n"; }
340   }
341   @libs=grep { -d $_ && -r _ && -x _ or ( print("  $_ doesnt exist or is unaccessible - removed.\n"),0) } @libs;
342   print "\ndone.\n";
343 }
344
345
346 # Format data initialization
347
348 # format definition is:
349 # defines needed
350 # default include path
351 # files needed for include (boolean perl code)
352 # default lib path
353 # libs needed
354 # files needed for link (boolean perl code)
355 # object files needed for the format
356
357
358 sub init {
359
360   @definc{'/usr/include'}=();
361   @incs=(split(/\Q$Config{path_sep}/, $INCPATH),
362         map { split /\Q$Config{path_sep}/} @incpaths );
363   if ($Config{locincpth}) {
364     push @incs, grep -d, split ' ', $Config{locincpth};
365   }
366   if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
367     push(@incs, split /;/, $ENV{INCLUDE}) if exists $ENV{INCLUDE};
368   }
369   push @incs, grep -d,
370       qw(/sw/include 
371          /usr/include/freetype2
372          /usr/local/include/freetype2
373          /usr/local/include/freetype1/freetype
374          /usr/include /usr/local/include /usr/include/freetype
375          /usr/local/include/freetype);
376
377   @libs= ( split(/\Q$Config{path_sep}/,$LIBPATH),
378     map { split /\Q$Config{path_sep}/} @libpaths );
379   if ($Config{loclibpth}) {
380     push @libs, grep -d, split ' ', $Config{loclibpth};
381   }
382   push @libs, grep -d, qw(/sw/lib),  split(/ /, $Config{'libpth'});
383   if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
384     push(@libs, split /;/, $ENV{LIB}) if exists $ENV{LIB};
385   }
386   if ($^O eq 'cygwin') {
387     push(@libs, '/usr/lib/w32api') if -d '/usr/lib/w32api';
388     push(@incs, '/usr/include/w32api') if -d '/usr/include/w32api';
389   }
390
391   my $lext=$Config{'so'};   # Get extensions of libraries
392   my $aext=$Config{'_a'};
393
394   $formats{'jpeg'}={
395                     order=>'21',
396                     def=>'HAVE_LIBJPEG',
397                     inccheck=>sub { -e catfile($_[0], 'jpeglib.h') },
398                     libcheck=>sub { $_[0] eq "libjpeg$aext" or $_ eq "libjpeg.$lext" },
399                     libfiles=>'-ljpeg',
400                     objfiles=>'jpeg.o',
401                     docs=>q{
402                             In order to use jpeg with this module you need to have libjpeg
403                             installed on your computer}
404                    };
405
406   $formats{'tiff'}={
407                     order=>'23',
408                     def=>'HAVE_LIBTIFF',
409                     inccheck=>sub { -e catfile($_[0], 'tiffio.h') },
410                     libcheck=>sub { $_[0] eq "libtiff$aext" or $_ eq "libtiff.$lext" },
411                     libfiles=>'-ltiff',
412                     objfiles=>'tiff.o',
413                     docs=>q{
414                             In order to use tiff with this module you need to have libtiff
415                             installed on your computer}
416                    };
417
418   $formats{'png'}={
419                    order=>'22',
420                    def=>'HAVE_LIBPNG',
421                    inccheck=>sub { -e catfile($_[0], 'png.h') },
422                    libcheck=>sub { $_[0] eq "libpng$aext" or $_[0] eq "libpng.$lext" },
423                    libfiles=>'-lpng -lz',
424                    objfiles=>'png.o',
425                    docs=>q{
426                            Png stands for Portable Network Graphics and is intended as
427                            a replacement for gif on the web. It is patent free and
428                            is recommended by the w3c, you need libpng to use these formats},
429                    code => \&png_probe,
430                   };
431
432   $formats{'gif'}={
433                    order=>'20',
434                    def=>'HAVE_LIBGIF',
435                    inccheck=>sub { -e catfile($_[0], 'gif_lib.h') },
436                    libcheck=>sub { $_[0] eq "libgif$aext" or $_[0] eq "libgif.$lext" },
437                    libfiles=>'-lgif',
438                    objfiles=>'gif.o',
439                    docs=>q{
440                            gif is the de facto standard for webgraphics at the moment,
441                            it does have some patent problems. If you have giflib and
442                            are not in violation with the unisys patent you should use
443                            this instead of the 'ungif' option.  Note that they cannot
444                            be in use at the same time}
445                   };
446
447   $formats{'ungif'}={
448                      order=>'21',
449                      def=>'HAVE_LIBGIF',
450                      inccheck=>sub { -e catfile($_[0], 'gif_lib.h') },
451                      libcheck=>sub { $_[0] eq "libungif$aext" or $_[0] eq "libungif.$lext" },
452                      libfiles=>'-lungif',
453                      objfiles=>'gif.o',
454                      docs=>q{
455                              gif is the de facto standard for webgraphics at the moment,
456                              it does have some patent problems. If you have libungif and
457                              want to create images free from LZW patented compression you
458                              should use this option instead of the 'gif' option}
459                     };
460
461   $formats{'T1-fonts'}={
462                         order=>'30',
463                         def=>'HAVE_LIBT1',
464                         inccheck=>sub { -e catfile($_[0], 't1lib.h') },
465                         libcheck=>sub { $_[0] eq "libt1$aext" or $_[0] eq "libt1.$lext" },
466                         libfiles=>'-lt1',
467                         objfiles=>'',
468                         docs=>q{
469                                 postscript t1 fonts are scalable fonts. They can include 
470                                 ligatures and kerning information and generally yield good
471                                 visual quality. We depend on libt1 to rasterize the fonts
472                                 for use in images.}
473                        };
474
475   $formats{'TT-fonts'}=
476     {
477      order=>'31',
478      def=>'HAVE_LIBTT',
479      inccheck=>sub { -e catfile($_[0], 'freetype.h')
480                        && !-e catfile($_[0], 'fterrors.h') },
481      libcheck=>sub { $_[0] eq "libttf$aext" or $_[0] eq "libttf.$lext" },
482      libfiles=>'-lttf',
483      objfiles=>'',
484      docs=>q{
485 Truetype fonts are scalable fonts. They can include 
486 kerning and hinting information and generally yield good
487 visual quality esp on low resultions. The freetype library is
488 used to rasterize for us. The only drawback is that there
489 are alot of badly designed fonts out there.}
490                        };
491   $formats{'w32'} = {
492                      order=>40,
493                      def=>'HAVE_WIN32',
494                      inccheck=>sub { -e catfile($_[0], 'windows.h') },
495                      libcheck=>sub { lc $_[0] eq 'gdi32.lib' 
496                                        || lc $_[0] eq 'libgdi32.a' },
497                      libfiles=>$^O eq 'cygwin' ? '-lgdi32' : '',
498                      objfiles=>'win32.o',
499                      docs => <<DOCS
500 Uses the Win32 GDI for rendering text.
501
502 This currently only works on under normal Win32 and cygwin.
503 DOCS
504                     };
505   $formats{'freetype2'} = {
506                            order=>'29',
507                            def=>'HAVE_FT2',
508                            inccheck=>sub { -e catfile($_[0], 'ft2build.h') },
509                            libcheck=>sub { $_[0] eq "libfreetype$aext" or $_[0] eq "libfreetype.$lext" },
510                            libfiles=>'-lfreetype',
511                            objfiles=>'freetyp2.o',
512                            docs=><<DOCS,
513 Freetype 2 supports both Truetype and Type 1 fonts, both of which are
514 scalable.  It also supports a variety of other fonts.
515 DOCS
516                            code => \&freetype2_probe,
517                           };
518
519   # Make fix indent
520   for (keys %formats) { $formats{$_}->{docs} =~ s/^\s+/  /mg; }
521 }
522
523
524
525 sub gen {
526   my $V = $ENV{$_[0]};
527   defined($V) ? $V : "";
528 }
529
530
531 # Get information from environment variables
532
533 sub getenv {
534
535   ($VERBOSE,
536    $INCPATH,
537    $LIBPATH,
538    $NOLOG,
539    $DEBUG_MALLOC,
540    $MANUAL,
541    $CFLAGS,
542    $LFLAGS,
543    $DFLAGS) = map { gen $_ } qw(IM_VERBOSE
544                                 IM_INCPATH
545                                 IM_LIBPATH
546                                 IM_NOLOG
547                                 IM_DEBUG_MALLOC
548                                 IM_MANUAL
549                                 IM_CFLAGS
550                                 IM_LFLAGS
551                                 IM_DFLAGS);
552
553 }
554
555 sub make_imconfig {
556   my ($defines) = @_;
557
558   open CONFIG, "> imconfig.h"
559     or die "Cannot create imconfig.h: $!\n";
560   print CONFIG <<EOS;
561 /* This file is automatically generated by Makefile.PL.
562    Don't edit this file, since any changes will be lost */
563
564 #ifndef IMAGER_IMCONFIG_H
565 #define IMAGER_IMCONFIG_H
566 EOS
567   for my $define (@$defines) {
568     if ($define->[2]) {
569       print CONFIG "\n/*\n  $define->[2]\n*/\n\n";
570     }
571     print CONFIG "#define $define->[0] $define->[1]\n";
572   }
573   print CONFIG "\n#endif\n";
574   close CONFIG;
575 }
576
577 # use pkg-config to probe for libraries
578 # works around the junk that pkg-config dumps on FreeBSD
579 sub _pkg_probe {
580   my ($pkg) = @_;
581
582   is_exe('pkg-config') or return;
583
584   my $redir = $^O eq 'MSWin32' ? '' : '2>/dev/null';
585
586   !system("pkg-config $pkg --exists $redir");
587 }
588
589 # probes for freetype2 by trying to run freetype-config
590 sub freetype2_probe {
591   my ($frm, $frmkey) = @_;
592
593   is_exe('freetype-config') or return;
594
595   my $cflags = `freetype-config --cflags`
596     and !$? or return;
597   chomp $cflags;
598   
599   $frm->{cflags} = $cflags;
600   my $lflags = `freetype-config --libs`
601     and !$? or return;
602   chomp $lflags;
603   $frm->{libfiles} = $lflags;
604
605   printf "%10s: configured via freetype-config\n", $frmkey;
606
607   return 1;
608 }
609
610 # probes for libpng via pkg-config
611 sub png_probe {
612   my ($frm, $frmkey) = @_;
613
614   is_exe('pkg-config') or return;
615
616   my $config;
617   for my $check_conf (qw(libpng libpng12 libpng10)) {
618     if (_pkg_probe($check_conf)) {
619       $config = $check_conf;
620       last;
621     }
622   }
623   $config or return;
624
625   my $cflags = `pkg-config $config --cflags`
626     and !$? or return;
627
628   my $lflags = `pkg-config $config --libs`
629     and !$? or return;
630
631   chomp $cflags;
632   chomp $lflags;
633   $frm->{cflags} = $cflags;
634   $frm->{libfiles} = $lflags;
635
636   printf "%10s: configured via `pkg-config $config ...`\n", $frmkey;
637
638   return 1;
639 }
640
641 sub catfile {
642   return File::Spec->catfile(@_);
643 }
644
645 sub is_exe {
646   my ($name) = @_;
647
648   for my $dir (File::Spec->path) {
649     -x catfile($dir, "$name$Config{_exe}")
650       and return 1;
651   }
652
653   return;
654 }
655
656 sub usage {
657   print STDERR <<EOS;
658 Usage: $0 [--enable feature1,feature2,...] [other options]
659        $0 [--disable feature1,feature2,...]  [other options]
660        $0 --help
661 Possible feature names are:
662   png gif ungif jpeg tiff T1-fonts TT-fonts freetype2
663 Other options:
664   --verbose | -v
665     Verbose library probing (or set IM_VERBOSE in the environment)
666   --nolog
667     Disable logging (or set IM_NOLOG in the environment)
668   --incpath dir
669     Add to the include search path
670   --libpath dir
671     Add to the library search path
672   --noprobe
673     Don't use pkg-config or freetype2-config to probe for freetype2 and libpng
674 EOS
675   exit 1;
676
677 }
678
679 # generate the PM MM argument
680 # I'd prefer to modify the public version, but there doesn't seem to be 
681 # a public API to do that
682 sub gen_PM {
683   my %pm;
684   my $instbase = '$(INST_LIBDIR)';
685
686   # first the basics, .pm and .pod files
687   $pm{"Imager.pm"} = "$instbase/Imager.pm";
688
689   my $mani = maniread();
690
691   for my $filename (keys %$mani) {
692     if ($filename =~ m!^lib/! && $filename =~ /\.(pm|pod)$/) {
693       (my $work = $filename) =~ s/^lib//;
694       $pm{$filename} = $instbase . $work;
695     }
696   }
697
698   # need the typemap
699   $pm{typemap} = $instbase . '/Imager/typemap';
700
701   # and the core headers
702   for my $filename (keys %$mani) {
703     if ($filename =~ /^\w+\.h$/) {
704       $pm{$filename} = $instbase . '/Imager/include/' . $filename;
705     }
706   }
707
708   # and the generated header
709   $pm{"imconfig.h"} = $instbase . '/Imager/include/imconfig.h';
710
711   \%pm;
712 }