use strict; # XXX better static build support use Config; use ExtUtils::MakeMaker qw(WriteMakefile); use File::Spec::Functions; use Getopt::Long; my (@INC, @LIBPATH, @LIBS); my ($JPEG, $PNG, $GIF, $MYEXTLIB); my ($JPEG_VERSION, $PNG_VERSION, $GIF_VERSION); my ($help, $jpeg_inc, $jpeg_lib, $png_inc, $png_lib, $gif_inc, $gif_lib); my ($jpeg_static, $png_static, $gif_static); my $DEFINES = '-O2'; # I tested -funroll-loops, it is slightly slower $DEFINES .= ' -Wall' unless $^O =~ /sun|solaris/i; $DEFINES .= ' -Wno-unused-value -Wno-format-security -Winline' unless $^O =~ /Win32|sun|solaris/i; if ( $^O !~ /Win32/ ) { # Check for Sparc ReadyNAS to enable ASM code if ( -e '/etc/raidiator_version' ) { if ( $Config{archname} eq 'sparc-linux' ) { $DEFINES .= ' -DPADRE'; } } } my $result = GetOptions( "help|h" => \$help, "with-jpeg-includes=s" => \$jpeg_inc, "with-jpeg-libs=s" => \$jpeg_lib, "with-jpeg-static" => \$jpeg_static, "with-png-includes=s" => \$png_inc, "with-png-libs=s" => \$png_lib, "with-png-static" => \$png_static, "with-gif-includes=s" => \$gif_inc, "with-gif-libs=s" => \$gif_lib, "with-gif-static" => \$gif_static, ); if ($help || !$result) { print STDERR < 'Image::Scale', VERSION_FROM => 'lib/Image/Scale.pm', PREREQ_PM => { 'Test::NoWarnings' => 0 }, ABSTRACT_FROM => 'lib/Image/Scale.pm', AUTHOR => 'Andy Grundman ', INC => join(' ', @INC), LIBS => [ join(' ', @LIBPATH, @LIBS) ], DEFINE => $DEFINES, MYEXTLIB => $MYEXTLIB, depend => { 'Scale.c' => "$inc_files $src_files" }, ); sub _re_find { my ( $file, $re ) = @_; my $result; open my $fh, '<', $file or die "Unable to read $file\n"; while ( my $line = <$fh> ) { if ( $line =~ $re ) { $result = $1; last; } } close $fh; return $result; }