On an old (slow) machine I have, 'perl Makefile.PL' takes a long time. By inserting some debug statements: ======================================================== Index: lib/Apache/Build.pm =================================================================== --- lib/Apache/Build.pm (revision 123223) +++ lib/Apache/Build.pm (working copy) @@ -180,7 +180,7 @@ $val = ''; } } - + warn "Setting $query_key -> $val\n"; $self->{$query_key} = $val; }
@@ -735,7 +735,7 @@ sub build_config { my $self = shift; my $bpm_mtime = 0; - + warn "calling build_config\n"; $bpm_mtime = (stat $INC{$bpm})[9] if $INC{$bpm}; if (-e "lib/$bpm" and (stat _)[9] > $bpm_mtime) { ============================================================ there were a couple of things that arose: ========================================================== Configuring Apache/2.0.52 mod_perl/1.99_19-dev Perl/v5.8.6 Setting APXS_APR_BINDIR -> /opt/httpd/bin Setting APXS_BINDIR -> /opt/httpd/bin calling build_config calling build_config calling build_config calling build_config calling build_config Setting APXS_MPM_NAME -> prefork Setting APXS_APU_BINDIR -> /opt/httpd/bin calling build_config Setting APXS_APU_BINDIR -> /opt/httpd/bin calling build_config Setting APXS_EXTRA_CFLAGS -> -g -O2 -pthread calling build_config Setting APXS_EXTRA_CPPFLAGS -> -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE calling build_config Setting APXS_EXTRA_CPPFLAGS -> -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE [ info] generating script t/TEST [ .... ] calling build_config Setting APXS_APU_BINDIR -> /opt/httpd/bin calling build_config Setting APXS_EXTRA_CFLAGS -> -g -O2 -pthread calling build_config Setting APXS_EXTRA_CPPFLAGS -> -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE calling build_config Setting APXS_EXTRA_CPPFLAGS -> -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE calling build_config calling build_config calling build_config calling build_config calling build_config calling build_config calling build_config calling build_config calling build_config calling build_config calling build_config calling build_config calling build_config calling build_config calling build_config calling build_config calling build_config calling build_config calling build_config calling build_config Writing Makefile for ModPerl::Registry Setting APXS_APU_BINDIR -> /opt/httpd/bin calling build_config Setting APXS_EXTRA_CFLAGS -> -g -O2 -pthread calling build_config Setting APXS_EXTRA_CPPFLAGS -> -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE calling build_config Setting APXS_EXTRA_CPPFLAGS -> -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE calling build_config calling build_config calling build_config calling build_config calling build_config Setting APXS_APU_BINDIR -> /opt/httpd/bin calling build_config Setting APXS_EXTRA_CFLAGS -> -g -O2 -pthread calling build_config Setting APXS_EXTRA_CPPFLAGS -> -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE calling build_config Setting APXS_EXTRA_CPPFLAGS -> -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE [ ... ] ================================================================= One is that "build_config" is called numerous times, and the other is that various apxs queries are getting set numerous times (ie, are not being cached within the apxs sub of Apache::Build). I tried the following diff: ==================================================================== Index: lib/Apache/Build.pm =================================================================== --- lib/Apache/Build.pm (revision 123213) +++ lib/Apache/Build.pm (working copy) @@ -152,7 +152,7 @@ my $query_key; if ($is_query) { $query_key = 'APXS_' . uc $_[1]; - if ($self->{$query_key}) { + if (defined $self->{$query_key}) { return $self->{$query_key}; } } @@ -185,19 +185,28 @@ } sub apxs_cflags { - my $cflags = __PACKAGE__->apxs('-q' => 'CFLAGS'); + my $self = shift; + my $ref = ($self and ref($self) eq __PACKAGE__) ? $self : ''; + my $who = $ref ? $self : __PACKAGE__; + my $cflags = $who->apxs('-q' => 'CFLAGS'); $cflags =~ s/\"/\\\"/g; $cflags; } sub apxs_extra_cflags { - my $flags = __PACKAGE__->apxs('-q' => 'EXTRA_CFLAGS'); + my $self = shift; + my $ref = ($self and ref($self) eq __PACKAGE__) ? $self : ''; + my $who = $ref ? $self : __PACKAGE__; + my $flags = $who->apxs('-q' => 'EXTRA_CFLAGS'); $flags =~ s/\"/\\\"/g; $flags; } sub apxs_extra_cppflags { - my $flags = __PACKAGE__->apxs('-q' => 'EXTRA_CPPFLAGS'); + my $self = shift; + my $ref = ($self and ref($self) eq __PACKAGE__) ? $self : ''; + my $who = $ref ? $self : __PACKAGE__; + my $flags = $who->apxs('-q' => 'EXTRA_CPPFLAGS'); $flags =~ s/\"/\\\"/g; $flags; } Index: lib/ModPerl/BuildMM.pm =================================================================== --- lib/ModPerl/BuildMM.pm (revision 123199) +++ lib/ModPerl/BuildMM.pm (working copy) @@ -44,9 +44,11 @@ q{-e "ModPerl::MM::install([EMAIL PROTECTED],'$(VERBINST)',0,'$(UNINST)');"}."\n"; } +my $build; + sub build_config { my $key = shift; - my $build = Apache::Build->build_config; + $build ||= Apache::Build->build_config; return $build unless $key; $build->{$key}; } @@ -68,7 +70,7 @@ sub WriteMakefile { my %args = @_; - my $build = build_config(); + $build ||= build_config(); ModPerl::MM::my_import(__PACKAGE__); my $inc = $build->inc; @@ -133,7 +135,7 @@ sub ModPerl::BuildMM::MY::constants { my $self = shift; - my $build = build_config(); + $build ||= build_config(); #install everything relative to the Apache2/ subdir if ($build->{MP_INST_APACHE2}) { @@ -301,7 +303,7 @@ sub ModPerl::BuildMM::MY::post_initialize { my $self = shift; - my $build = build_config(); + $build ||= build_config(); my $pm = $self->{PM}; while (my($k, $v) = each %PM) { @@ -343,10 +345,12 @@ ''; } +my $apr_config; + sub ModPerl::BuildMM::MY::libscan { my($self, $path) = @_; - my $apr_config = build_config()->get_apr_config(); + $apr_config ||= $build->get_apr_config(); if ($path =~ m/(Thread|Global)Mutex/) { return unless $apr_config->{HAS_THREADS}; ============================================================== which seems to minimize the calls to build_config(), and also seems to use the cached apxs calls more. There's a few things going on in this diff: - within ModPerl::BuildMM, call build_config() only if $build isn't defined; - in Apache::Build, change the apxs_cflags, etc to call apxs as a method on $self, if it was invoked this way, so that the value can be stuffed into $self; - in the apxs sub of Apache::Build, return $self->{$query_key} only if it's defined. On my slow machine, this speeds up 'perl Makefile.PL' by a factor of 4. However, I'm unsure of some of these, especially within ModPerl::BuildMM of avoiding the calls to build_config(). -- best regards, randy --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]