dougm       2002/06/23 14:46:09

  Modified:    .        Makefile.PL
               lib/Apache Build.pm
  Log:
  parse apr.h and save some useful config values (e.g. APR_HAS_THREADS)
  
  Revision  Changes    Path
  1.86      +2 -0      modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.85
  retrieving revision 1.86
  diff -u -r1.85 -r1.86
  --- Makefile.PL       31 May 2002 00:41:08 -0000      1.85
  +++ Makefile.PL       23 Jun 2002 21:46:09 -0000      1.86
  @@ -167,6 +167,8 @@
       printf "Configuring Apache/%s mod_perl/%s Perl/v%vd\n",
         $httpd_version, $VERSION, $^V;
   
  +    my $apr_config = $build->get_apr_config; #cache it
  +
       for (@{ clean_files() }) {
           debug "unlink...$_" if -e $_ && unlink;
       }
  
  
  
  1.102     +32 -0     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.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- Build.pm  19 Jun 2002 01:32:58 -0000      1.101
  +++ Build.pm  23 Jun 2002 21:46:09 -0000      1.102
  @@ -752,6 +752,38 @@
       $self->httpd_version_cache($dir, $version);
   }
   
  +my %wanted_apr_config = map { $_, 1} qw(
  +    HAS_THREADS HAS_DSO HAS_MMAP HAS_RANDOM HAS_SENDFILE
  +    HAS_INLINE HAS_FORK
  +);
  +
  +sub get_apr_config {
  +    my $self = shift;
  +
  +    return $self->{apr_config} if $self->{apr_config};
  +
  +    my $dir = $self->ap_includedir;
  +
  +    my $header = "$dir/apr.h";
  +    open my $fh, $header or do {
  +        error "Unable to open $header: $!";
  +        return undef;
  +    };
  +
  +    my %cfg;
  +    while (<$fh>) {
  +        next unless s/^\#define\s+APR_((HAVE|HAS|USE)_\w+)/$1/;
  +        chomp;
  +        my($name, $val) = split /\s+/, $_, 2;
  +        next unless $wanted_apr_config{$name};
  +        $val =~ s/\s+$//;
  +        next unless $val =~ /^\d+$/;
  +        $cfg{$name} = $val;
  +    }
  +
  +    $self->{apr_config} = \%cfg;
  +}
  +
   #--- generate Makefile ---
   
   sub canon_make_attr {
  
  
  


Reply via email to