Blame SOURCES/httpd-2.4.3-apxs.patch

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