You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Andres Salomon <di...@voxel.net> on 2003/04/14 03:38:41 UTC

modperl2 build should use apr-config

mod-perl2-1.99.08 has some issues building when apr headers are in a
different location than apache2 headers.  At least in debian's apache2/apr
installation, apache2 headers are in /usr/include/apache2, while apr's
headers are in /usr/include/apr-0.  mod-perl2 looks for apr.h, but it
queries apache2's apxs about the location of apr.h; instead, mod-perl2
should be running `apr-config --includedir` to get the directory that
apr.h is located in.  Note that --includedir was introduced w/ the
apache-2.0.45 release.  The patch below (against 1.99.08) uses apr-config
when looking for apr.h.  Due to time constraints, it's not extensively
tested, but at the very least, it should give a general idea..


diff -urN a/lib/Apache/Build.pm b/lib/Apache/Build.pm
--- a/lib/Apache/Build.pm	2003-01-10 23:16:12.000000000 -0500
+++ b/lib/Apache/Build.pm	2003-04-12 05:43:26.000000000 -0400
@@ -644,6 +644,34 @@
     $self->{ap_includedir} = $d;
 }
 
+sub apr_includedir {
+    my ($self, $dir) = @_;
+
+    return $self->{apr_includedir}
+      if $self->{apr_includedir} and -d $self->{apr_includedir};
+
+    my $apr_conf;
+    if ($ENV{MP_APR_CONFIG} and -x $ENV{MP_APR_CONFIG}) {
+        $apr_conf = $ENV{MP_APR_CONFIG};
+    }
+    elsif (-d $self->{MP_AP_PREFIX} and -x $self->{MP_AP_PREFIX}."/bin/apr-config") {
+    	$apr_conf = $self->{MP_AP_PREFIX} . "/bin/apr-config";
+    }
+    else {
+    	chomp($apr_conf = `which apr-config`);
+    }
+
+    chomp(my $incdir = `$apr_conf --includedir`);
+    if (-e "$incdir/apr.h") {
+    	$self->{apr_includedir} = $incdir;
+    }
+    else {
+        $self->{apr_includedir} = "$incdir/include";
+    }
+
+    $self->{apr_includedir};
+}
+
 #--- parsing apache *.h files ---
 
 sub mmn_eq {
@@ -776,7 +804,7 @@
 
     return $self->{apr_config} if $self->{apr_config};
 
-    my $dir = $self->ap_includedir;
+    my $dir = $self->apr_includedir;
 
     my $header;
     for my $d ($dir, "$dir/../srclib/apr/include") {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: modperl2 build should use apr-config

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> Andres Salomon wrote:
> 
>> mod-perl2-1.99.08 has some issues building when apr headers are in a
>> different location than apache2 headers.  At least in debian's 
>> apache2/apr
>> installation, apache2 headers are in /usr/include/apache2, while apr's
>> headers are in /usr/include/apr-0.  mod-perl2 looks for apr.h, but it
>> queries apache2's apxs about the location of apr.h; instead, mod-perl2
>> should be running `apr-config --includedir` to get the directory that
>> apr.h is located in.  Note that --includedir was introduced w/ the
>> apache-2.0.45 release.  The patch below (against 1.99.08) uses apr-config
>> when looking for apr.h.  Due to time constraints, it's not extensively
>> tested, but at the very least, it should give a general idea..
> 
> 
> Thanks Andres, what you say is correct.
> 
> It looks like pre-2.0.45 (we should really talk about apr version 
> numbers, so pre-apr-0.9.3) apr-config --includes could be attempted to 
> be parsed for retrieving this information.
> 
> So we can try:
> 
> 1) apr-config --includedir
> and test whether we can find apr.h there,
> 
> 2) if fails go through 'apr-config --includes'
> s/-I// and test if can find apr.h there.
> 
> 3) try httpd/include/apr.h

I've implemented this extended logic and committed it. Please verify that it 
works for you. Thank you for the patch.

Please notice that I've replaced the env var MP_APR_CONFIG with Makefile.PL 
option MP_APR_CONFIG, so if you want to set it explicitly, do:

   perl Makefile.PL MP_APR_CONFIG=/path/to/apr-config

I'll update the docs shortly.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: modperl2 build should use apr-config

Posted by Stas Bekman <st...@stason.org>.
Andres Salomon wrote:
> mod-perl2-1.99.08 has some issues building when apr headers are in a
> different location than apache2 headers.  At least in debian's apache2/apr
> installation, apache2 headers are in /usr/include/apache2, while apr's
> headers are in /usr/include/apr-0.  mod-perl2 looks for apr.h, but it
> queries apache2's apxs about the location of apr.h; instead, mod-perl2
> should be running `apr-config --includedir` to get the directory that
> apr.h is located in.  Note that --includedir was introduced w/ the
> apache-2.0.45 release.  The patch below (against 1.99.08) uses apr-config
> when looking for apr.h.  Due to time constraints, it's not extensively
> tested, but at the very least, it should give a general idea..

Thanks Andres, what you say is correct.

It looks like pre-2.0.45 (we should really talk about apr version numbers, so 
pre-apr-0.9.3) apr-config --includes could be attempted to be parsed for 
retrieving this information.

So we can try:

1) apr-config --includedir
and test whether we can find apr.h there,

2) if fails go through 'apr-config --includes'
s/-I// and test if can find apr.h there.

3) try httpd/include/apr.h

> diff -urN a/lib/Apache/Build.pm b/lib/Apache/Build.pm
> --- a/lib/Apache/Build.pm	2003-01-10 23:16:12.000000000 -0500
> +++ b/lib/Apache/Build.pm	2003-04-12 05:43:26.000000000 -0400
> @@ -644,6 +644,34 @@
>      $self->{ap_includedir} = $d;
>  }
>  
> +sub apr_includedir {
> +    my ($self, $dir) = @_;
> +
> +    return $self->{apr_includedir}
> +      if $self->{apr_includedir} and -d $self->{apr_includedir};
> +
> +    my $apr_conf;
> +    if ($ENV{MP_APR_CONFIG} and -x $ENV{MP_APR_CONFIG}) {
> +        $apr_conf = $ENV{MP_APR_CONFIG};
> +    }
> +    elsif (-d $self->{MP_AP_PREFIX} and -x $self->{MP_AP_PREFIX}."/bin/apr-config") {
> +    	$apr_conf = $self->{MP_AP_PREFIX} . "/bin/apr-config";
> +    }
> +    else {
> +    	chomp($apr_conf = `which apr-config`);
> +    }
> +
> +    chomp(my $incdir = `$apr_conf --includedir`);
> +    if (-e "$incdir/apr.h") {
> +    	$self->{apr_includedir} = $incdir;
> +    }
> +    else {
> +        $self->{apr_includedir} = "$incdir/include";
> +    }
> +
> +    $self->{apr_includedir};
> +}
> +
>  #--- parsing apache *.h files ---
>  
>  sub mmn_eq {
> @@ -776,7 +804,7 @@
>  
>      return $self->{apr_config} if $self->{apr_config};
>  
> -    my $dir = $self->ap_includedir;
> +    my $dir = $self->apr_includedir;
>  
>      my $header;
>      for my $d ($dir, "$dir/../srclib/apr/include") {
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
> For additional commands, e-mail: dev-help@perl.apache.org


-- 


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org