You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by pg...@apache.org on 2006/07/16 05:23:26 UTC
svn commit: r422345 [2/2] - /perl/modperl/branches/1.x/Makefile.PL
Modified: perl/modperl/branches/1.x/Makefile.PL
URL: http://svn.apache.org/viewvc/perl/modperl/branches/1.x/Makefile.PL?rev=422345&r1=422344&r2=422345&view=diff
==============================================================================
--- perl/modperl/branches/1.x/Makefile.PL (original)
+++ perl/modperl/branches/1.x/Makefile.PL Sat Jul 15 20:23:25 2006
@@ -1,56 +1,57 @@
#!perl
-BEGIN {
- $Is_Win32 = ($^O eq "MSWin32");
+BEGIN {
+ $Is_Win32 = ($^O eq "MSWin32");
$Is_Cygwin = ($^O =~ m/cygwin/g);
- if($Is_Win32) {
+
+ if ($Is_Win32) {
require 5.004_02;
require Win32;
- } elsif($Is_Cygwin) {
- require 5.005_03;
- } else {
- require 5.003_97;
- }
+ }
+ elsif ($Is_Cygwin) {
+ require 5.005_03;
+ }
+ else {
+ require 5.003_97;
+ }
}
sub MMN_130 () { 19980527 }
-use ExtUtils::MakeMaker;
use Config ();
-use FileHandle ();
+use Cwd;
use DirHandle ();
-use File::Compare ();
+use ExtUtils::MakeMaker;
use File::Basename qw(dirname basename);
-use File::Path qw(mkpath rmtree);
-use Cwd;
+use File::Compare ();
use File::Copy qw(cp);
+use File::Path qw(mkpath rmtree);
+use FileHandle ();
-#use Apache::ExtUtils qw(%Config);
-
-unless (%Config) {
- *Config = \%Config::Config;
-}
+*Config = \%Config::Config unless %Config;
-my %vcache = (); #SERVER_VERSION
-my %mcache = (); #MODULE_MAGIC_NUMBER
+my %vcache = (); #SERVER_VERSION
+my %mcache = (); #MODULE_MAGIC_NUMBER
#version 1.5 that ships with 5.003 is broken!
*cp = sub {
system "cp @_";
- for (@_) { -e $_ or die $! }
+ for (@_) {
+ -e $_ or die $!;
+ }
} if $File::Copy::VERSION < 2.0;
-my $Is_dougm = (defined($ENV{USER}) && ($ENV{USER} eq "dougm"));
+my $Is_dougm = defined $ENV{USER} && $ENV{USER} eq "dougm";
my $USE_THREADS;
my $thrlib = join '|', qw(-lpthread);
if ($] < 5.005_60) {
- $USE_THREADS = (defined($Config{usethreads}) &&
- ($Config{usethreads} eq "define"));
+ $USE_THREADS = defined $Config{usethreads} &&
+ $Config{usethreads} eq "define";
}
else {
- $USE_THREADS = (defined($Config{use5005threads}) &&
- ($Config{use5005threads} eq "define"));
+ $USE_THREADS = defined $Config{use5005threads} &&
+ $Config{use5005threads} eq "define";
}
#hmm, seems the #include flip/flop isn't needed anymore
@@ -59,41 +60,41 @@
require "./lib/mod_perl.pm";
$VERSION = $mod_perl::VERSION = $mod_perl::VERSION;
+
{
$VERSION =~ s/(\d\d)(\d\d)$/$1_$2/;
}
+
{
local *FH;
open FH, "Changes";
- while(<FH>) {
- if(/^=item.*-dev/) {
- $VERSION .= "-dev";
- last;
- }
- last if /^=item/;
+ while (<FH>) {
+ if (/^=item.*-dev/) {
+ $VERSION .= "-dev";
+ last;
+ }
+ last if /^=item/;
}
close FH;
}
use subs qw(iedit asrc);
-if($] < 5.004_04) {
+if ($] < 5.004_04) {
print <<EOF;
I see you're building with Perl $]
It is strongly recommended that you upgrade to 5.004_04 or higher,
as there are memory leaks present in lower versions or Perl.
EOF
-sleep(1);
+ sleep 1;
}
-#'
-
%Apache::MyConfig::Setup = ();
eval 'require Apache::MyConfig' ;
-$APACHE_SRC_DEFAULT = $@ ?
+$APACHE_SRC_DEFAULT = $@ ?
'../apache_x.x/src' :
- $Apache::MyConfig::Setup{Apache_Src} ;
+ $Apache::MyConfig::Setup{Apache_Src} ;
#workaround bug in 5.8.0-RC1 where Cwd::cwd creates $ENV{IFS}
#which makes apache configure fall apart on solaris
@@ -105,11 +106,11 @@
$ENV{PERL5LIB} = join ':', "$PWD/lib", $ENV{PERL5LIB};
my %SSL = (
- "modules/ssl/apache_ssl.c" => "Ben-SSL",
- "apache_ssl.c" => "Ben-SSL",
- "mod_ssl.h" => "Stronghold",
- "modules/modssl" => "Stronghold",
-);
+ "modules/ssl/apache_ssl.c" => "Ben-SSL",
+ "apache_ssl.c" => "Ben-SSL",
+ "mod_ssl.h" => "Stronghold",
+ "modules/modssl" => "Stronghold",
+ );
unless (-e "t/docs/test.shtml") {
cp "t/docs/test.html", "t/docs/test.shtml";
@@ -119,7 +120,7 @@
my $file = "t/docs/$_";
local *FH;
open FH, ">$file" or
- die "can't write test file: $file: $!";
+ die "can't write test file: $file: $!";
chmod 0666, $file;
close FH;
}
@@ -130,38 +131,38 @@
chmod 0777, "t/logs";
unless ($Is_Win32) {
- system "chmod a+x t/net/perl/* t/net/perl/io/*";
+ system "chmod a+x t/net/perl/* t/net/perl/io/*";
}
#generated by us at one time or another
my(@do_clean) = qw{
- t/docs/.htaccess
- t/docs/hooks.txt
- src/Configuration
- lib/Apache/MyConfig.pm
- Apache/Apache.xs
- Constants/Constants.xs
- t/modules/ssi.t
- t/logs/error_log
- t/conf/srm.conf
- t/conf/dev-null
- t/logs/httpd.pid
- src/modules/perl/mod_perl_version.h
- t/net/perl/cgi.pl
- t/report
- t/TEST
- t/httpd
- apaci/find_source
- apaci/apxs_cflags
- apaci/mod_perl.config
-};
+ t/docs/.htaccess
+ t/docs/hooks.txt
+ src/Configuration
+ lib/Apache/MyConfig.pm
+ Apache/Apache.xs
+ Constants/Constants.xs
+ t/modules/ssi.t
+ t/logs/error_log
+ t/conf/srm.conf
+ t/conf/dev-null
+ t/logs/httpd.pid
+ src/modules/perl/mod_perl_version.h
+ t/net/perl/cgi.pl
+ t/report
+ t/TEST
+ t/httpd
+ apaci/find_source
+ apaci/apxs_cflags
+ apaci/mod_perl.config
+ };
#t/conf/httpd.conf
#t/net/config.pl
-for(@do_clean) { unlink $_ }
+for (@do_clean) { unlink $_ }
unless ($Is_Win32) {
- rename "t/conf/httpd.conf", "t/conf/httpd.conf.old";
+ rename "t/conf/httpd.conf", "t/conf/httpd.conf.old";
}
rmtree "t/docs/stacked", 0, 0;
@@ -177,21 +178,21 @@
write_version_h("src/modules/perl");
my(@test_pre_init) = qq(
-test_pre_init:
+ test_pre_init:
);
# Automatic setup support
my(@adirs, %seen, %mft_map, %vers_map, $src_dir, $vers, $conf, $ans);
%vers_map = (
- '1.1.1' => "Makefile.tmpl",
- '1.1.3' => "Makefile.tmpl",
- '1.2' => "Makefile.tmpl-1.2",
- '1.1.1Xcert-Sentry' => "Makefile.tmpl-XCert",
- '1.1.1Ben-SSL' => "Makefile.tmpl-Ben-SSL",
- '1.1.3Ben-SSL' => "Makefile.tmpl-Ben-SSL",
- '1.2Ben-SSL' => "",
- NONE => "",
-);
+ '1.1.1' => "Makefile.tmpl",
+ '1.1.3' => "Makefile.tmpl",
+ '1.2' => "Makefile.tmpl-1.2",
+ '1.1.1Xcert-Sentry' => "Makefile.tmpl-XCert",
+ '1.1.1Ben-SSL' => "Makefile.tmpl-Ben-SSL",
+ '1.1.3Ben-SSL' => "Makefile.tmpl-Ben-SSL",
+ '1.2Ben-SSL' => "",
+ NONE => "",
+ );
$LIBPERL = "DEFAULT";
$USE_APACI = $USE_DSO = $USE_APXS = 0;
@@ -242,57 +243,58 @@
$MOD_PERL_PREFIX;
my %experimental = map { $_,1 } qw{
-PERL_AUTOPRELOAD
-PERL_RUN_XS
-PERL_MARK_WHERE
-DO_INTERNAL_REDIRECT
-PERL_TIE_SCRIPTNAME
-PERL_STASH_POST_DATA
-XS_IMPORT
-PERL_SAFE_STARTUP
-PERL_DEFAULT_OPMASK
-PERL_ORALL_OPMASK
-};
+ PERL_AUTOPRELOAD
+ PERL_RUN_XS
+ PERL_MARK_WHERE
+ DO_INTERNAL_REDIRECT
+ PERL_TIE_SCRIPTNAME
+ PERL_STASH_POST_DATA
+ XS_IMPORT
+ PERL_SAFE_STARTUP
+ PERL_DEFAULT_OPMASK
+ PERL_ORALL_OPMASK
+ };
my %PassEnv = map { $_,1 } qw(SSL_BASE);
my @mp_args = (keys %PassEnv,
- qw(EXPERIMENTAL EVERYTHING DO_HTTPD NO_HTTPD CONFIG ADD_MODULE
- APACHE_PREFIX
- USE_APACI USE_DSO USE_APXS WITH_APXS APACI_ARGS PREP_HTTPD
- ALL_HOOKS ADD_VERSION STATIC DYNAMIC PORT XS_IMPORT));
+ qw(EXPERIMENTAL EVERYTHING DO_HTTPD NO_HTTPD CONFIG ADD_MODULE
+ APACHE_PREFIX
+ USE_APACI USE_DSO USE_APXS WITH_APXS APACI_ARGS PREP_HTTPD
+ ALL_HOOKS ADD_VERSION STATIC DYNAMIC PORT XS_IMPORT));
sub is_mp_arg {
- my $arg = shift;
+ my $arg = shift;
return 1 if $experimental{$arg};
for (@mp_args) {
- return 1 if $arg eq $_;
+ return 1 if $arg eq $_;
}
+
return 0;
}
#callback hooks
@callback_hooks = qw{
- PERL_DISPATCH
- PERL_CHILD_INIT PERL_CHILD_EXIT
- PERL_POST_READ_REQUEST PERL_TRANS PERL_HEADER_PARSER
- PERL_ACCESS PERL_AUTHEN PERL_AUTHZ
- PERL_TYPE PERL_FIXUP
- PERL_HANDLER PERL_LOG
- PERL_INIT PERL_CLEANUP PERL_RESTART
- PERL_STACKED_HANDLERS
- PERL_METHOD_HANDLERS
- PERL_DIRECTIVE_HANDLERS
- PERL_TABLE_API
- PERL_LOG_API
- PERL_URI_API
- PERL_UTIL_API
- PERL_FILE_API
- PERL_CONNECTION_API
- PERL_SERVER_API
-};
+ PERL_DISPATCH
+ PERL_CHILD_INIT PERL_CHILD_EXIT
+ PERL_POST_READ_REQUEST PERL_TRANS PERL_HEADER_PARSER
+ PERL_ACCESS PERL_AUTHEN PERL_AUTHZ
+ PERL_TYPE PERL_FIXUP
+ PERL_HANDLER PERL_LOG
+ PERL_INIT PERL_CLEANUP PERL_RESTART
+ PERL_STACKED_HANDLERS
+ PERL_METHOD_HANDLERS
+ PERL_DIRECTIVE_HANDLERS
+ PERL_TABLE_API
+ PERL_LOG_API
+ PERL_URI_API
+ PERL_UTIL_API
+ PERL_FILE_API
+ PERL_CONNECTION_API
+ PERL_SERVER_API
+ };
$callback_alias{PERL_INIT} = "PERL_HEADER_PARSER";
$callback_alias{PERL_CLEANUP} = "PERL_LOG";
@@ -302,99 +304,107 @@
my @mm_args;
{
- my($fh,$file);
+ my ($fh,$file);
for (qw(./ ../ ./. ../.), "$ENV{HOME}/.") {
- last if $fh = FileHandle->new($file = $_."makepl_args.mod_perl");
+ last if $fh = FileHandle->new($file = $_."makepl_args.mod_perl");
}
if($fh) {
- print "Reading Makefile.PL args from $file\n";
- while(<$fh>) {
- chomp;
- s/^\s+//; s/\s+$//;
- next if /^#/ || /^$/;
- last if /^__END__/;
- if(/^APACI_ARGS/) {
- s/^APACI_ARGS=//;
- push @APACI_ARGS, $_;
- }
- else {
- unshift @ARGV, split /\s+/, $_;
- }
- }
- close $fh;
+ print "Reading Makefile.PL args from $file\n";
+ while(<$fh>) {
+ chomp;
+ s/^\s+//; s/\s+$//;
+ next if /^#/ || /^$/;
+ last if /^__END__/;
+ if (/^APACI_ARGS/) {
+ s/^APACI_ARGS=//;
+ push @APACI_ARGS, $_;
+ }
+ else {
+ unshift @ARGV, split /\s+/, $_;
+ }
+ }
+ close $fh;
}
- if(@APACI_ARGS) {
- unshift @ARGV, "APACI_ARGS=" . join(",", @APACI_ARGS);
+ if (@APACI_ARGS) {
+ unshift @ARGV, "APACI_ARGS=" . join(",", @APACI_ARGS);
}
}
my $vcpp = ($Config{cc} =~ /^cl(\.exe)?$/);
my %win32_args;
-my %win32_accept = map {$_ => 1}
+my %win32_accept = map {$_ => 1}
qw(APACHE_SRC INSTALL_DLL INSTALL_LIB DEBUG EAPI);
while($_ = shift) {
($k,$v) = split /=/, $_, 2;
if ($vcpp) {
- if ($win32_accept{$k}) {
- $win32_args{$k} = ($k eq 'DEBUG' or $k eq 'EAPI') ? 1 : $v;
- }
- else {
- push @mm_args, $_;
- }
- next;
+ if ($win32_accept{$k}) {
+ $win32_args{$k} = ($k eq 'DEBUG' or $k eq 'EAPI') ? 1 : $v;
+ }
+ else {
+ push @mm_args, $_;
+ }
+ next;
}
unless (/^(PERL|APACHE)/ or is_mp_arg($k)) {
- push @mm_args, $_;
+ push @mm_args, $_;
}
if ($k eq 'PREFIX') {
require File::Spec;
$MOD_PERL_PREFIX =
- File::Spec->catfile($v, $Config{'installstyle'}, 'site_perl',
- $Config{'version'}, $Config{'archname'});
+ File::Spec->catfile(
+ $v,
+ $Config{'installstyle'},
+ 'site_perl',
+ $Config{'version'},
+ $Config{'archname'}
+ );
}
-
+
$v = 1 unless defined $v;
if($experimental{$k}) {
- $experimental{$k}++;
- $PERL_EXTRA_CFLAGS .= " -D${k}=1";
+ $experimental{$k}++;
+ $PERL_EXTRA_CFLAGS .= " -D${k}=1";
}
+
${$k} = $v, next if defined ${$k};
$callback_hooks{$k} = $v if exists $callback_hooks{$k};
}
my $win32_auto;
if ($vcpp and $win32_args{APACHE_SRC}) {
- $EVERYTHING = 1;
- my $fixed_apsrc = win32_fix_path($win32_args{APACHE_SRC});
- $APACHE_SRC = -d "$fixed_apsrc/include" ? $fixed_apsrc :
- (-d "$fixed_apsrc/src/include" ? $fixed_apsrc . '/src' :
- die "Cannot find the Apache include directory under $fixed_apsrc");
- $win32_auto = 1;
- unless ($win32_args{INSTALL_DLL}) {
- my $w32_ap_mod = $fixed_apsrc . '/modules';
- $win32_args{INSTALL_DLL} = $w32_ap_mod if -d $w32_ap_mod;
- }
- unless ($win32_args{INSTALL_LIB}) {
- my $w32_ap_lib = $fixed_apsrc . '/libexec';
- $win32_args{INSTALL_LIB} = $w32_ap_lib if -d $w32_ap_lib;
- }
-}
-
-my %very_experimental = map {$_,1}
-qw(PERL_DEFAULT_OPMASK PERL_SAFE_STARTUP PERL_ORALL_OPMASK
- PERL_STARTUP_DONE_CHECK PERL_DSO_UNLOAD);
+ $EVERYTHING = 1;
+ my $fixed_apsrc = win32_fix_path($win32_args{APACHE_SRC});
+ $APACHE_SRC = -d "$fixed_apsrc/include" ? $fixed_apsrc :
+ (-d "$fixed_apsrc/src/include" ? $fixed_apsrc . '/src' :
+ die "Cannot find the Apache include directory under $fixed_apsrc");
+ $win32_auto = 1;
+ unless ($win32_args{INSTALL_DLL}) {
+ my $w32_ap_mod = $fixed_apsrc . '/modules';
+ $win32_args{INSTALL_DLL} = $w32_ap_mod if -d $w32_ap_mod;
+ }
+ unless ($win32_args{INSTALL_LIB}) {
+ my $w32_ap_lib = $fixed_apsrc . '/libexec';
+ $win32_args{INSTALL_LIB} = $w32_ap_lib if -d $w32_ap_lib;
+ }
+}
+
+my %very_experimental = map {$_,1}
+ qw(
+ PERL_DEFAULT_OPMASK PERL_SAFE_STARTUP PERL_ORALL_OPMASK
+ PERL_STARTUP_DONE_CHECK PERL_DSO_UNLOAD
+ );
-if($EXPERIMENTAL) {
+if ($EXPERIMENTAL) {
for (keys %experimental) {
next if $very_experimental{$_}; #have to *really* ask for this one
next if $experimental{$_}++ > 1;
- $PERL_EXTRA_CFLAGS .= " -D$_=1";
+ $PERL_EXTRA_CFLAGS .= " -D$_=1";
}
}
-if($experimental{PERL_DEFAULT_OPMASK} > 1) {
+if ($experimental{PERL_DEFAULT_OPMASK} > 1) {
$experimental{PERL_SAFE_STARTUP} = 2;
$PERL_EXTRA_CFLAGS .= " -DPERL_SAFE_STARTUP=1";
}
@@ -404,8 +414,8 @@
}
$USE_APACI = 1 if $USE_DSO;
-if(0) {
-#if($USE_DSO or $USE_APXS and !$DO_HTTPD) {
+if (0) {
+ #if($USE_DSO or $USE_APXS and !$DO_HTTPD) {
print "*" x 65, $/;
print <<EOF;
* WARNING: mod_perl as a DSO is known to fail on most platforms *
@@ -413,7 +423,7 @@
EOF
print "*" x 65, $/;
my $ans = prompt("Continue?", "n");
- if($ans =~ /^n$/i) {
+ if ($ans =~ /^n$/i) {
print "Aborting build process\n";
exit;
}
@@ -423,13 +433,13 @@
if(-e $USE_APXS and !(-d _)) {
$WITH_APXS = $USE_APXS;
}
- if(not -x $WITH_APXS and $USE_APXS and $APACHE_PREFIX) {
- for (qw(sbin bin)) {
- last if -e ($WITH_APXS = "$APACHE_PREFIX/$_/apxs");
- }
+ if (not -x $WITH_APXS and $USE_APXS and $APACHE_PREFIX) {
+ for (qw(sbin bin)) {
+ last if -e ($WITH_APXS = "$APACHE_PREFIX/$_/apxs");
+ }
}
unless (-x $WITH_APXS) {
- chomp($WITH_APXS = `which apxs`);
+ chomp($WITH_APXS = `which apxs`);
}
print "Will configure via APXS";
@@ -449,7 +459,7 @@
if ($USE_APACI) {
print "Will configure via APACI";
- if($USE_DSO) {
+ if ($USE_DSO) {
print " (DSO enabled)";
}
$NO_HTTPD = 1 if $PREP_HTTPD;
@@ -462,248 +472,248 @@
for (keys %callback_alias) {
$callback_hooks{$callback_alias{$_}}++
- if $callback_hooks{$_};
+ if $callback_hooks{$_};
}
-if($EVERYTHING) {
+if ($EVERYTHING) {
@callback_hooks{qw(PERL_STACKED_HANDLERS PERL_METHOD_HANDLERS)} = (1) x 2;
- for(qw(ALL_HOOKS PERL_SSI PERL_SECTIONS PERL_DIRECTIVE_HANDLERS
- PERL_LOG_API PERL_URI_API PERL_UTIL_API PERL_TABLE_API PERL_FILE_API)) {
- $$_ = 1;
+ for (qw(
+ ALL_HOOKS PERL_SSI PERL_SECTIONS PERL_DIRECTIVE_HANDLERS
+ PERL_LOG_API PERL_URI_API PERL_UTIL_API PERL_TABLE_API PERL_FILE_API
+ )) {
+ $$_ = 1;
}
}
-if($ALL_HOOKS) {
+if ($ALL_HOOKS) {
for (@callback_hooks) {
- next if /(Api|Table|Handler)s?$/i;
- $callback_hooks{$_}++;
+ next if /(Api|Table|Handler)s?$/i;
+ $callback_hooks{$_}++;
}
}
-if($DYNAMIC) {
+if ($DYNAMIC) {
$PERL_DIRECTIVE_HANDLERS = $PERL_TABLE_API = $PERL_FILE_API =
- $PERL_LOG_API = $PERL_URI_API = $PERL_UTIL_API = 1;
+ $PERL_LOG_API = $PERL_URI_API = $PERL_UTIL_API = 1;
}
-my @xs_modules = qw{
-Apache Apache::Constants
-};
+my @xs_modules = qw {
+ Apache Apache::Constants
+ };
-if($Is_Win32) {
+if ($Is_Win32) {
$NO_HTTPD = 1;
$PERL_DIRECTIVE_HANDLERS = 1;
-}
-
+}
unless ($NO_HTTPD && !$PREP_HTTPD) {
-for $src_dir ($APACHE_SRC, <../apache*/src>,
- <../stronghold*/src>, </usr/local/stronghold*/src>,
- "../src", "./src")
-{
- next unless -d $src_dir;
- next if $seen{$src_dir}++;
- next unless $vers = httpd_version($src_dir);
- unless(exists $vers_map{$vers}) {
- print STDERR "Apache version '$vers' unsupported\n";
- next;
- }
- $mft_map{$src_dir} = $vers_map{$vers};
- #print STDERR "$src_dir -> $vers_map{$vers}\n";
- push @adirs, $src_dir;
- $modified{$src_dir} = (stat($src_dir))[9];
- last if $DO_HTTPD;
-}
-
-unless (@adirs) {
- print "Enter `q' to stop search\n";
- while(1) {
- print "Please tell me where I can find your apache src\n" ;
- $src_dir = prompt("", $APACHE_SRC_DEFAULT);
- last if $src_dir eq "q";
- if(-d $src_dir) {
- push(@adirs, $src_dir);
- $mft_map{$src_dir} = $vers_map{httpd_version($src_dir)};
- last;
- }
- else {
- print "Can't stat `$src_dir'\n";
- }
+ for $src_dir ($APACHE_SRC, <../apache*/src>,
+ <../stronghold*/src>, </usr/local/stronghold*/src>,
+ "../src", "./src")
+ {
+ next unless -d $src_dir;
+ next if $seen{$src_dir}++;
+ next unless $vers = httpd_version($src_dir);
+ unless(exists $vers_map{$vers}) {
+ print STDERR "Apache version '$vers' unsupported\n";
+ next;
+ }
+ $mft_map{$src_dir} = $vers_map{$vers};
+ #print STDERR "$src_dir -> $vers_map{$vers}\n";
+ push @adirs, $src_dir;
+ $modified{$src_dir} = (stat($src_dir))[9];
+ last if $DO_HTTPD;
+ }
+
+ unless (@adirs) {
+ print "Enter `q' to stop search\n";
+ while(1) {
+ print "Please tell me where I can find your apache src\n" ;
+ $src_dir = prompt("", $APACHE_SRC_DEFAULT);
+ last if $src_dir eq "q";
+ if(-d $src_dir) {
+ push @adirs, $src_dir;
+ $mft_map{$src_dir} = $vers_map{httpd_version($src_dir)};
+ last;
+ }
+ else {
+ print "Can't stat `$src_dir'\n";
+ }
+ }
}
}
+if ($PERL_EXTRA_CFLAGS) {
+ $PERL_EXTRA_CFLAGS = join(" ", split(",", $PERL_EXTRA_CFLAGS));
+ $PERL_EXTRA_CFLAGS =~ s/\s+/ /g;
}
- if($PERL_EXTRA_CFLAGS) {
- $PERL_EXTRA_CFLAGS = join(" ", split(",", $PERL_EXTRA_CFLAGS));
- $PERL_EXTRA_CFLAGS =~ s/\s+/ /g;
- }
-
- if($PERL_DEBUG) {
- my $lib = "$Config{archlibexp}/CORE/libperld$Config{lib_ext}";
- if (-e $lib) {
+if ($PERL_DEBUG) {
+ my $lib = "$Config{archlibexp}/CORE/libperld$Config{lib_ext}";
+ if (-e $lib) {
$LIBPERL = "-lperld";
$libperl = " -- $LIBPERL";
- }
- $PERL_EXTRA_CFLAGS .= " -g";
- $PERL_TRACE=1;
- $PERL_DESTRUCT_LEVEL=2;
- print "DEBUG mode...\n";
- print "...adding `-g' to EXTRA_CFLAGS\n";
- print "...turning on PERL_TRACE\n";
- print "...setting PERL_DESTRUCT_LEVEL=2\n";
- print "...linking against libperld\n" if $libperl;
- sleep(1);
- }
+ }
+ $PERL_EXTRA_CFLAGS .= " -g";
+ $PERL_TRACE=1;
+ $PERL_DESTRUCT_LEVEL=2;
- $PERL_EXTRA_CFLAGS .= " -DPERL_DESTRUCT_LEVEL=$PERL_DESTRUCT_LEVEL"
- if $PERL_DESTRUCT_LEVEL;
+ print "DEBUG mode...\n";
+ print "...adding `-g' to EXTRA_CFLAGS\n";
+ print "...turning on PERL_TRACE\n";
+ print "...setting PERL_DESTRUCT_LEVEL=2\n";
+ print "...linking against libperld\n" if $libperl;
+
+ sleep(1);
+}
+
+$PERL_EXTRA_CFLAGS .= " -DPERL_DESTRUCT_LEVEL=$PERL_DESTRUCT_LEVEL"
+ if $PERL_DESTRUCT_LEVEL;
for $adir (sort {$modified{$b} <=> $modified{$a}} @adirs) {
$conf = "$adir/$Configuration";
$httpd_h = asrc($adir)."/httpd.h";
if (-e $httpd_h) {
- unless($NO_HTTPD and not $DYNAMIC and not $PREP_HTTPD) {
- unless($DO_HTTPD) {
- $ans = prompt("Configure mod_perl with $adir ?", "y");
- next unless $ans =~ /^y$/i;
- }
- $APACHE_SRC = $adir;
- $IsBenSSL = -e "$adir/apache_ssl.c";
- last unless(-e $conf || -e "$conf.tmpl"); #building from 'make offsite-tar'
- }
- #++$NO_HTTPD if $USE_APACI;
- my $mmn = magic_number($APACHE_SRC);
- if(($mmn < MMN_130) and $USE_APACI) { #1.3.0
- print "Sorry, need 1.3.0+ for USE_APACI\n";
- $USE_APACI = $USE_DSO = 0;
-
- }
- for my $api (qw(LOG URI UTIL FILE TABLE)) {
- local $_ = join "_", "PERL", $api, "API";
- if(($mmn < MMN_130) and $$_) { #1.3.0
- $$_ = 0;
- $cant_hook{$_} = "(need 1.3.0 or higher)";
- }
- }
- if($USE_DSO and $PERL_SSI) {
- $PERL_SSI=0;
- $cant_hook{PERL_SSI} = "(doesn't work w/ USE_DSO=1)";
- }
- unless ($DO_HTTPD or $NO_HTTPD) {
- $ans = prompt("Shall I build httpd in $adir for you?", "y");
- ++$NO_HTTPD, ++$PREP_HTTPD unless $ans =~ /^y$/i;
- }
+ unless($NO_HTTPD and not $DYNAMIC and not $PREP_HTTPD) {
+ unless($DO_HTTPD) {
+ $ans = prompt("Configure mod_perl with $adir ?", "y");
+ next unless $ans =~ /^y$/i;
+ }
+ $APACHE_SRC = $adir;
+ $IsBenSSL = -e "$adir/apache_ssl.c";
+ last unless(-e $conf || -e "$conf.tmpl"); #building from 'make offsite-tar'
+ }
- if($NO_HTTPD) {
- #must generate Makefile.config for 1.3bx
- unless (-e "$adir/Makefile.config") {
- my $cfgfile = $CONFIG ? $CONFIG : "Configuration";
- print "(cd $adir && ./Configure -file $cfgfile)";
- }
- }
+ #++$NO_HTTPD if $USE_APACI;
+ my $mmn = magic_number($APACHE_SRC);
+ if (($mmn < MMN_130) and $USE_APACI) { #1.3.0
+ print "Sorry, need 1.3.0+ for USE_APACI\n";
+ $USE_APACI = $USE_DSO = 0;
+ }
- #copy the source files
- if(!$NO_HTTPD or $USE_APACI or $PREP_HTTPD) {
- mkpath "$adir/modules/perl";
- #ignore make's output here
- `(cd $adir/modules/perl && make clean 2> /dev/null)`;
-
- local(*MANI);
- open MANI, "MANIFEST" or die "open MANIFEST $!";
- my $atopdir = dirname($adir);
-
- unlink "$atopdir/perlxsi.c";
- #only rm and cp files mod_perl ships with
- while(<MANI>) {
- next unless m,^src/modules/perl/,; chomp;
- #print "rm -f $adir/$_\n";
- unlink "$atopdir/$_";
- next if not m,.+\.(xs|c|h)$, and $USE_APACI;
- next if $DYNAMIC and /\.xs$/;
- #print "cp $_ $atopdir/$_\n" if $USE_APACI;
- my $dest = "$atopdir/$_";
- cp $_, $dest;
- #$mani_src{$_}++;
- }
- close MANI;
-
- cp "src/modules/perl/mod_perl_version.h",
- "$atopdir/src/modules/perl/mod_perl_version.h";
-
- if($USE_APACI) {
- open MANI, "MANIFEST" or die "open MANIFEST $!";
- while(<MANI>) {
- next unless m,^apaci/,; chomp;
- s/\.PL$//;
- (my $to = $_) =~ s,^apaci/,src/modules/perl/,;
- unlink "$atopdir/$to";
- print "cp $_ $atopdir/$to\n";
- my $dest = "$atopdir/$to";
- cp $_, $dest;
- chmod 0755, $dest if -x $_;
- }
- close MANI;
- }
- }
+ for my $api (qw(LOG URI UTIL FILE TABLE)) {
+ local $_ = join "_", "PERL", $api, "API";
+ if (($mmn < MMN_130) and $$_) { #1.3.0
+ $$_ = 0;
+ $cant_hook{$_} = "(need 1.3.0 or higher)";
+ }
+ }
- ($APACHE_ROOT = $APACHE_SRC) =~ s,/src/?$,,;
+ if ($USE_DSO and $PERL_SSI) {
+ $PERL_SSI=0;
+ $cant_hook{PERL_SSI} = "(doesn't work w/ USE_DSO=1)";
+ }
- last if $NO_HTTPD; # or $USE_APACI;
+ unless ($DO_HTTPD or $NO_HTTPD) {
+ $ans = prompt("Shall I build httpd in $adir for you?", "y");
+ ++$NO_HTTPD, ++$PREP_HTTPD unless $ans =~ /^y$/i;
+ }
- unless(-e "src/Configuration" and (-M "src/Configuration" < -M $conf) and not $USE_APACI) {
- unless(-e $conf) {
- cp "$conf.tmpl", $conf;
- }
- cp $conf, "src/Configuration";
- $conf = "src/Configuration";
+ if ($NO_HTTPD) {
+ #must generate Makefile.config for 1.3bx
+ unless (-e "$adir/Makefile.config") {
+ my $cfgfile = $CONFIG ? $CONFIG : "Configuration";
+ print "(cd $adir && ./Configure -file $cfgfile)";
+ }
+ }
- conf_fixup("$adir/Makefile.tmpl", $conf);
- }
- }
+ #copy the source files
+ if (!$NO_HTTPD or $USE_APACI or $PREP_HTTPD) {
+ mkpath "$adir/modules/perl";
+ #ignore make's output here
+ `(cd $adir/modules/perl && make clean 2> /dev/null)`;
+
+ local *MANI;
+ open MANI, "MANIFEST" or die "open MANIFEST $!";
+ my $atopdir = dirname($adir);
+
+ unlink "$atopdir/perlxsi.c";
+ #only rm and cp files mod_perl ships with
+ while(<MANI>) {
+ next unless m,^src/modules/perl/,; chomp;
+ #print "rm -f $adir/$_\n";
+ unlink "$atopdir/$_";
+ next if not m,.+\.(xs|c|h)$, and $USE_APACI;
+ next if $DYNAMIC and /\.xs$/;
+ #print "cp $_ $atopdir/$_\n" if $USE_APACI;
+ my $dest = "$atopdir/$_";
+ cp $_, $dest;
+ #$mani_src{$_}++;
+ }
+ close MANI;
- if ($NO_HTTPD) {
+ cp "src/modules/perl/mod_perl_version.h",
+ "$atopdir/src/modules/perl/mod_perl_version.h";
+ if ($USE_APACI) {
+ open MANI, "MANIFEST" or die "open MANIFEST $!";
+ while(<MANI>) {
+ next unless m,^apaci/,; chomp;
+ s/\.PL$//;
+ (my $to = $_) =~ s,^apaci/,src/modules/perl/,;
+ unlink "$atopdir/$to";
+ print "cp $_ $atopdir/$to\n";
+ my $dest = "$atopdir/$to";
+ cp $_, $dest;
+ chmod 0755, $dest if -x $_;
+ }
+ close MANI;
+ }
+ }
+
+ ($APACHE_ROOT = $APACHE_SRC) =~ s,/src/?$,,;
+
+ last if $NO_HTTPD; # or $USE_APACI;
+
+ unless (-e "src/Configuration" and (-M "src/Configuration" < -M $conf) and not $USE_APACI) {
+ unless (-e $conf) {
+ cp "$conf.tmpl", $conf;
+ }
+ cp $conf, "src/Configuration";
+ $conf = "src/Configuration";
+
+ conf_fixup("$adir/Makefile.tmpl", $conf);
+ }
}
- elsif($USE_APACI) {
- #take care of things later
- }
- else {
- $conf = "src/Configuration";
- my($dash_make, $cfgfile);
- $dash_make = " -make $PWD/src/$mft_map{$adir} "
- if $can_dash_make{asrc $adir} and $mft_map{$adir};
- #print STDERR "(cd $adir; ./Configure${dash_make} -file $PWD/$conf)\n";
- $cfgfile = $CONFIG ? $CONFIG : "$PWD/$conf";
- $dash_make ||= "";
- system "(cd $adir && ./Configure${dash_make} -file $cfgfile)";
-
- open FH, "$APACHE_SRC/Makefile" or
- die "can't open $APACHE_SRC/Makefile $!";
- while(<FH>) {
- $SSL_BASE ||= $1 if /^\s*SSL_BASE\s*=\s*(.*)/;
- $EXTRA_CFLAGS = $1 if /CFLAGS1\s*=\s*(.*)/;
- $SSLINCS = $1 if /SSLINCS\s*=\s*(.*)/;
- }
- close FH;
- if($SSL_BASE) {
- $SSL_INCLUDE = " -I$SSL_BASE/include ";
- $SSL_CFLAGS = "-DAPACHE_SSL $SSL_INCLUDE";
- }
+ unless ($NO_HTTPD || $USE_APACI) {
+ $conf = "src/Configuration";
+ my ($dash_make, $cfgfile);
+ $dash_make = " -make $PWD/src/$mft_map{$adir} "
+ if $can_dash_make{asrc $adir} and $mft_map{$adir};
+ #print STDERR "(cd $adir; ./Configure${dash_make} -file $PWD/$conf)\n";
+ $cfgfile = $CONFIG ? $CONFIG : "$PWD/$conf";
+ $dash_make ||= "";
+ system "(cd $adir && ./Configure${dash_make} -file $cfgfile)";
+
+ open FH, "$APACHE_SRC/Makefile" or
+ die "can't open $APACHE_SRC/Makefile $!";
+ while(<FH>) {
+ $SSL_BASE ||= $1 if /^\s*SSL_BASE\s*=\s*(.*)/;
+ $EXTRA_CFLAGS = $1 if /CFLAGS1\s*=\s*(.*)/;
+ $SSLINCS = $1 if /SSLINCS\s*=\s*(.*)/;
+ }
+ close FH;
- #stronghold
- if($SSLINCS) {
- $SSL_INCLUDE = " $SSLINCS ";
- $SSL_CFLAGS = "-DAPACHE_SSL $SSL_INCLUDE";
- }
+ if ($SSL_BASE) {
+ $SSL_INCLUDE = " -I$SSL_BASE/include ";
+ $SSL_CFLAGS = "-DAPACHE_SSL $SSL_INCLUDE";
+ }
+
+ #stronghold
+ if ($SSLINCS) {
+ $SSL_INCLUDE = " $SSLINCS ";
+ $SSL_CFLAGS = "-DAPACHE_SSL $SSL_INCLUDE";
+ }
}
+
print "EXTRA_CFLAGS: $EXTRA_CFLAGS\n" if $EXTRA_CFLAGS;
print "SSL_CFLAGS: $SSL_CFLAGS\n" if $SSL_CFLAGS;
last if $APACHE_SRC;
}
-if($PERL_DIRECTIVE_HANDLERS) {
+if ($PERL_DIRECTIVE_HANDLERS) {
push @xs_modules, "Apache::ModuleConfig";
$callback_hooks{PERL_DIRECTIVE_HANDLERS} = 1;
}
@@ -712,19 +722,20 @@
if (0) {
my $mmn = $USE_APXS ? MMN_130 : magic_number($APACHE_SRC);
if($mmn >= MMN_130) {
- push @xs_modules, "Apache::PerlRunXS";
+ push @xs_modules, "Apache::PerlRunXS";
}
else {
- $PERL_RUN_XS = 0;
- $experimental{PERL_RUN_XS} = 0;
- print "Sorry, need 1.3.0+ for Apache::PerlRunXS\n";
+ $PERL_RUN_XS = 0;
+ $experimental{PERL_RUN_XS} = 0;
+ print "Sorry, need 1.3.0+ for Apache::PerlRunXS\n";
}
}
+
for (qw(Log URI Util Connection Server File Table)) {
my $s = "PERL_".uc($_)."_API";
if($$s or $Is_Win32) {
- push @xs_modules, "Apache::$_";
- $callback_hooks{$s} = 1;
+ push @xs_modules, "Apache::$_";
+ $callback_hooks{$s} = 1;
}
}
@@ -732,154 +743,155 @@
win32_setup() if $Is_Win32;
-if($DYNAMIC) {
+if ($DYNAMIC) {
print "Will build Apache::* extensions dynamic\n";
for (@xs_mod_snames) {
- cp "src/modules/perl/${_}.xs", "${_}/${_}.xs";
+ cp "src/modules/perl/${_}.xs", "${_}/${_}.xs";
}
}
-if($APACHE_SRC or $USE_APXS) {
+if ($APACHE_SRC or $USE_APXS) {
++$STATIC if grep { $_ eq lc($Config{osname}) } qw(aix svr4 unixware);
my $mmn = $USE_APXS ? MMN_130 : magic_number($APACHE_SRC);
my $httpdv = $USE_APXS ? 130 : httpd_version($APACHE_SRC,1);
- unless($httpdv >= 130) {
- phat_warn("Apache Version 1.3.0 required, aborting...");
- exit(1);
+ unless ($httpdv >= 130) {
+ phat_warn("Apache Version 1.3.0 required, aborting...");
+ exit(1);
}
- if($httpdv >= 130) {
- if($callback_hooks{PERL_CHILD_INIT}) {
- $My::child_init++;
- }
+ if ($httpdv >= 130) {
+ if($callback_hooks{PERL_CHILD_INIT}) {
+ $My::child_init++;
+ }
}
else {
- $callback_hooks{PERL_CHILD_INIT} = 0;
- $cant_hook{PERL_CHILD_INIT} =
- "(need 1.3.0 or higher)";
+ $callback_hooks{PERL_CHILD_INIT} = 0;
+ $cant_hook{PERL_CHILD_INIT} =
+ "(need 1.3.0 or higher)";
}
- if($mmn >= 19970728) {
- $callback_hooks{PERL_CHILD_EXIT} = $My::child_exit =
- $callback_hooks{PERL_CHILD_INIT} = $My::child_init = 1;
+ if ($mmn >= 19970728) {
+ $callback_hooks{PERL_CHILD_EXIT} = $My::child_exit =
+ $callback_hooks{PERL_CHILD_INIT} = $My::child_init = 1;
}
else {
- $callback_hooks{PERL_CHILD_EXIT} = 0;
- $cant_hook{PERL_CHILD_EXIT} =
- "(need 1.3.0 or higher)";
+ $callback_hooks{PERL_CHILD_EXIT} = 0;
+ $cant_hook{PERL_CHILD_EXIT} =
+ "(need 1.3.0 or higher)";
}
unless($mmn >= 19970825) {
- $callback_hooks{PERL_POST_READ_REQUEST} = 0;
- $cant_hook{PERL_POST_READ_REQUEST} =
- "(need 1.3.0 or higher)";
+ $callback_hooks{PERL_POST_READ_REQUEST} = 0;
+ $cant_hook{PERL_POST_READ_REQUEST} =
+ "(need 1.3.0 or higher)";
}
setup_for_static() unless $USE_APXS;
iedit "$APACHE_SRC/modules/perl/Makefile",
- "s!^PERL\\s*=.*!PERL=$Config{'perlpath'}!" unless $USE_APACI or $USE_APXS;
+ "s!^PERL\\s*=.*!PERL=$Config{'perlpath'}!" unless $USE_APACI or $USE_APXS;
for (@callback_hooks) {
- ($k,$v) = ($_,$callback_hooks{$_});
+ ($k,$v) = ($_,$callback_hooks{$_});
- unless ($USE_APACI or $USE_APXS) {
- iedit "$APACHE_SRC/modules/perl/Makefile", "s/^$k /#$k /" if $v;
- }
+ unless ($USE_APACI or $USE_APXS) {
+ iedit "$APACHE_SRC/modules/perl/Makefile", "s/^$k /#$k /" if $v;
+ }
- $why = ($cant_hook{$k} || "(enable with $k=1)") unless $v;
- $k =~ s/([A-Z]+)/ucfirst(lc($1))/ge;
- $k =~ s/_//g;
- $k .= "Handler" unless $k =~ /(Api|Table|Handler)s?$/;
- push @mod_perl_hooks, $k;
- print $k . '.' x (28 - length($k));
- print $v ? "enabled\n" : "disabled $why\n";
+ $why = ($cant_hook{$k} || "(enable with $k=1)") unless $v;
+ $k =~ s/([A-Z]+)/ucfirst(lc($1))/ge;
+ $k =~ s/_//g;
+ $k .= "Handler" unless $k =~ /(Api|Table|Handler)s?$/;
+ push @mod_perl_hooks, $k;
+ print $k . '.' x (28 - length($k));
+ print $v ? "enabled\n" : "disabled $why\n";
}
unless($httpdv >= 120) {
- $PERL_SECTIONS = $PERL_SSI = 0;
- $cant_hook{PERL_SECTIONS} = $cant_hook{PERL_SSI} =
- "(need 1.2.0 or higher)";
+ $PERL_SECTIONS = $PERL_SSI = 0;
+ $cant_hook{PERL_SECTIONS} = $cant_hook{PERL_SSI} =
+ "(need 1.2.0 or higher)";
}
$PERL_SSI = 0 if $Is_Win32;
unless ($Is_Win32) {
- for (qw(PERL_SECTIONS PERL_SSI), keys %experimental) {
- $k = $_;
+ for (qw(PERL_SECTIONS PERL_SSI), keys %experimental) {
+ $k = $_;
- if($experimental{$_}) {
- next unless $experimental{$_} > 1;
- print $k . '.' x (28 - length($k));
- print "enabled (experimental)";
- }
- else {
- $why = ($cant_hook{$_} || "(enable with $k=1)") unless $$_;
- $k =~ s/([A-Z]+)/ucfirst(lc($1))/ge;
- $k =~ s/_//g;
- $k =~ s/Ssi$/SSI/; #*shrug*
- push @mod_perl_hooks, $k;
- print $k . '.' x (28 - length($k));
- print $$_ ? "enabled" : "disabled $why\n";
- }
+ if ($experimental{$_}) {
+ next unless $experimental{$_} > 1;
+ print $k . '.' x (28 - length($k));
+ print "enabled (experimental)";
+ }
+ else {
+ $why = ($cant_hook{$_} || "(enable with $k=1)") unless $$_;
+ $k =~ s/([A-Z]+)/ucfirst(lc($1))/ge;
+ $k =~ s/_//g;
+ $k =~ s/Ssi$/SSI/; #*shrug*
+ push @mod_perl_hooks, $k;
+ print $k . '.' x (28 - length($k));
+ print $$_ ? "enabled" : "disabled $why\n";
+ }
- print "\n";
- unless ($USE_APACI or $USE_APXS) {
- iedit "$APACHE_SRC/modules/perl/Makefile", "s/^($_) /#\$1 /"
- if $$_;
- }
- }
+ print "\n";
+ unless ($USE_APACI or $USE_APXS) {
+ iedit "$APACHE_SRC/modules/perl/Makefile", "s/^($_) /#\$1 /"
+ if $$_;
+ }
+ }
}
+
unless ($USE_APACI or $USE_APXS) {
- iedit "$APACHE_SRC/modules/perl/Makefile", "s/^#TRACE/TRACE/" if $PERL_TRACE;
+ iedit "$APACHE_SRC/modules/perl/Makefile", "s/^#TRACE/TRACE/" if $PERL_TRACE;
}
my $ssl_name = is_ssl();
- if($ssl_name) {
- print "I see you are building with $ssl_name,\nI'll set the SSL flags in mod_perl's Makefile\n";
+ if ($ssl_name) {
+ print "I see you are building with $ssl_name,\nI'll set the SSL flags in mod_perl's Makefile\n";
- if($ssl_name =~ /stronghold/i) {
- my $skey;
- my $lfile;
- my $conf = "$APACHE_SRC/../conf/httpd.conf";
- if(-e $conf) {
- open FH, $conf;
- while(<FH>) {
- chomp;
- if(/^StrongholdKey/) {
- $skey = $_;
- last;
- }
- elsif(s/^StrongholdLicenseFile\s+//) {
- $lfile = $_;
- unless ($lfile =~ m:^/:) {
- $lfile = "$PWD/$APACHE_SRC/../$lfile";
- }
- }
- }
- close FH;
- }
-
- if($skey) {
- $StrongholdKey = $skey;
- print "Using $skey for 'make test'\n";
- }
- elsif(-e $lfile) {
- $StrongholdKey = join " ",
- "StrongholdLicenseFile", $lfile;
- print "Using $StrongholdKey for 'make test'\n";
- }
- else {
- print "Before running `make test', ",
- "you must add your `StrongholdLicenseFile' to t/conf/httpd.conf\n";
- }
- }
+ if ($ssl_name =~ /stronghold/i) {
+ my $skey;
+ my $lfile;
+ my $conf = "$APACHE_SRC/../conf/httpd.conf";
+ if(-e $conf) {
+ open FH, $conf;
+ while(<FH>) {
+ chomp;
+ if(/^StrongholdKey/) {
+ $skey = $_;
+ last;
+ }
+ elsif(s/^StrongholdLicenseFile\s+//) {
+ $lfile = $_;
+ unless ($lfile =~ m:^/:) {
+ $lfile = "$PWD/$APACHE_SRC/../$lfile";
+ }
+ }
+ }
+ close FH;
+ }
- unless ($USE_APACI or $USE_APXS) {
- iedit "$APACHE_SRC/modules/perl/Makefile",
- "s:^#APACHE_SSL.*:APACHE_SSL = $SSL_CFLAGS:";
- }
+ if ($skey) {
+ $StrongholdKey = $skey;
+ print "Using $skey for 'make test'\n";
+ }
+ elsif (-e $lfile) {
+ $StrongholdKey = join " ",
+ "StrongholdLicenseFile", $lfile;
+ print "Using $StrongholdKey for 'make test'\n";
+ }
+ else {
+ print "Before running `make test', ",
+ "you must add your `StrongholdLicenseFile' to t/conf/httpd.conf\n";
+ }
+ }
+
+ unless ($USE_APACI or $USE_APXS) {
+ iedit "$APACHE_SRC/modules/perl/Makefile",
+ "s:^#APACHE_SSL.*:APACHE_SSL = $SSL_CFLAGS:";
+ }
}
#my $incdir = ($mmn >= 19970825) ? "../../main" : "../..";
@@ -907,23 +919,24 @@
EOF
unless ($USE_APACI or $USE_APXS) {
- iedit "$APACHE_SRC/modules/perl/Makefile", "s/^#__ORIGINAL__/$edit_note/";
+ iedit "$APACHE_SRC/modules/perl/Makefile", "s/^#__ORIGINAL__/$edit_note/";
}
- if($mmn >= 19970912 and not $USE_APACI and not $USE_APXS and not $Is_Win32) { #1.3b1
- system "cat $APACHE_SRC/Makefile.config $APACHE_SRC/modules/perl/Makefile > /tmp/mpmf.$$";
- system "mv /tmp/mpmf.$$ $APACHE_SRC/modules/perl/Makefile";
+ if ($mmn >= 19970912 and not $USE_APACI and not $USE_APXS and not $Is_Win32) { #1.3b1
+ system "cat $APACHE_SRC/Makefile.config $APACHE_SRC/modules/perl/Makefile > /tmp/mpmf.$$";
+ system "mv /tmp/mpmf.$$ $APACHE_SRC/modules/perl/Makefile";
}
- if($callback_hooks{PERL_TRANS}) {
- push @test_pre_init,
- "\t", '$(CP) t/conf/mod_perl_srm.conf t/conf/srm.conf', "\n";
+ if ($callback_hooks{PERL_TRANS}) {
+ push @test_pre_init,
+ "\t", '$(CP) t/conf/mod_perl_srm.conf t/conf/srm.conf', "\n";
}
+
unless ($USE_APXS) {
- unless (-l "t/httpd" or $Is_Win32) {
- system "$Config{lns} $APACHE_SRC/httpd t/httpd";
- }
- write_extra_tests();
+ unless (-l "t/httpd" or $Is_Win32) {
+ system "$Config{lns} $APACHE_SRC/httpd t/httpd";
+ }
+ write_extra_tests();
}
}
@@ -935,9 +948,9 @@
my (%win32_path);
if ($win32_auto) {
- require File::Spec;
- win32_inc_and_lib();
- win32_fix_dsp();
+ require File::Spec;
+ win32_inc_and_lib();
+ win32_fix_dsp();
}
write_my_config($APACHE_SRC);
@@ -949,32 +962,38 @@
init_tests_and_config() if $USE_APXS;
sub init_config_pl {
+
my $mmn = magic_number($APACHE_SRC) || 0;
my $hf = FileHandle->new(">>t/net/config.pl") or
- die "can't open t/net/config.pl $!";
+ die "can't open t/net/config.pl $!";
my $apaci_cfg = APACI->init;
- my($k,$v);
- my(%all) = %callback_hooks;
+ my ($k,$v);
+ my (%all) = %callback_hooks;
while (($k,$v) = each %experimental) {
$all{$k} = ($experimental{$k} > 1) ? 1 : 0;
}
+
print $hf "%callback_hooks = (\n";
+
while (($k,$v) = each %all) {
print $hf " $k => $v,\n";
my $yes_no = $v ? "yes" : "no";
print $apaci_cfg "$k = $yes_no\n" if $apaci_cfg;
}
+
print $hf " MMN => $mmn,\n";
print $hf " USE_DSO => 1,\n" if $USE_DSO;
print $hf ");\n1;\n";
+
$hf->close;
$apaci_cfg->close if $apaci_cfg;
}
sub init_tests_and_config {
+
local *FH;
open FH, ">t/conf/dev-null";
print FH "#mod_ssl has a problem with /dev/null\n";
@@ -990,43 +1009,43 @@
$gid =~ s/^(\d+).*$/$1/;
$User = $Is_Win32 ? "nobody" :
- $ENV{APACHE_USER} || (getpwuid($uid) || "#$uid");
+ $ENV{APACHE_USER} || (getpwuid($uid) || "#$uid");
$Group = $Is_Win32 ? "nogroup" :
- $ENV{APACHE_GROUP} || (getgrgid($gid) || "#$gid");
+ $ENV{APACHE_GROUP} || (getgrgid($gid) || "#$gid");
- if($User eq "root") {
- my $other = (getpwnam('nobody'))[0];
- $User = $other if $other;
- }
- if($User eq "root") {
- print "Cannot run tests as User `$User'\n";
+ if ($User eq "root") {
+ my $other = (getpwnam('nobody'))[0];
+ $User = $other if $other;
+ }
+ if ($User eq "root") {
+ print "Cannot run tests as User `$User'\n";
$User = prompt("Which User?", "nobody");
- $Group = prompt("Which Group?", $Group);
+ $Group = prompt("Which Group?", $Group);
}
print STDERR "Will run tests as User: '$User' Group: '$Group'\n";
- if($Port != $PORT) {
- iedit "t/conf/httpd.conf", "s/^(Port) .*/\$1 $PORT/";
- iedit "t/net/config.pl", "s/$Port/$PORT/;";
- }
- if($experimental{PERL_SAFE_STARTUP} > 1) {
- if($experimental{PERL_DEFAULT_OPMASK} < 2) {
- iedit "t/conf/httpd.conf", "s/^#(PerlOpmask)/\$1/";
- }
+ if ($Port != $PORT) {
+ iedit "t/conf/httpd.conf", "s/^(Port) .*/\$1 $PORT/";
+ iedit "t/net/config.pl", "s/$Port/$PORT/;";
+ }
+ if ($experimental{PERL_SAFE_STARTUP} > 1) {
+ if ($experimental{PERL_DEFAULT_OPMASK} < 2) {
+ iedit "t/conf/httpd.conf", "s/^#(PerlOpmask)/\$1/";
+ }
}
init_config_pl();
- if($USE_APACI and not $PREP_HTTPD and not $USE_APXS) {
- my $shrpenv = $Config{shrpenv} || "";
- $shrpenv .= ' ' if $shrpenv;
- my $cmd = "CC=\"${shrpenv}$Config{cc}\" ";
-
- if($PERL_EXTRA_CFLAGS) {
- $cmd .= qq(CFLAGS="$PERL_EXTRA_CFLAGS" );
- }
+ if ($USE_APACI and not $PREP_HTTPD and not $USE_APXS) {
+ my $shrpenv = $Config{shrpenv} || "";
+ $shrpenv .= ' ' if $shrpenv;
+ my $cmd = "CC=\"${shrpenv}$Config{cc}\" ";
+
+ if ($PERL_EXTRA_CFLAGS) {
+ $cmd .= qq(CFLAGS="$PERL_EXTRA_CFLAGS" );
+ }
- if ($USE_DSO) {
+ if ($USE_DSO) {
# override apache's notion of this flag
$cmd .= qq(LDFLAGS_SHLIB_EXPORT="$Config{ccdlflags}" );
@@ -1034,49 +1053,50 @@
if ($Config{libs} =~ /($thrlib)/) {
$PERL_EXTRA_LIBS .= " $1";
}
- }
+ }
if ($PERL_EXTRA_LIBS) {
$cmd .= qq(LIBS="$PERL_EXTRA_LIBS" );
}
- $cmd .= "./configure " .
- "--activate-module=src/modules/perl/libperl.a";
-
+ $cmd .= "./configure " .
+ "--activate-module=src/modules/perl/libperl.a";
+
# Do not disable the rule EXPAT for Stronghold, since this
# rule is not implementated yet and breaks the configure process.
- if(is_ssl() !~ /stronghold/i) {
- $cmd .= " --disable-rule=EXPAT";
+ if (is_ssl() !~ /stronghold/i) {
+ $cmd .= " --disable-rule=EXPAT";
}
- if($USE_DSO) {
- $cmd .= " --enable-shared=perl";
- }
- if($APACI_ARGS) {
- $cmd .= " " . join " ", split(',', $APACI_ARGS);
- }
- if($APACHE_PREFIX and $APACI_ARGS !~ /--prefix=/) {
- $cmd .= " --prefix=$APACHE_PREFIX";
- }
- if ($APACI_ARGS =~ /--target=(\S+)/) {
- $TARGET = $1;
- }
- if($ADD_MODULE) {
- for (split ",", $ADD_MODULE) {
- if(/^([a-zA-Z0-9][a-zA-Z0-9_]+)$/) {
- $cmd .= " --enable-module=$1";
- }
- elsif(m:(src/modules/[^/]+/[^/]+)$:) {
- $cmd .= " --activate-module=$1";
- }
- }
- }
- print "(cd $APACHE_ROOT && $cmd)\n";
- system "(cd $APACHE_ROOT && $cmd)";
+ if($USE_DSO) {
+ $cmd .= " --enable-shared=perl";
+ }
+ if($APACI_ARGS) {
+ $cmd .= " " . join " ", split(',', $APACI_ARGS);
+ }
+ if($APACHE_PREFIX and $APACI_ARGS !~ /--prefix=/) {
+ $cmd .= " --prefix=$APACHE_PREFIX";
+ }
+ if ($APACI_ARGS =~ /--target=(\S+)/) {
+ $TARGET = $1;
+ }
+ if($ADD_MODULE) {
+ for (split ",", $ADD_MODULE) {
+ if (/^([a-zA-Z0-9][a-zA-Z0-9_]+)$/) {
+ $cmd .= " --enable-module=$1";
+ }
+ elsif (m:(src/modules/[^/]+/[^/]+)$:) {
+ $cmd .= " --activate-module=$1";
+ }
+ }
+ }
+
+ print "(cd $APACHE_ROOT && $cmd)\n";
+ system "(cd $APACHE_ROOT && $cmd)";
}
- if($USE_APXS) {
- my $cmd = "./configure --with-perl=$^X";
- $cmd .= " --with-apxs=$WITH_APXS" if $WITH_APXS;
- system "(cd apaci && $cmd)";
+ if ($USE_APXS) {
+ my $cmd = "./configure --with-perl=$^X";
+ $cmd .= " --with-apxs=$WITH_APXS" if $WITH_APXS;
+ system "(cd apaci && $cmd)";
}
#expand ./t to full path
@@ -1084,7 +1104,7 @@
for (qw(User Group)) {
$$_ = qq{"$$_"} if $$_ =~ /\s/; # User takes one parameter
- iedit "t/conf/httpd.conf", "s/^$_ .*/$_ $$_/";
+ iedit "t/conf/httpd.conf", "s/^$_ .*/$_ $$_/";
}
conf_append(<<EOF) if $IsBenSSL;
SSLDisable
@@ -1092,9 +1112,10 @@
SSLCacheServerPath /tmp
EOF
conf_append($StrongholdKey) if $StrongholdKey;
- if(is_ssl() =~ /stronghold/i) {
- iedit "t/conf/httpd.conf", "s:^SSL:#SSL:";
+ if (is_ssl() =~ /stronghold/i) {
+ iedit "t/conf/httpd.conf", "s:^SSL:#SSL:";
}
+
#phooey!
my $v = httpd_version($APACHE_SRC, 1);
my $mmn = magic_number($APACHE_SRC) || 0;
@@ -1103,10 +1124,10 @@
conf_append("PerlChildInitHandler My::child_init") if $My::child_init;
conf_append("PerlChildExitHandler My::child_exit") if $My::child_exit;
conf_append("PerlTransHandler My::ProxyTest")
- if $callback_hooks{PERL_TRANS} and
- $callback_hooks{PERL_STACKED_HANDLERS} and
- $mmn > 19980270 and $Is_dougm;
-
+ if $callback_hooks{PERL_TRANS} and
+ $callback_hooks{PERL_STACKED_HANDLERS} and
+ $mmn > 19980270 and $Is_dougm;
+
conf_append(<<EOF) if $callback_hooks{PERL_STACKED_HANDLERS};
<Location /chain>
SetHandler perl-script
@@ -1123,17 +1144,18 @@
cp "lib/mod_perl_hooks.pm.PL", "lib/mod_perl_hooks.pm";
if ($Is_Win32) {
- my @args = ($^X, '-spi.bak', '-e', "\"s/sub mod_perl::hooks.*/sub mod_perl::hooks { qw($hooks) }/\"", 'lib/mod_perl_hooks.pm');
- system(@args) == 0 or die "@args failed\n";
+ my @args = ($^X, '-spi.bak', '-e', "\"s/sub mod_perl::hooks.*/sub mod_perl::hooks { qw($hooks) }/\"", 'lib/mod_perl_hooks.pm');
+ system(@args) == 0 or die "@args failed\n";
}
- iedit "lib/mod_perl_hooks.pm",
- qq(s/sub mod_perl::hooks.*/sub mod_perl::hooks { qw($hooks) }/);
+
+ iedit "lib/mod_perl_hooks.pm",
+ qq(s/sub mod_perl::hooks.*/sub mod_perl::hooks { qw($hooks) }/);
require "lib/mod_perl_hooks.pm";
my @list = mod_perl::hooks();
unless ($Is_Cygwin) { # test doesn't seem to be needed, works for me (Per Einar)
- @list == @mod_perl_hooks or die "Edit of lib/mod_perl_hooks.pm failed $!\n";
+ @list == @mod_perl_hooks or die "Edit of lib/mod_perl_hooks.pm failed $!\n";
}
unlink $Is_Win32 ? "lib/mod_perl_hooks.pm.bak" : "lib/mod_perl_hooks.pm~";
@@ -1143,100 +1165,108 @@
unless ($Is_Win32) {
print "Checking CGI.pm VERSION..........";
eval {
- require CGI;
+ require CGI;
};
- if($CGI::VERSION >= 2.39) {
- print "ok\n";
+ if ($CGI::VERSION >= 2.39) {
+ print "ok\n";
}
else {
- print "I suggest upgrading from $CGI::VERSION to 2.39+\n";
- sleep 2;
+ print "I suggest upgrading from $CGI::VERSION to 2.39+\n";
+ sleep 2;
}
print "Checking for LWP::UserAgent......";
eval {
- require LWP::UserAgent;
+ require LWP::UserAgent;
};
if ($@) {
- $no_lwp++;
- $missing_modules++;
- print "failed\n";
- print <<EOT;
+ $no_lwp++;
+ $missing_modules++;
+ print "failed\n";
+ print <<EOT;
$@
The libwww-perl library is needed to run the test suite.
Installation of this library is recommended, but not required.
EOT
- sleep(2); # Don't hurry too much
- } else {
- print "ok\n";
+ sleep(2); # Don't hurry too much
+ }
+ else {
+ print "ok\n";
}
+
print "Checking for HTML::HeadParser....";
eval {
- require HTML::HeadParser;
+ require HTML::HeadParser;
};
+
if ($@) {
- $no_lwp++;
- $missing_modules++;
- print "failed\n";
- print <<EOT;
+ $no_lwp++;
+ $missing_modules++;
+ print "failed\n";
+ print <<EOT;
$@
The HTML-Parser package is needed (by libwww-perl) to run the test suite.
EOT
- sleep(2); # Don't hurry too much
- } else {
- print "ok\n";
+ sleep(2); # Don't hurry too much
+ }
+ else {
+ print "ok\n";
}
}
sub is_ssl {
my $d = shift || $APACHE_SRC;
+
for (keys %SSL) {
- #warn "looking for $APACHE_SRC/$_\n";
- return $SSL{$_} if -e "$d/$_";
+ #warn "looking for $APACHE_SRC/$_\n";
+ return $SSL{$_} if -e "$d/$_";
}
+
return 0;
}
-
+
sub write_extra_tests {
- #ensure we can find blib/
+
+ #ensure we can find blib/
local *FH;
open FH, ">t/docs/blib.pl";
print FH "use lib qw(\n",
- (map { "$PWD/$_\n" } qw(blib/lib blib/arch)),
- ");\n1;\n";
+ (map { "$PWD/$_\n" } qw(blib/lib blib/arch)),
+ ");\n1;\n";
close FH;
for my $f (qw(.htaccess hooks.txt)) {
- open FH, ">t/docs/$f";
- print FH " ";
- close FH;
- chmod 0666, "t/docs/$f";#make sure httpd can write to it
+ open FH, ">t/docs/$f";
+ print FH " ";
+ close FH;
+ chmod 0666, "t/docs/$f";#make sure httpd can write to it
}
- if($PERL_SSI) {
- cp "t/modules/ssi.test", "t/modules/ssi.t";
- } else {
- unlink "t/modules/ssi.t"; # might be there from prior run
+ if ($PERL_SSI) {
+ cp "t/modules/ssi.test", "t/modules/ssi.t";
+ }
+ else {
+ unlink "t/modules/ssi.t"; # might be there from prior run
}
mkdir "t/docs/subr", 0755;
if ($Is_Win32) {
- open FH, ">t/docs/subr/index.html"
- or die "Cannot open t/docs/subr/index.html: $!";
- print FH scalar(localtime);
- close FH;
+ open FH, ">t/docs/subr/index.html"
+ or die "Cannot open t/docs/subr/index.html: $!";
+ print FH scalar(localtime);
+ close FH;
}
else {
- system "date > t/docs/subr/index.html";
+ system "date > t/docs/subr/index.html";
}
return unless
- $callback_hooks{PERL_STACKED_HANDLERS}
- and $callback_hooks{PERL_FIXUP};
+ $callback_hooks{PERL_STACKED_HANDLERS}
+ and $callback_hooks{PERL_FIXUP};
local *FH;
my $meth_test;
- if($callback_hooks{PERL_METHOD_HANDLERS}) {
- $meth_test = <<'EOF';
+ if ($callback_hooks{PERL_METHOD_HANDLERS}) {
+ $meth_test = <<'EOF';
#see startup.pl
PerlFixupHandler MyClass->method
PerlFixupHandler $MyClass::Object->method
@@ -1245,6 +1275,7 @@
PerlFixupHandler LoadClass->method
EOF
}
+
my $dir = "t/docs/stacked";
mkdir $dir, 0755;
cp "t/docs/test.html", $dir;
@@ -1253,56 +1284,56 @@
$meth_test
PerlFixupHandler Apache::Constants::OK Apache::Constants::DECLINED MyClass::method
EOF
- close FH;
+ close FH;
}
cp "t/conf/httpd.conf", "t/httpd.conf";
-if($ENV{TEST_PERL_DIRECTIVES}) {
+if ($ENV{TEST_PERL_DIRECTIVES}) {
#push @DIR, 't/TestDirectives';
if($Is_dougm and $USE_THREADS) {
- delete $ENV{TEST_PERL_DIRECTIVES};
+ delete $ENV{TEST_PERL_DIRECTIVES};
}
else {
- system "(cd t/TestDirectives && $^X Makefile.PL)";
+ system "(cd t/TestDirectives && $^X Makefile.PL)";
}
}
$TARGET ||= (is_ssl() ? "httpsd" : "httpd");
WriteMakefile(
- #DIR => \@DIR,
- NAME => "mod_perl",
- VERSION => $VERSION,
- ($] < 5.005 ? () :
- (
- ABSTRACT => 'Embed a Perl interpreter in the Apache HTTP server',
- AUTHOR => 'Doug MacEachern <do...@pobox.com>',
- )),
- #should override `CCFLAGS', can't with older perls
- #CCDLFLAGS => "$Config{ccdlflags} $EXTRA_CFLAGS",
- DEFINE => $EXTRA_CFLAGS,
- macro => {
- PERL => $Config{'perlpath'},
- OPCODE_FILE => "src/opcodes.txt",
- APACHE_ROOT => $APACHE_ROOT,
- APACHE_SRC => $APACHE_SRC,
- ARCHNAME => $Config{archname},
- HTTPD => $TARGET,
- PORT => $PORT,
- PWD => $PWD,
- PERL5LIB_ENV => "PERL5LIB=$ENV{PERL5LIB}",
- SHRPENV => $Config{shrpenv},
- CVSROOT => 'cvs.apache.org:/home/cvs',
- },
- 'dist' => {
- COMPRESS=> 'gzip -9f', SUFFIX=>'gz',
- CI => qq(ci -u -m\\"See Changes file\\"),
- },
- clean => {
- FILES => "@do_clean",
- }
-);
+ #DIR => \@DIR,
+ NAME => "mod_perl",
+ VERSION => $VERSION,
+ ($] < 5.005 ? () :
+ (
+ ABSTRACT => 'Embed a Perl interpreter in the Apache HTTP server',
+ AUTHOR => 'Doug MacEachern <do...@pobox.com>',
+ )),
+ #should override `CCFLAGS', can't with older perls
+ #CCDLFLAGS => "$Config{ccdlflags} $EXTRA_CFLAGS",
+ DEFINE => $EXTRA_CFLAGS,
+ macro => {
+ PERL => $Config{'perlpath'},
+ OPCODE_FILE => "src/opcodes.txt",
+ APACHE_ROOT => $APACHE_ROOT,
+ APACHE_SRC => $APACHE_SRC,
+ ARCHNAME => $Config{archname},
+ HTTPD => $TARGET,
+ PORT => $PORT,
+ PWD => $PWD,
+ PERL5LIB_ENV => "PERL5LIB=$ENV{PERL5LIB}",
+ SHRPENV => $Config{shrpenv},
+ CVSROOT => 'cvs.apache.org:/home/cvs',
+ },
+ 'dist' => {
+ COMPRESS=> 'gzip -9f', SUFFIX=>'gz',
+ CI => qq(ci -u -m\\"See Changes file\\"),
+ },
+ clean => {
+ FILES => "@do_clean",
+ }
+ );
print "*** BSDI users: be sure to read the INSTALL `Notes' section ***\n"
if $Config{osname} =~ /bsdos/i;
@@ -1311,94 +1342,101 @@
sub MY::dist_basics {
my $self = shift;
+
my $string = $self->MM::dist_basics;
if($USE_APXS) {
- $string =~ s/(distclean\s+::\s+)/$1 apxs_distclean /;
+ $string =~ s/(distclean\s+::\s+)/$1 apxs_distclean /;
}
+
return $string;
}
sub MY::clean {
my $self = shift;
+
my $string = $self->MM::clean(@_);
if ($win32_auto) {
- $string .= sprintf
- qq{\tmsdev src\\modules\\win32\\mod_perl.dsp \\\n} .
- qq{\t/MAKE "mod_perl - Win32 %s" /CLEAN\n},
- ($win32_args{DEBUG} == 1) ? 'Debug' : 'Release';
- return $string;
+ $string .= sprintf
+ qq{\tmsdev src\\modules\\win32\\mod_perl.dsp \\\n} .
+ qq{\t/MAKE "mod_perl - Win32 %s" /CLEAN\n},
+ ($win32_args{DEBUG} == 1) ? 'Debug' : 'Release';
+ return $string;
}
unless($NO_HTTPD) {
- my $asrc = asrc($APACHE_SRC, "http_main.c");
- return $string unless $APACHE_SRC and -e "$asrc/http_main.c";
- $string .= "\t-cd \$(APACHE_SRC) && \$(MAKE) clean\n";
+ my $asrc = asrc($APACHE_SRC, "http_main.c");
+ return $string unless $APACHE_SRC and -e "$asrc/http_main.c";
+ $string .= "\t-cd \$(APACHE_SRC) && \$(MAKE) clean\n";
}
- if($USE_APXS) {
- $string .= "\t-cd ./apaci && \$(MAKE) clean\n";
+ if ($USE_APXS) {
+ $string .= "\t-cd ./apaci && \$(MAKE) clean\n";
}
+
$string;
}
sub MY::install {
my $self = shift;
+
my $string = $self->MM::install;
my $add = "";
- if($USE_APXS) {
- $add = "apxs_install";
+ if ($USE_APXS) {
+ $add = "apxs_install";
}
elsif ($win32_auto and
($win32_args{INSTALL_DLL} or $win32_args{INSTALL_LIB})) {
- $add = 'amp_install';
+ $add = 'amp_install';
}
- elsif($USE_APACI) {
- if($APACI_ARGS =~ /--prefix=/ or $APACHE_PREFIX) {
- $add = "apaci_install";
- }
+ elsif ($USE_APACI) {
+ if ($APACI_ARGS =~ /--prefix=/ or $APACHE_PREFIX) {
+ $add = "apaci_install";
+ }
}
- if($add and (!$NO_HTTPD and !$PREP_HTTPD) or $USE_APXS or $win32_auto) {
- $string =~ s/(pure_install\s+)(.*)/$1 $add $2/;
+ if ($add and (!$NO_HTTPD and !$PREP_HTTPD) or $USE_APXS or $win32_auto) {
+ $string =~ s/(pure_install\s+)(.*)/$1 $add $2/;
}
+
return $string;
}
sub MY::top_targets {
my $self = shift;
+
my $string = $self->MM::top_targets;
return $string unless $USE_APXS or $USE_APACI or $APACHE_SRC or $win32_auto;
if ($win32_auto) {
- $string =~ s/(pure_all\s+::.*\s+subdirs\s+)(.*)/$1 amp_dll $2/;
- $string .= sprintf qq{\namp_dll:\n} .
- qq{\tmsdev src\\modules\\win32\\mod_perl.dsp \\\n} .
- qq{\t/MAKE "mod_perl - Win32 %s" /USEENV\n},
- ($win32_args{DEBUG} == 1) ? 'Debug' : 'Release';
- if ($win32_args{INSTALL_DLL}) {
- $string .= sprintf qq{\namp_install:\n\t\$(CP) "%s" "%s"},
- "$win32_path{MODPERL_LIB}/mod_perl.so",
- $win32_args{INSTALL_DLL} .
- ($win32_args{APACHE_VERS} < 1315 ?
- '/ApacheModulePerl.dll' : '/mod_perl.so');
- }
- if ($win32_args{INSTALL_LIB}) {
- $string .= sprintf qq{\n\t\$(CP) "%s" "%s"},
- "$win32_path{MODPERL_LIB}/mod_perl.lib",
- $win32_args{INSTALL_LIB} . '/mod_perl.lib';
- }
- return $string;
+ $string =~ s/(pure_all\s+::.*\s+subdirs\s+)(.*)/$1 amp_dll $2/;
+ $string .= sprintf qq{\namp_dll:\n} .
+ qq{\tmsdev src\\modules\\win32\\mod_perl.dsp \\\n} .
+ qq{\t/MAKE "mod_perl - Win32 %s" /USEENV\n},
+ ($win32_args{DEBUG} == 1) ? 'Debug' : 'Release';
+ if ($win32_args{INSTALL_DLL}) {
+ $string .= sprintf qq{\namp_install:\n\t\$(CP) "%s" "%s"},
+ "$win32_path{MODPERL_LIB}/mod_perl.so",
+ $win32_args{INSTALL_DLL} .
+ ($win32_args{APACHE_VERS} < 1315 ?
+ '/ApacheModulePerl.dll' : '/mod_perl.so');
+ }
+ if ($win32_args{INSTALL_LIB}) {
+ $string .= sprintf qq{\n\t\$(CP) "%s" "%s"},
+ "$win32_path{MODPERL_LIB}/mod_perl.lib",
+ $win32_args{INSTALL_LIB} . '/mod_perl.lib';
+ }
+ return $string;
}
- if($USE_APXS) {
+ if ($USE_APXS) {
$string =~ s/(pure_all\s+::\s+)(.*)/$1 apxs_libperl $2/;
}
- elsif($USE_APACI and !$PREP_HTTPD) {
- $string =~ s/(pure_all\s+::\s+)(.*)/$1 apaci_httpd $2/;
+ elsif ($USE_APACI and !$PREP_HTTPD) {
+ $string =~ s/(pure_all\s+::\s+)(.*)/$1 apaci_httpd $2/;
}
- elsif($APACHE_SRC) {
- return $string unless -f "$APACHE_SRC/$Configuration";
- my $asrc = asrc($APACHE_SRC, "http_main.c");
- if(-e "$asrc/http_main.c" and !$NO_HTTPD) {
- $string =~ s/(pure_all\s+::\s+)(.*)/$1 apache_httpd $2/;
- }
+ elsif ($APACHE_SRC) {
+ return $string unless -f "$APACHE_SRC/$Configuration";
+ my $asrc = asrc($APACHE_SRC, "http_main.c");
+ if (-e "$asrc/http_main.c" and !$NO_HTTPD) {
+ $string =~ s/(pure_all\s+::\s+)(.*)/$1 apache_httpd $2/;
+ }
}
$string .= <<'EOF';
@@ -1458,17 +1496,20 @@
}
sub MY::pasthru {
- return unless $APACHE_SRC;
my $self = shift;
+
+ return unless $APACHE_SRC;
+
chomp(my $str = $self->MM::pasthru);
join $/, "$str\\",
- "\t".'APACHE_SRC="$(APACHE_SRC)"\\',
- "\t".'DEFINE="$(DEFINE)"',
- "";
+ "\t".'APACHE_SRC="$(APACHE_SRC)"\\',
+ "\t".'DEFINE="$(DEFINE)"',
+ "";
}
sub MY::test {
my $self = shift;
+
my $test = $self->MM::test;
my $mmn = magic_number($APACHE_SRC);
return <<'EOF' if $USE_APXS and not $Is_dougm;
@@ -1484,34 +1525,34 @@
$script .= ".win32" if $Is_Win32;
my $my_test = $Is_Win32 ? q(
-test: run_tests
+ test: run_tests
) :
q(
-test: pure_all start_httpd run_tests kill_httpd
+ test: pure_all start_httpd run_tests kill_httpd
);
- my $have_so = $USE_DSO || ($APACI_ARGS =~ /--enable-shared=/);
- push @test_pre_init, "\t",
- './apaci/load_modules.pl $(APACHE_SRC)', "\n" if $have_so;
-
+ my $have_so = $USE_DSO || ($APACI_ARGS =~ /--enable-shared=/);
+ push @test_pre_init, "\t",
+ './apaci/load_modules.pl $(APACHE_SRC)', "\n" if $have_so;
+
join '', @test_pre_init,
- qq(
-MP_TEST_SCRIPT=$script
+ qq(
+ MP_TEST_SCRIPT=$script
),
q(
-TEST_VERBOSE=0
+ TEST_VERBOSE=0
-kill_httpd:
- kill `cat t/logs/httpd.pid`
+ kill_httpd:
+kill `cat t/logs/httpd.pid`
@$(RM_F) t/conf/srm.conf
@$(RM_F) t/logs/mod_perl.lock*
$(RM_F) t/logs/httpd.pid
$(RM_F) t/logs/error_log
-start_httpd: test_pre_init
+ start_httpd: test_pre_init
@(cd t/conf; test -f httpd.conf || cp httpd.conf-dist httpd.conf)
@(cd t/net; test -f config.pl || cp config.pl.dist config.pl)
@$(TOUCH) t/conf/srm.conf
@@ -1522,13 +1563,13 @@
@sleep 2
@echo done
-start_httpd_fork:
- $(APACHE_SRC)/$(HTTPD) -f `pwd`/t/conf/httpd.conf -d `pwd`/t
+ start_httpd_fork:
+$(APACHE_SRC)/$(HTTPD) -f `pwd`/t/conf/httpd.conf -d `pwd`/t
-rehttpd: kill_httpd start_httpd
+ rehttpd: kill_httpd start_httpd
-run_tests:
- $(FULLPERL) $(MP_TEST_SCRIPT) $(TEST_VERBOSE)
+ run_tests:
+$(FULLPERL) $(MP_TEST_SCRIPT) $(TEST_VERBOSE)
),
@@ -1536,8 +1577,8 @@
q(
-test_report:
- $(MAKE) test | t/report
+ test_report:
+$(MAKE) test | t/report
);
}
@@ -1545,14 +1586,18 @@
sub MY::subdirs {
my $self = shift;
- if($ENV{TEST_PERL_DIRECTIVES}) {
- push @{$self->{DIR}}, "t/TestDirectives";
+
+ if ($ENV{TEST_PERL_DIRECTIVES}) {
+ push @{$self->{DIR}}, "t/TestDirectives";
}
+
$self->MM::subdirs(@_);
}
sub wanted {
+
return unless /\.h$/ or /os-inline\.c$/;
+
(my $d = $File::Find::dir) =~ s:^\Q$APACHE_SRC::;
$d =~ s:^/::;
@@ -1565,7 +1610,9 @@
}
sub win32_mph {
+
return unless /\.h$/ or /os-inline\.c$/;
+
(my $d = $File::Find::dir) =~ s:^\Q$MODPERL_SRC::;
$d =~ s:^/::;
my $from = "$File::Find::dir/$_";
@@ -1577,42 +1624,44 @@
}
sub MY::post_initialize {
- my($self) = shift;
+ my $self = shift;
return unless $APACHE_HEADER_INSTALL;
- my($ap_src, $ap_inc);
+
+ my ($ap_src, $ap_inc);
if ($APACHE_SRC) {
- $ap_src = $APACHE_SRC;
- $ap_inc = "$ap_src/include";
+ $ap_src = $APACHE_SRC;
+ $ap_inc = "$ap_src/include";
}
elsif ($USE_APXS) {
- #$base = `$WITH_APXS -q INCLUDEDIR`;
- $ap_inc = $ap_src = 'src'; #just install mod_perl headers
+ #$base = `$WITH_APXS -q INCLUDEDIR`;
+ $ap_inc = $ap_src = 'src'; #just install mod_perl headers
}
return unless $ap_src and -d $ap_src;
$My::self = $self;
{
- local $APACHE_SRC = $ap_src;
- finddepth(\&wanted, $ap_src);
+ local $APACHE_SRC = $ap_src;
+ finddepth(\&wanted, $ap_src);
}
if ($Is_Win32) {
local $MODPERL_SRC = win32_fix_path($PWD) . '/src/modules/perl';
- finddepth(\&win32_mph, $MODPERL_SRC);
+ finddepth(\&win32_mph, $MODPERL_SRC);
}
+
$self->{PM}{"Apache/typemap"} = '$(INST_ARCHLIB)/' . "auto/Apache/typemap";
$self->{PM}{"apaci/mod_perl.exp"} = '$(INST_ARCHLIB)/' . "auto/Apache/mod_perl.exp";
for (qw(ap_config_auto.h)) {
- my $from = "$ap_inc/$_";
- my $to = '$(INST_ARCHLIB)/' . "auto/Apache/include/$_";
- unless ($self->{PM}->{$from}) {
- $self->{PM}->{$from} = $to;
- my @args = ($Config{perlpath}, '-MExtUtils::Command',
- '-e', 'touch', $from);
- system(@args) == 0
- or die "system @args failed: $?";
- }
+ my $from = "$ap_inc/$_";
+ my $to = '$(INST_ARCHLIB)/' . "auto/Apache/include/$_";
+ unless ($self->{PM}->{$from}) {
+ $self->{PM}->{$from} = $to;
+ my @args = ($Config{perlpath}, '-MExtUtils::Command',
+ '-e', 'touch', $from);
+ system(@args) == 0
+ or die "system @args failed: $?";
+ }
}
'';
@@ -1632,84 +1681,91 @@
sub MY::manifypods {
my $self = shift;
+
my $ver = $self->{VERSION} || "";
local($_) = $self->MM::manifypods(@_);
s/pod2man\s*$/pod2man --release mod_perl-$ver/m;
+
$_;
}
sub fold_dots {
my $v = shift;
+
$v =~ s/\.//g;
$v .= "0" if length $v < 3;
+
$v;
}
sub vcache {
- my($v,$dir) = @_;
+ my ($v,$dir) = @_;
+
$vcache{$dir} = fold_dots($v);
}
sub httpd_version {
- my($dir, $vnumber) = @_;
+ my ($dir, $vnumber) = @_;
+
local $^W=0;
$dir = asrc($dir) || "";
- if($vnumber) {
- return $vcache{$dir} if $vcache{$dir};
+ if ($vnumber) {
+ return $vcache{$dir} if $vcache{$dir};
}
my $fh = FileHandle->new("$dir/httpd.h") or return;
- my($server, $version, $rest);
- my($fserver, $fversion, $frest);
- my($string, $extra, @vers);
- while(<$fh>) {
- next unless /^#define/;
- s/SERVER_PRODUCT \"/\"Apache/; #1.3.13
- next unless s/^#define\s+SERVER_(BASE|)(VERSION|REVISION)\s+"(.*)\s*".*/$3/;
+ my ($server, $version, $rest);
+ my ($fserver, $fversion, $frest);
+ my ($string, $extra, @vers);
+ while (<$fh>) {
+ next unless /^#define/;
+ s/SERVER_PRODUCT \"/\"Apache/; #1.3.13
+ next unless s/^#define\s+SERVER_(BASE|)(VERSION|REVISION)\s+"(.*)\s*".*/$3/;
unless (m:/:) {
$_ = "Apache/$_"; #1.3.14, argh
}
- chomp($string = $_);
+ chomp ($string = $_);
- #print STDERR "Examining SERVER_VERSION '$string'...";
- #could be something like:
- #Stronghold-1.4b1-dev Ben-SSL/1.3 Apache/1.1.1
- @vers = split /\s+/, $string;
- foreach (@vers) {
- next unless ($fserver,$fversion,$frest) =
- m,^([^/]+)/(\d\.\d+\.?\d*)([^ ]*),i;
- #print STDERR "match ($fserver,$fversion,$frest)\n";
- if($fserver =~ /Xcert-Sentry/i or $fserver eq "Ben-SSL") {
- $extra ||= $fserver;
- #print STDERR "I see $fserver/$fversion, ok\n";
- next;
- }
-
- if($fserver eq "Apache") {
- ($server, $version) = ($fserver, $fversion);
- if($version eq '1.2' and $frest =~ s/^b(\d+).*/$1/) {
- if($frest >= 8 and is_ssl($dir)) {
- $do_link_swap++;
- $can_dash_make{$dir}++;
-
- return $vnumber ? vcache($version,$dir) : "NONE";
- }
- warn "Apache/1.2b$frest is not supported, upgrade to 1.2.0.\n";
- return undef;
- }
- elsif($version >= 1.2) {
- $do_link_swap++ if is_ssl($dir);
- $can_dash_make{$dir}++;
- return $vnumber ? vcache($version,$dir) : "NONE";
- }
- }
- else {
- #print STDERR "'$fserver/$fversion' unrecognized.\n";
- next;
- }
- print STDERR "Found $fserver '$fversion' in $dir/httpd.h\n";
- }
+ #print STDERR "Examining SERVER_VERSION '$string'...";
+ #could be something like:
+ #Stronghold-1.4b1-dev Ben-SSL/1.3 Apache/1.1.1
+ @vers = split /\s+/, $string;
+ foreach (@vers) {
+ next unless ($fserver,$fversion,$frest) =
+ m,^([^/]+)/(\d\.\d+\.?\d*)([^ ]*),i;
+ #print STDERR "match ($fserver,$fversion,$frest)\n";
+ if ($fserver =~ /Xcert-Sentry/i or $fserver eq "Ben-SSL") {
+ $extra ||= $fserver;
+ #print STDERR "I see $fserver/$fversion, ok\n";
+ next;
+ }
+
+ if ($fserver eq "Apache") {
+ ($server, $version) = ($fserver, $fversion);
+ if ($version eq '1.2' and $frest =~ s/^b(\d+).*/$1/) {
+ if ($frest >= 8 and is_ssl($dir)) {
+ $do_link_swap++;
+ $can_dash_make{$dir}++;
+
+ return $vnumber ? vcache($version,$dir) : "NONE";
+ }
+ warn "Apache/1.2b$frest is not supported, upgrade to 1.2.0.\n";
+ return undef;
+ }
+ elsif ($version >= 1.2) {
+ $do_link_swap++ if is_ssl($dir);
+ $can_dash_make{$dir}++;
+ return $vnumber ? vcache($version,$dir) : "NONE";
+ }
+ }
+ else {
+ #print STDERR "'$fserver/$fversion' unrecognized.\n";
+ next;
+ }
+ print STDERR "Found $fserver '$fversion' in $dir/httpd.h\n";
+ }
}
$fh->close;
+
#print STDERR "return $version$extra\n";
return($version.$extra);
}
@@ -1719,34 +1775,39 @@
sub magic_number {
my $d = asrc shift;
+
my $src = Apache::src->new;
$src->dir($d);
+
return($mcache{$d} = $src->module_magic_number);
}
sub cleanup_for_static {
+
return unless $STATIC;
+
for (@xs_mod_snames) {
- rename "${_}/${_}.xs.disabled", "${_}/${_}.xs";
+ rename "${_}/${_}.xs.disabled", "${_}/${_}.xs";
}
}
sub setup_for_static {
+
my $d = "$APACHE_SRC/modules/perl";
my $mf = "$APACHE_SRC/modules/perl/Makefile";
my @static_src = ();
unless ($USE_APACI) {
- iedit $mf, "s/(PERL_STATIC_EXTS) =.*/\$1 = $PERL_STATIC_EXTS/"
- if $PERL_STATIC_EXTS;
+ iedit $mf, "s/(PERL_STATIC_EXTS) =.*/\$1 = $PERL_STATIC_EXTS/"
+ if $PERL_STATIC_EXTS;
}
return unless $STATIC;
cp "Apache/typemap", $d;
for (@xs_mod_snames) {
- rename "${_}/${_}.xs", "${_}/${_}.xs.disabled" if -e "${_}/${_}.xs";
- push @static_src, "$_.c";
+ rename "${_}/${_}.xs", "${_}/${_}.xs.disabled" if -e "${_}/${_}.xs";
+ push @static_src, "$_.c";
}
=pod
@@ -1774,41 +1835,45 @@
=cut
unless ($USE_APACI) {
- #XXX: ho,hum, need to generate the whole damn thing
- #instead of all these frigging iedits.
- if ($DYNAMIC) {
- }
- else {
- iedit $mf, "s/^#STATIC_SRC.*/STATIC_SRC = @static_src/";
- iedit $mf, "s/^#STATIC_EXTS.*/STATIC_EXTS = @xs_modules/";
- iedit $mf, "s/^#STATIC_/STATIC_/";
- }
- #bloody hell, make sucks and so does this.
- #this has only cause a few people pain, enough.
- iedit $mf, "s/ \Q\$(STATIC_SRC)\E/ @static_src/";
+ #XXX: ho,hum, need to generate the whole damn thing
+ #instead of all these frigging iedits.
+ if ($DYNAMIC) {
+ }
+ else {
+ iedit $mf, "s/^#STATIC_SRC.*/STATIC_SRC = @static_src/";
+ iedit $mf, "s/^#STATIC_EXTS.*/STATIC_EXTS = @xs_modules/";
+ iedit $mf, "s/^#STATIC_/STATIC_/";
+ }
+
+ #bloody hell, make sucks and so does this.
+ #this has only cause a few people pain, enough.
+ iedit $mf, "s/ \Q\$(STATIC_SRC)\E/ @static_src/";
}
}
sub module_name_from_xs {
my $file = shift;
+
my $fh = FileHandle->new($file) or
- die "can't open file $file $!";
- my($module, $package, $prefix, %seen);
- while(<$fh>) {
- if( ($module, $package, $prefix) =
- /^MODULE\s*=\s*([\w:]+)(?:\s+PACKAGE\s*=\s*([\w:]+))?(?:\s+PREFIX\s*=\s*(\S+))?\s*$/)
- {
- $seen{$module}++;
- }
+ die "can't open file $file $!";
+ my ($module, $package, $prefix, %seen);
+ while (<$fh>) {
+ if (($module, $package, $prefix) =
+ /^MODULE\s*=\s*([\w:]+)(?:\s+PACKAGE\s*=\s*([\w:]+))?(?:\s+PREFIX\s*=\s*(\S+))?\s*$/)
+ {
+ $seen{$module}++;
+ }
}
- if(keys %seen > 1) {
- warn "$module name guess might be incorrect";
+ if (keys %seen > 1) {
+ warn "$module name guess might be incorrect";
}
+
return (keys %seen)[0];
}
sub asrc {
my $d = shift;
+
my $file = shift || "httpd.h";
return $d if -e "$d/$file";
return "$d/include" if -e "$d/include/$file";
@@ -1817,14 +1882,17 @@
}
sub conf_append {
+
local *CFG;
open CFG, ">>t/conf/httpd.conf" or die "open httpd.conf $!";
print CFG join "\n", @_, "";
close CFG;
+
}
sub edit_extra_cflags {
- my($cfg) = @_;
+ my ($cfg) = @_;
+
my $fh = IO::File->new($cfg) or die "open $cfg $!";
my $repl = "";
my @file = ();
@@ -1840,50 +1908,50 @@
$inc .= " -DMOD_PERL";
while (<$fh>) {
- push @file, $_;
- next unless /EXTRA_CFLAGS\s*=/;
- next if /mod_perl/;
- next if /^#/;
- chomp;
-
- $repl = $_;
-
- my $backwhack = "";
- if($repl =~ s/(\\)\s*$//) {
- $backwhack = $1;
- }
- my $mmn = magic_number($APACHE_SRC);
- if($mmn >= 19980507) {
- $ADD_VERSION = 0;
- }
- if($ADD_VERSION) {
- if(/$dssv=/) {
- $repl =~
- s{
- $dssv\s*=\s*(.?)['"](.*?)(.?)["']
- }[
- qq($dssv="$1"$2 mod_perl/$VERSION$3"")
- ]ex;
- }
- else {
- $repl .= " $ssv";
- }
- }
-
- $file[-1] = "$repl $inc $backwhack\n";
+ push @file, $_;
+ next unless /EXTRA_CFLAGS\s*=/;
+ next if /mod_perl/;
+ next if /^#/;
+ chomp;
+
+ $repl = $_;
+
+ my $backwhack = "";
+ if ($repl =~ s/(\\)\s*$//) {
+ $backwhack = $1;
+ }
+ my $mmn = magic_number($APACHE_SRC);
+ if ($mmn >= 19980507) {
+ $ADD_VERSION = 0;
+ }
+ if ($ADD_VERSION) {
+ if (/$dssv=/) {
+ $repl =~
+ s{
+ $dssv\s*=\s*(.?)['"](.*?)(.?)["']
+ }[
+ qq($dssv="$1"$2 mod_perl/$VERSION$3"")
+ ]ex;
+ }
+ else {
+ $repl .= " $ssv";
+ }
+ }
+ $file[-1] = "$repl $inc $backwhack\n";
}
close $fh;
- if($repl) {
- $fh = IO::File->new(">$cfg") or die "open $cfg $!";
- print $fh @file;
- close $fh;
+ if ($repl) {
+ $fh = IO::File->new(">$cfg") or die "open $cfg $!";
+ print $fh @file;
+ close $fh;
}
}
sub conf_fixup {
my($mf, $cfg) = @_;
+
return if $USE_APACI;
my $mmn = magic_number($APACHE_SRC);
@@ -1895,95 +1963,105 @@
$libperl ||= "";
my $ldopts = "`$^X $PWD/src/modules/perl/ldopts $PERL_STATIC_EXTS $libperl`";
iedit $cfg,
- q{next unless /EXTRA_LIBS\s*=/;}.
- q{next if /perl/; chomp;}.
- qq{\$_ .= q| $ldopts\n|;};
+ q{next unless /EXTRA_LIBS\s*=/;}.
+ q{next if /perl/; chomp;}.
+ qq{\$_ .= q| $ldopts\n|;};
for (split ",", $ADD_MODULE) {
- add_module($cfg,$_);
+ add_module($cfg,$_);
}
- if(is_ssl() =~ /stronghold/i) {
- if($do_link_swap) {
- warn "swapping link order in $mf for Stronghold\n";
- my $repl = quotemeta('$(REGLIB) $(LIBS)');
- iedit $mf, "s:\Q\$(LIBS) \$(REGLIB)\E:$repl:;";
+ if (is_ssl() =~ /stronghold/i) {
+ if ($do_link_swap) {
+ warn "swapping link order in $mf for Stronghold\n";
+ my $repl = quotemeta('$(REGLIB) $(LIBS)');
+ iedit $mf, "s:\Q\$(LIBS) \$(REGLIB)\E:$repl:;";
#XXX hack
$repl = quotemeta('CFLAGS=$(CFLAGS)');
iedit $mf, qq(s:\Q\"CFLAGS=\$(CFLAGS)"\E:'$repl':;); #"
- }
- my $repl = q{AUX_CFLAGS='\$(CFLAGS)'};
- iedit $mf, qq{s/AUX_CFLAGS="..CFLAGS."/$repl/};
+ }
+ my $repl = q{AUX_CFLAGS='\$(CFLAGS)'};
+ iedit $mf, qq{s/AUX_CFLAGS="..CFLAGS."/$repl/};
}
+
{
- my $repl = q{CC='\$(CC)'};
- iedit $mf, qq{s/CC=..CC. /$repl /};
+ my $repl = q{CC='\$(CC)'};
+ iedit $mf, qq{s/CC=..CC. /$repl /};
}
- open(CONF, $cfg) || die "Can't open $cfg: $!";
+ open (CONF, $cfg) || die "Can't open $cfg: $!";
while (<CONF>) {
- $seen_modperl++ if
- /^Module\s+perl_module/i ||
- /^AddModule\s+.*libperl/;
+ $seen_modperl++ if
+ /^Module\s+perl_module/i ||
+ /^AddModule\s+.*libperl/;
}
- close(CONF);
+ close CONF;
unless ($seen_modperl) {
- print "Appending mod_perl to $conf\n";
- open(CONF, ">>$cfg") || die "Can't open $cfg: $!";
- my $line;
- $line = $sro ? "AddModule modules/perl/libperl.a" :
- "Module perl_module modules/perl/libperl.a";
- print CONF <<EOT;
+ print "Appending mod_perl to $conf\n";
+ open(CONF, ">>$cfg") || die "Can't open $cfg: $!";
+ my $line;
+ $line = $sro ? "AddModule modules/perl/libperl.a" :
+ "Module perl_module modules/perl/libperl.a";
+ print CONF <<EOT;
# Embed a perl interpreter
$line
EOT
- close(CONF);
- } else {
- print "mod_perl already present in $conf\n";
+ close CONF;
+ }
+ else {
+ print "mod_perl already present in $conf\n";
}
}
-
sub has_module {
my($cfg, $name) = @_;
- local(*IN);
+
+ local *IN;
open IN, $cfg or die "Can't open $cfg $!\n";
- while(<IN>) {
- if(/^\\w{0,3}Module\\s+.*$name\.[oa]/i) {
- close IN;
-# print STDERR "has module $name\n";
- return 1;
- }
+ while (<IN>) {
+ if (/^\\w{0,3}Module\\s+.*$name\.[oa]/i) {
+ close IN;
+ # print STDERR "has module $name\n";
+ return 1;
+ }
}
+
return 0;
}
-
+
sub add_module {
my($cfg, $name) = @_;
+
iedit $cfg, "s/^#\\s+(\\w{0,3}Module\\s+.*$name\.[oa])/\$1/";
}
sub gen_script {
my $file = shift;
- my(@lib) = @_;
- local(*IN,*OUT);
+ my (@lib) = @_;
+
+ local (*IN,*OUT);
open IN, "$file.PL" or die "Couldn't open $file.PL: $!";
open OUT, ">$file" or die "Couldn't open $file: $!";
+
print OUT "#!$Config{perlpath}\n";
+
if (@lib) {
print OUT "use lib qw(@lib);\n";
}
print OUT join '', <IN>;
+
close OUT;
close IN;
- chmod 0755, "$file";
+
+ chmod 0755, "$file";
}
sub iedit {
my $file = shift;
+
return if $Is_Win32;
#print STDERR "-e @_\n";
@@ -1991,6 +2069,7 @@
}
sub win32_setup {
+
my $d = "src/modules/perl";
dirent_kludge($d);
cp "Apache/typemap", $d;
@@ -1999,22 +2078,22 @@
my $lib = $Config{privlibexp};
for (@xs_mod_snames) {
system "$^X $lib/ExtUtils/xsubpp -typemap $lib/ExtUtils/typemap $_.xs > $_.c";
-
}
chdir "../../../";
- open(F, '>t/docs/init.pl')
- or die "Cannot open t/docs/init.pl: $!";
+ open (F, '>t/docs/init.pl')
+ or die "Cannot open t/docs/init.pl: $!";
print F <<"END";
#!perl
\$Apache::Server::CWD = '$PWD';
END
- close F;
+ close F;
}
sub dirent_kludge {
my $d = shift;
+
local *FH;
open FH, ">$d/dirent.h" or die "can't write $d/dirent.h $!";
print FH <<EOF;
@@ -2033,6 +2112,7 @@
sub write_version_h {
my $d = shift;
+
unlink "$d/mod_perl_version.h";
my $pv = perl_version();
local *FH;
@@ -2047,24 +2127,27 @@
sub write_my_config {
my $src = shift;
-# preparing and writing Configuration to Apache::MyConfig
+ # preparing and writing Configuration to Apache::MyConfig
my %my_config = %callback_hooks;
- my @other_hooks = qw(APACHE_SRC SSL_BASE APXS PERL_USELARGEFILES
+ my @other_hooks = qw(
+ APACHE_SRC SSL_BASE APXS PERL_USELARGEFILES
PERL_TRACE PERL_DEBUG APACI_ARGS
APACHE_PREFIX DO_HTTPD NO_HTTPD PREP_HTTPD
USE_APACI APACHE_HEADER_INSTALL
- PERL_STATIC_EXTS PERL_SSI PERL_SECTIONS USE_APXS WITH_APXS);
+ PERL_STATIC_EXTS PERL_SSI PERL_SECTIONS USE_APXS WITH_APXS
+ );
{
no strict 'refs';
for (@other_hooks) {
$my_config{$_} = ${$_};
}
}
+
if ($win32_auto) {
for (qw(APACHE_INC APACHE_LIB MODPERL_INC MODPERL_LIB)) {
$my_config{$_} = $win32_path{$_};
}
- $my_config{APACHE_SRC} = $APACHE_SRC;
+ $my_config{APACHE_SRC} = $APACHE_SRC;
}
#need this alias for Apache::src backwards compat
@@ -2072,13 +2155,15 @@
$my_config{'APXS'} = delete $my_config{'WITH_APXS'};
my $my_config_dump = join ",\n",
- map { qq{'$_' => } .
- ($my_config{$_} =~ /^\d+$/ ? $my_config{$_} : qq{'$my_config{$_}'})
- } sort keys %my_config;
+ map {
+ qq{'$_' => } .
+ ($my_config{$_} =~ /^\d+$/ ? $my_config{$_} : qq{'$my_config{$_}'})
+ }
+ sort keys %my_config;
local *FH;
open FH, '>lib/Apache/MyConfig.pm' ||
- die "Can't open lib/Apache/MyConfig.pm: $!";
+ die "Can't open lib/Apache/MyConfig.pm: $!";
print FH <<EOT;
#
# Configuration for mod_perl and Apache::...
@@ -2120,232 +2205,254 @@
# obtain the Apache and mod_perl lib and include directories for Win32
sub win32_inc_and_lib {
- my $modperl_src = win32_fix_path(cwd) . '/src';
- $win32_path{MODPERL_INC} = $modperl_src . '/modules/perl';
- $win32_path{MODPERL_LIB} = ($win32_args{DEBUG} == 1) ?
- $modperl_src . '/modules/win32/Debug' :
- $modperl_src . '/modules/win32/Release';
-
- unless ( -d $win32_args{APACHE_SRC}) {
- opendir(DIR, '../') or die "Cannot read parent directory: $!\n";
- my @dirs = map {"../$_"}
- grep {/apache/ and -d "../$_"} readdir DIR;
- closedir DIR or die "Cannot close parent directory: $!\n";
- die "Cannot find the apache sources\n"
- unless ($win32_args{APACHE_SRC} = find_dir(\@dirs, 'apache source'));
- }
- $win32_args{APACHE_SRC} = win32_fix_path($win32_args{APACHE_SRC});
- if (-d "$win32_args{APACHE_SRC}/libexec") {
- $win32_path{APACHE_LIB} = $win32_args{APACHE_SRC} . '/libexec';
- $win32_path{APACHE_INC} = $win32_args{APACHE_SRC} . '/include';
- $win32_args{APACHE_VERS} = httpd_version($win32_path{APACHE_INC}, 1);
- }
- else {
- $win32_args{APACHE_SRC} .= '/src' unless $win32_args{APACHE_SRC} =~ /src$/;
- $win32_path{APACHE_INC} = $win32_args{APACHE_SRC} . '/include';
- $win32_args{APACHE_VERS} = httpd_version($win32_path{APACHE_INC}, 1);
- $win32_path{APACHE_LIB} = ($win32_args{DEBUG} == 1) ?
- $win32_args{APACHE_SRC} .
- ($win32_args{APACHE_VERS} < 1315 ? '/CoreD' : '/Debug') :
- $win32_args{APACHE_SRC} .
- ($win32_args{APACHE_VERS} < 1315 ? '/CoreR' : '/Release');
- }
- die "Cannot find ApacheCore.lib under $win32_path{APACHE_LIB}\n"
- unless -f "$win32_path{APACHE_LIB}/ApacheCore.lib";
- die "Cannot find httpd.h under $win32_path{APACHE_INC}\n"
- unless -f "$win32_path{APACHE_INC}/httpd.h";
-
- if ($win32_args{INSTALL_DLL} ) {
- $win32_args{INSTALL_DLL} =
- win32_fix_path($win32_args{INSTALL_DLL});
- unless ( -d $win32_args{INSTALL_DLL}) {
- my @dirs = grep {-d}
- ('\Program Files\Apache Group\Apache\modules',
- '\Apache\modules', '\Program Files\Apache\modules');
- $win32_args{INSTALL_DLL} = find_dir(\@dirs, 'Apache/modules');
- if ($win32_args{INSTALL_DLL} and -d $win32_args{INSTALL_DLL}) {
- $win32_args{INSTALL_DLL} =
- win32_fix_path($win32_args{INSTALL_DLL});
- }
- else {
- print <<'END';
+ my $modperl_src = win32_fix_path(cwd) . '/src';
+ $win32_path{MODPERL_INC} = $modperl_src . '/modules/perl';
+ $win32_path{MODPERL_LIB} = ($win32_args{DEBUG} == 1) ?
+ $modperl_src . '/modules/win32/Debug' :
+ $modperl_src . '/modules/win32/Release';
+
+ unless ( -d $win32_args{APACHE_SRC}) {
+ opendir(DIR, '../') or die "Cannot read parent directory: $!\n";
+ my @dirs = map {"../$_"}
+ grep {/apache/ and -d "../$_"} readdir DIR;
+ closedir DIR or die "Cannot close parent directory: $!\n";
+ die "Cannot find the apache sources\n"
+ unless ($win32_args{APACHE_SRC} = find_dir(\@dirs, 'apache source'));
+ }
+
+ $win32_args{APACHE_SRC} = win32_fix_path($win32_args{APACHE_SRC});
+ if (-d "$win32_args{APACHE_SRC}/libexec") {
+ $win32_path{APACHE_LIB} = $win32_args{APACHE_SRC} . '/libexec';
+ $win32_path{APACHE_INC} = $win32_args{APACHE_SRC} . '/include';
+ $win32_args{APACHE_VERS} = httpd_version($win32_path{APACHE_INC}, 1);
+ }
+ else {
+ $win32_args{APACHE_SRC} .= '/src' unless $win32_args{APACHE_SRC} =~ /src$/;
+ $win32_path{APACHE_INC} = $win32_args{APACHE_SRC} . '/include';
+ $win32_args{APACHE_VERS} = httpd_version($win32_path{APACHE_INC}, 1);
+ $win32_path{APACHE_LIB} = ($win32_args{DEBUG} == 1) ?
+ $win32_args{APACHE_SRC} .
+ ($win32_args{APACHE_VERS} < 1315 ? '/CoreD' : '/Debug') :
+ $win32_args{APACHE_SRC} .
+ ($win32_args{APACHE_VERS} < 1315 ? '/CoreR' : '/Release');
+ }
+
+ die "Cannot find ApacheCore.lib under $win32_path{APACHE_LIB}\n"
+ unless -f "$win32_path{APACHE_LIB}/ApacheCore.lib";
+ die "Cannot find httpd.h under $win32_path{APACHE_INC}\n"
+ unless -f "$win32_path{APACHE_INC}/httpd.h";
+
+ if ($win32_args{INSTALL_DLL} ) {
+ $win32_args{INSTALL_DLL} =
+ win32_fix_path($win32_args{INSTALL_DLL});
+ unless ( -d $win32_args{INSTALL_DLL}) {
+ my @dirs = grep {-d}
+ ('\Program Files\Apache Group\Apache\modules',
+ '\Apache\modules', '\Program Files\Apache\modules');
+ $win32_args{INSTALL_DLL} = find_dir(\@dirs, 'Apache/modules');
+ if ($win32_args{INSTALL_DLL} and -d $win32_args{INSTALL_DLL}) {
+ $win32_args{INSTALL_DLL} =
+ win32_fix_path($win32_args{INSTALL_DLL});
+ }
+ else {
+ print <<'END';
**** The Apache/modules directory was not found. *******
**** Please install mod_perl.so manually. *******
END
- }
+ }
+ }
}
- }
- if ($win32_args{INSTALL_LIB} ) {
- $win32_args{INSTALL_LIB} =
- win32_fix_path($win32_args{INSTALL_LIB});
- unless ( -d $win32_args{INSTALL_LIB}) {
- my @dirs = grep {-d}
- ('\Program Files\Apache Group\Apache\libexec',
- '\Apache\libexec', '\Program Files\Apache\libexec');
- $win32_args{INSTALL_LIB} = find_dir(\@dirs, 'Apache/libexec');
- if ($win32_args{INSTALL_LIB} and -d $win32_args{INSTALL_LIB}) {
- $win32_args{INSTALL_LIB} =
- win32_fix_path($win32_args{INSTALL_LIB});
- }
- else {
- print <<'END';
+
+ if ($win32_args{INSTALL_LIB} ) {
+ $win32_args{INSTALL_LIB} =
+ win32_fix_path($win32_args{INSTALL_LIB});
+ unless ( -d $win32_args{INSTALL_LIB}) {
+ my @dirs = grep {-d}
+ ('\Program Files\Apache Group\Apache\libexec',
+ '\Apache\libexec', '\Program Files\Apache\libexec');
+ $win32_args{INSTALL_LIB} = find_dir(\@dirs, 'Apache/libexec');
+ if ($win32_args{INSTALL_LIB} and -d $win32_args{INSTALL_LIB}) {
+ $win32_args{INSTALL_LIB} =
+ win32_fix_path($win32_args{INSTALL_LIB});
+ }
+ else {
+ print <<'END';
**** The Apache/libexec directory was not found. *******
**** Please install mod_perl.lib manually. *******
END
- }
- }
- }
+ }
+ }
+}
}
# fix mod_perl.dsp with the perl and apache inc and lib directories
sub win32_fix_dsp {
- my $amp = 'src/modules/win32';
- my $dsp = 'mod_perl.dsp';
- unless ( -f "$amp/$dsp.orig") {
- rename("$amp/$dsp", "$amp/$dsp.orig")
- or die "Couldn't rename $amp/$dsp: $!\n";
- }
- my $perl_inc = win32_fix_path_dsp("$Config{archlibexp}/CORE");
-
- open(OLDDSP, "$amp/$dsp.orig")
[... 374 lines stripped ...]