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