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.
Signed-off-by: Petr Písař <>

[Modified from the original patch on
by the committer to retain the old style for WIN32 since
we need to support perls older than 5.022.]

git-svn-id: 13f79535-47bb-0310-9956-ffa450edef68
1 file changed