Mailing List Archive

svn commit: r1894282 - /perl/modperl/trunk/lib/Apache2/Build.pm
Author: stevehay
Date: Fri Oct 15 08:50:16 2021
New Revision: 1894282

URL: http://svn.apache.org/viewvc?rev=1894282&view=rev
Log:
Parse apr.h with a C preprocessor

mod_perl's build script parses /usr/include/apr-1/apr.h for detecting
APR_HAS_THREADS preprocessor symbol to decide whether APR library
supports threads. Then APR::ThreadMutex module is built only if APR
library was built with threads support.

But /usr/include/apr-1/apr.h on some architectures (e.g. not on aarch64)
is a wrapper for the real platform-specific header file. As a result
mod_perl was erroneously built without APR::ThreadMutex module.

This patch replaces opening that header file with executing
a C preprocessor for the header file. That restores compatibility
with the multilib-sanitized /usr/include/apr-1/apr.h header file (e.g.
on x86_64).

This patch uses safe more-than-3-list form of piped open(). This is
not supported on Windows Perl < 5.022.

https://bugzilla.redhat.com/show_bug.cgi?id=1981927
Signed-off-by: Petr Písa? <ppisar@redhat.com>

[Modified from the original patch on
https://rt.cpan.org/Public/Bug/Display.html?id=137599
by the committer to retain the old style for WIN32 since
we need to support perls older than 5.022.]

Modified:
perl/modperl/trunk/lib/Apache2/Build.pm

Modified: perl/modperl/trunk/lib/Apache2/Build.pm
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/lib/Apache2/Build.pm?rev=1894282&r1=1894281&r2=1894282&view=diff
==============================================================================
--- perl/modperl/trunk/lib/Apache2/Build.pm (original)
+++ perl/modperl/trunk/lib/Apache2/Build.pm Fri Oct 15 08:50:16 2021
@@ -1493,11 +1493,21 @@ sub get_apr_config {

return $self->{apr_config} if $self->{apr_config};

+ my $fh;
my $header = catfile $self->apr_includedir, "apr.h";
- open my $fh, $header or do {
- error "Unable to open $header: $!";
- return undef;
- };
+ if (WIN32) {
+ open $fh, $header or do {
+ error "Unable to open $header: $!";
+ return undef;
+ };
+ }
+ else {
+ my @command = ($self->perl_config('cpp'), '-dM', $header);
+ open $fh, '-|', @command or do {
+ error "Unable to preprocess $header with @command: $!";
+ return undef;
+ };
+ }

my %cfg;
while (<$fh>) {