X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FMakefile.PL;h=0b5650ca23b792e4a607451eaf55599ff827223f;hb=65d3968699a119a2c21278c19bdbdf98c67d98ea;hp=34d350e09c4cef61eb5b630357b2a168f17c92c7;hpb=9915cd6df96c538c63594b45c328928729eaf9e2;p=catagits%2Ffcgi2.git diff --git a/perl/Makefile.PL b/perl/Makefile.PL index 34d350e..0b5650c 100644 --- a/perl/Makefile.PL +++ b/perl/Makefile.PL @@ -1,9 +1,10 @@ -# $Id: Makefile.PL,v 1.5 2000/11/01 14:27:49 skimo Exp $ +# $Id: Makefile.PL,v 1.11 2001/06/08 15:09:47 skimo Exp $ use ExtUtils::MakeMaker; use IO::File; use Config; use Cwd 'cwd'; +use Getopt::Long; @h1 = qw(fastcgi.h fcgiapp.h fcgiappmisc.h fcgimisc.h fcgios.h); @h = (@h1, 'fcgi_config.h'); @@ -12,11 +13,24 @@ use Cwd 'cwd'; @dist2 = qw(fcgiapp.c os_unix.c os_win32.c); @dist3 = (@h1, qw(fcgi_config.h.in fcgi_config_x86.h)); +GetOptions ("pure-perl!" => \$pure); +$pure = + (prompt("Do you want to use the pure perl implementation", "no") =~ /^y/) + ? "1" : "0" unless defined $pure; +open(CFG,">FCGI.cfg"); +print CFG "\$pure = $pure;1;\n"; +close CFG; + $devkit = cwd() . "/.."; -if (-d "$devkit/libfcgi/" && -f "$devkit/libfcgi/libfcgi.a" +if (-d "$devkit/libfcgi/" && -d "$devkit/include" && !grep {!-f "$devkit/include/$_"} (@h)) { + unless (-f "$devkit/libfcgi/libfcgi.a") { + warn "Please compile the library before attempting " . + "to compile the perl module.\n"; + exit -1; + } # devkit $prefix = $devkit; push @libs, "-L$devkit/libfcgi -lfcgi"; @@ -50,15 +64,33 @@ push(@extras, ABSTRACT => 'Fast CGI module', AUTHOR => 'Sven Verdoolaege (skimo@kotnet.org)') if ($ExtUtils::MakeMaker::VERSION >= 5.4301); + +$plfiles = { 'echo.PL' => 'echo.fpl', + 'remote.PL' => 'remote.fpl', + 'threaded.PL' => 'threaded.fpl', + 'FCGI.PL' => 'FCGI.pm', + }; +$plfiles->{'FCGI.XL'} = 'FCGI.xs' unless $pure; +if ($pure) { + push @extras, + LINKTYPE => ' '; +} else { + push @extras, + 'LIBS' => [ @libs ], + 'OBJECT' => "@o", + 'INC' => $inc; +} # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. -WriteMakefile( + +# Work around bug in previous versions of MakeMaker +WriteMakefile(NAME => 'FCGI') + if $ExtUtils::MakeMaker::VERSION <= 5.4302; + +$mm = MM->new({ 'NAME' => 'FCGI', - 'VERSION_FROM' => 'FCGI.pm', - 'LIBS' => [ @libs ], - 'OBJECT' => "@o", - 'INC' => $inc, + 'VERSION_FROM' => 'FCGI.PL', 'dist' => { 'COMPRESS' => 'gzip -9f', 'SUFFIX' => 'gz', 'PREOP' => '$(CP) '.join(' ', @@ -71,25 +103,28 @@ WriteMakefile( 'POSTOP' => '$(MV) MANIFEST.old MANIFEST', }, - 'clean' => { FILES => 'config.cache fcgi_config.h' }, - 'PL_FILES' => { 'echo.PL' => 'echo.fpl', - 'remote.PL' => 'remote.fpl', - 'threaded.PL' => 'threaded.fpl', - 'FCGI.PL' => 'FCGI.xs', - }, + 'clean' => { FILES => 'config.cache fcgi_config.h' . + ' FCGI.xs FCGI.c FCGI.cfg ' . + (join ' ', values %$plfiles)}, + 'PL_FILES' => $plfiles, + PM => {'FCGI.pm' => '$(INST_ARCHLIBDIR)/FCGI.pm'}, @extras, -); +}); +# don't install oldinterface pod +delete $mm->{MAN3PODS}{oldinterface.pod}; +$mm->flush; -exit if -f 'fcgi_config.h' or $prefix; +exit if -f 'fcgi_config.h' or $prefix or $pure; # CPAN and no installed lib found if ($sys eq "win32") { # configure will almost certainly not run on a normal NT install, # use the pregenerated configuration file + use File::Copy qw(copy); print "Using prebuilt fcgi_config.h file for Windows\n"; unlink("fcgi_config.h"); - die $! unless rename("fcgi_config_x86.h","fcgi_config.h"); + die $! unless copy("fcgi_config_x86.h","fcgi_config.h"); # Win build system also can't deal with existence of FCGI.xs or absence of # FCGI.c