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