]> git.imager.perl.org - imager.git/blobdiff - Makefile.PL
- the image resulting from a crop is now the same type as the
[imager.git] / Makefile.PL
index 796185fc63f67d67f687b26942f8c838680ae11e..d955c2fe8631eaa7413f74240f2171b87d5a63b1 100644 (file)
@@ -1,4 +1,4 @@
-
+#!perl -w
 use ExtUtils::MakeMaker;
 use Cwd;
 use Config;
@@ -21,6 +21,7 @@ $aext=$Config{'_a'};
 # IM_CFLAGS       Extra flags to pass to the compiler
 # IM_LFLAGS       Extra flags to pass to the linker
 # IM_DFLAGS       Extra flags to pass to the preprocessor
+# IM_SUPPRESS_PROMPT  Suppress the prompt asking about gif support
 
 
 getenv();     # get environment variables
@@ -49,8 +50,9 @@ for $frm(values %formats) {
   $F_OBJECT .= ' '  .$frm->{objfiles};
 }
 
-$F_INC  = join(" ",map { (exists $definc{$_})?'':'-I'.$_ } @incs);
-$F_LIBS = join(" ",map { '-L'.$_ } @libs).' '.$F_LIBS;
+$F_INC  = join ' ', map "-I$_", map / / ? qq{"$_"} : $_, 
+  grep !exists $definc{$_}, @incs;
+$F_LIBS = join(' ',map "-L$_", map / / ? qq{"$_"} : $_, @libs) . $F_LIBS;
 
 $OSLIBS = '';
 $OSDEF  = "-DOS_$^O";
@@ -58,11 +60,12 @@ $OSDEF  = "-DOS_$^O";
 if ($^O eq 'hpux')                { $OSLIBS .= ' -ldld'; }
 if (defined $Config{'d_dlsymun'}) { $OSDEF  .= ' -DDLSYMUN'; }
 
-@objs = qw(Imager.o draw.o image.o io.o iolayer.o log.o
-          gaussian.o conv.o pnm.o raw.o feat.o font.o
+@objs = qw(Imager.o draw.o polygon.o image.o io.o iolayer.o
+           log.o gaussian.o conv.o pnm.o raw.o feat.o font.o
           filters.o dynaload.o stackmach.o datatypes.o
           regmach.o trans2.o quant.o error.o convert.o
-          map.o);
+          map.o tags.o palimg.o maskimg.o img16.o rotate.o
+           bmp.o tga.o rgb.o color.o fills.o imgdouble.o);
 
 %opts=(
        'NAME'         => 'Imager',
@@ -88,7 +91,7 @@ exit;
 
 sub MY::postamble {
 '
-dyntest.(MYEXTLIB) : dynfilt/Makefile
+dyntest.$(MYEXTLIB) : dynfilt/Makefile
        cd dynfilt && $(MAKE) $(PASTHRU)
 
 lib/Imager/Regops.pm : regmach.h regops.perl
@@ -113,7 +116,7 @@ EOF
   SWX:
     if ($formats{$frm}{docs}) { print "\n",$formats{$frm}{docs},"\n\n"; }
     print "Enable $frm support: ";
-    $gz=<STDIN>;
+    $gz = <STDIN>;
     chomp($gz);
     if ($gz =~ m/^(y|yes|n|no)/i) {
       $gz=substr(lc($gz),0,1);
@@ -135,10 +138,35 @@ sub automatic {
 
 
 sub gifcheck {
-  if ($formats{'gif'} and $formats{'ungif'}) { 
+  if ($formats{'gif'} and $formats{'ungif'}) {
     print "ungif and gif can not coexist - removing ungif support\n";
     delete $formats{'ungif'};
   }
+
+ RETR:
+  if (($formats{'gif'} or $formats{'ungif'}) && !$ENV{IM_SUPPRESS_PROMPT}) {
+    print <<EOFF;
+
+You have libgif or libungif installed.  They are both known to have
+bugs.  Imager can crash or display other strange behaviour after
+reading or writing gif images.  Some of the gif tests can even fail
+since they stress some parts of the buggy code.
+
+Do you want to remove gif support? [Y/n]
+EOFF
+    my $resp = <STDIN>;
+    chomp($resp);
+    if ($resp ne "n") {
+      delete $formats{'gif'};
+      delete $formats{'ungif'};
+      return;
+    }
+  }
+
+  for my $frm (qw(gif ungif)) {
+    checkformat($frm) if ($MANUAL and $formats{$frm});
+  }
+
   my @dirs;
   for my $frm (grep $formats{$_}, qw(gif ungif)) {
     push(@dirs, @{$formats{$frm}{incdir}}) if $formats{$frm}{incdir};
@@ -210,13 +238,13 @@ sub pathcheck {
     print "  Include paths:\n";
     for (@incs) { print $_,"\n"; }
   }
-  @incs=grep { -d $_ && -r _ && -x _ or ( print("  $_ doesnt exist or is unaccessible - removed."),0) } @incs;
+  @incs=grep { -d $_ && -r _ && -x _ or ( print("  $_ doesnt exist or is unaccessible - removed.\n"),0) } @incs;
 
   if ($VERBOSE) {
     print "\nLibrary paths:\n";
     for (@incs) { print $_,"\n"; }
   }
-  @libs=grep { -d $_ && -r _ && -x _ or ( print("  $_ doesnt exist or is unaccessible - removed."),0) } @libs;
+  @libs=grep { -d $_ && -r _ && -x _ or ( print("  $_ doesnt exist or is unaccessible - removed.\n"),0) } @libs;
   print "\ndone.\n";
 }
 
@@ -236,12 +264,20 @@ sub pathcheck {
 sub init {
 
   @definc{'/usr/include'}=();
-  @incs=(qw(/usr/include /usr/local/include /usr/include/freetype /usr/local/include/freetype), split /:/, $INCPATH );
-  @libs=(split(/ /, $Config{'libpth'}), split(/:/, $LIBPATH) );
+  @incs=(split(/\Q$Config{path_sep}/, $INCPATH), 
+         qw(/sw/include /usr/include/freetype2 /usr/local/include/freetype2 
+            /usr/include /usr/local/include /usr/include/freetype 
+            /usr/local/include/freetype));
+  @libs=(split(/\Q$Config{path_sep}/,$LIBPATH), 
+         qw(/sw/lib),  split(/ /, $Config{'libpth'}));
   if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
     push(@incs, split /;/, $ENV{INCLUDE}) if exists $ENV{INCLUDE};
     push(@libs, split /;/, $ENV{LIB}) if exists $ENV{LIB};
   }
+  if ($^O eq 'cygwin') {
+    push(@libs, '/usr/lib/w32api') if -d '/usr/lib/w32api';
+    push(@incs, '/usr/include/w32api') if -d '/usr/lib/w32api';
+  }
 
   $formats{'jpeg'}={
                    order=>'21',
@@ -313,7 +349,7 @@ sub init {
                        order=>'30',
                        def=>'HAVE_LIBT1',
                        inccheck=>sub { $_[0] eq 't1lib.h' },
-                       libcheck=>sub { $_[0] eq 'libt1.a' or $_[0] eq "libt1.$lext" },
+                       libcheck=>sub { $_[0] eq "libt1$aext" or $_[0] eq "libt1.$lext" },
                        libfiles=>'-lt1',
                        objfiles=>'',
                        docs=>q{
@@ -327,7 +363,7 @@ sub init {
                        order=>'31',
                        def=>'HAVE_LIBTT',
                        inccheck=>sub { $_[0] eq 'freetype.h' },
-                       libcheck=>sub { $_[0] eq 'libttf.a' or $_[0] eq "libttf.$lext" },
+                       libcheck=>sub { $_[0] eq "libttf$aext" or $_[0] eq "libttf.$lext" },
                        libfiles=>'-lttf',
                        objfiles=>'',
                        docs=>q{
@@ -337,6 +373,32 @@ sub init {
                                used to rasterize for us. The only drawback is that there
                                are alot of badly designed fonts out there.}
                       };
+  $formats{'w32'} = {
+                    order=>40,
+                    def=>'HAVE_WIN32',
+                    inccheck=>sub { lc $_[0] eq 'windows.h' },
+                    libcheck=>sub { lc $_[0] eq 'gdi32.lib' 
+                                      || lc $_[0] eq 'libgdi32.a' },
+                    libfiles=>$^O eq 'cygwin' ? '-lgdi32' : '',
+                    objfiles=>'win32.o',
+                    docs => <<DOCS
+Uses the Win32 GDI for rendering text.
+
+This currently only works on under normal Win32 and cygwin.
+DOCS
+                   };
+  $formats{'freetype2'} = {
+                           order=>'29',
+                           def=>'HAVE_FT2',
+                           inccheck=>sub { lc $_[0] eq 'ft2build.h' },
+                           libcheck=>sub { $_[0] eq "libfreetype$aext" or $_[0] eq "libfreetype.$lext" },
+                           libfiles=>'-lfreetype',
+                           objfiles=>'freetyp2.o',
+                           docs=><<DOCS
+Freetype 2 supports both Truetype and Type 1 fonts, both of which are
+scalable.
+DOCS
+                          };
   # Make fix indent
   for (keys %formats) { $formats{$_}->{docs} =~ s/^\s+/  /mg; }
 }