stas 2003/08/07 09:29:19
Modified: lib/Apache Build.pm . Makefile.PL Changes Log: new Apache::Build methods: mpm_name(), mpm_is_threaded(). use them in the top-level Makefile.PL to require 5.8.0/ithreads if mpm requires threads. Revision Changes Path 1.130 +22 -1 modperl-2.0/lib/Apache/Build.pm Index: Build.pm =================================================================== RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v retrieving revision 1.129 retrieving revision 1.130 diff -u -r1.129 -r1.130 --- Build.pm 6 Aug 2003 23:45:06 -0000 1.129 +++ Build.pm 7 Aug 2003 16:29:18 -0000 1.130 @@ -21,7 +21,7 @@ use constant MSVC => WIN32() && ($Config{cc} eq 'cl'); use constant REQUIRE_ITHREADS => grep { $^O eq $_ } qw(MSWin32); -use constant HAS_ITHREADS => +use constant PERL_HAS_ITHREADS => $Config{useithreads} && ($Config{useithreads} eq 'define'); use ModPerl::Code (); @@ -147,6 +147,27 @@ my $cflags = __PACKAGE__->apxs('-q' => 'CFLAGS'); $cflags =~ s/\"/\\\"/g; $cflags; +} + +my %threaded_mpms = map { $_ => 1} + qw(worker winnt beos mpmt_os2 netware leader perchild threadpool); +sub mpm_is_threaded { + my $self = shift; + my $mpm_name = $self->mpm_name(); + return $threaded_mpms{$mpm_name}; +} + +sub mpm_name { + my $self = shift; + + return $self->{mpm_name} if $self->{mpm_name}; + + # XXX: hopefully apxs will work on win32 one day + return $self->{mpm_name} = 'winnt' if WIN32; + + my $mpm_name = $self->apxs('-q' => 'MPM_NAME'); + die "Failed to obtain the MPM name" unless $mpm_name; + return $self->{mpm_name} = $mpm_name; } #--- Perl Config stuff --- 1.114 +22 -19 modperl-2.0/Makefile.PL Index: Makefile.PL =================================================================== RCS file: /home/cvs/modperl-2.0/Makefile.PL,v retrieving revision 1.113 retrieving revision 1.114 diff -u -r1.113 -r1.114 --- Makefile.PL 7 Aug 2003 03:23:52 -0000 1.113 +++ Makefile.PL 7 Aug 2003 16:29:19 -0000 1.114 @@ -321,33 +321,36 @@ sub perl_version_check { my $build = shift; - # the following mpms require threaded perl (== 5.8.0/ithreads+) - my %threaded_mpms = map { $_ => 1} - qw(worker winnt beos mpmt_os2 netware leader - perchild threadpool); - my $mpm = $build->apxs(-q => 'MPM_NAME') || 'unknown' ; - if ($threaded_mpms{$mpm}) { - unless (Apache::Build::HAS_ITHREADS()) { - error "this httpd ($mpm mpm) requires Perl w/ ithreads enabled\n"; - exit 1; - } - # 5.6.x ithreads aren't good - unless ($] >= 5.008) { - error "Perl 5.8 or higher w/ ithreads enabled is required. " . - "This is only Perl $]\n"; - exit 1; + my $perl_version = $]; + $perl_version =~ s/5.00(\d)(?:00(\d))?/"5.$1" . ($2 ? ".$2" : "")/e; + my $perl_threads = Apache::Build::PERL_HAS_ITHREADS ? "w/" : "w/o"; + my $perl_string = "Using Perl $perl_version $perl_threads ithreads"; + # certain mpms require perl 5.8.0+ w/ithreads + if ($build->mpm_is_threaded()) { + my $mpm = $build->mpm_name(); + my @fail; + push @fail, "Perl 5.8 or higher" + unless $] >= 5.008; + push @fail, "Perl built with ithreads (build perl with -Dusethreads)" + unless Apache::Build::PERL_HAS_ITHREADS(); + if (@fail) { + error "$perl_string and '$mpm' mpm httpd.", + "Failed requirements:", + join "", map {" - $_\n"} @fail; + exit 1; } } if ($] < 5.006_001) { - error "You are running Perl version 5.6.0\n" . - "We strongly suggest you upgrade to at least 5.6.1"; + error "$perl_string.", + "We strongly suggest you upgrade it to at least 5.6.1"; } if ($] >= 5.007 and $] < 5.008) { - error "5.7.x development versions of Perl are no longer supported\n" . - "Upgrade to 5.8.0 or higher"; + error "$perl_string.", + "5.7.x development versions of Perl are no longer supported", + "Upgrade to Perl 5.8.0 or higher"; exit 1; } } 1.205 +4 -0 modperl-2.0/Changes Index: Changes =================================================================== RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.204 retrieving revision 1.205 diff -u -r1.204 -r1.205 --- Changes 7 Aug 2003 03:18:36 -0000 1.204 +++ Changes 7 Aug 2003 16:29:19 -0000 1.205 @@ -12,6 +12,10 @@ =item 1.99_10-dev +new Apache::Build methods: mpm_name(), mpm_is_threaded(). use them in +the top-level Makefile.PL to require 5.8.0/ithreads if mpm requires +threads. [Stas] + add the missing XS methods to ModPerl::MethodLookup, add support for mp1 methods that are no longer in the mod_perl 2.0 API. [Stas]