41a6c3
--- httpd-2.4.3/support/apxs.in.apxs
41a6c3
+++ httpd-2.4.3/support/apxs.in
41a6c3
@@ -25,7 +25,18 @@ package apxs;
41a6c3
 
41a6c3
 my %config_vars = ();
41a6c3
 
41a6c3
-my $installbuilddir = "@exp_installbuilddir@";
41a6c3
+# Awful hack to make apxs libdir-agnostic:
41a6c3
+my $pkg_config = "/usr/bin/pkg-config";
41a6c3
+if (! -x "$pkg_config") {
41a6c3
+    error("$pkg_config not found!");
41a6c3
+    exit(1);
41a6c3
+}
41a6c3
+
41a6c3
+my $libdir = `pkg-config --variable=libdir apr-1`;
41a6c3
+chomp $libdir;
41a6c3
+
41a6c3
+my $installbuilddir = $libdir . "/httpd/build";
41a6c3
+
41a6c3
 get_config_vars("$installbuilddir/config_vars.mk",\%config_vars);
41a6c3
 
41a6c3
 # read the configuration variables once
41a6c3
@@ -275,7 +286,7 @@ if ($opt_g) {
41a6c3
     $data =~ s|%NAME%|$name|sg;
41a6c3
     $data =~ s|%TARGET%|$CFG_TARGET|sg;
41a6c3
     $data =~ s|%PREFIX%|$prefix|sg;
41a6c3
-    $data =~ s|%INSTALLBUILDDIR%|$installbuilddir|sg;
41a6c3
+    $data =~ s|%LIBDIR%|$libdir|sg;
41a6c3
 
41a6c3
     my ($mkf, $mods, $src) = ($data =~ m|^(.+)-=#=-\n(.+)-=#=-\n(.+)|s);
41a6c3
 
41a6c3
@@ -453,11 +464,11 @@ if ($opt_c) {
41a6c3
     my $ldflags = "$CFG_LDFLAGS";
41a6c3
     if ($opt_p == 1) {
41a6c3
         
41a6c3
-        my $apr_libs=`$apr_config --cflags --ldflags --link-libtool --libs`;
41a6c3
+        my $apr_libs=`$apr_config --cflags --ldflags --link-libtool`;
41a6c3
         chomp($apr_libs);
41a6c3
         my $apu_libs="";
41a6c3
         if ($apr_major_version < 2) {
41a6c3
-            $apu_libs=`$apu_config --ldflags --link-libtool --libs`;
41a6c3
+            $apu_libs=`$apu_config --ldflags --link-libtool`;
41a6c3
             chomp($apu_libs);
41a6c3
         }
41a6c3
         
41a6c3
@@ -672,8 +683,8 @@ __DATA__
41a6c3
 
41a6c3
 builddir=.
41a6c3
 top_srcdir=%PREFIX%
41a6c3
-top_builddir=%PREFIX%
41a6c3
-include %INSTALLBUILDDIR%/special.mk
41a6c3
+top_builddir=%LIBDIR%/httpd
41a6c3
+include %LIBDIR%/httpd/build/special.mk
41a6c3
 
41a6c3
 #   the used tools
41a6c3
 APXS=apxs