1 diff --git a/support/apxs.in b/support/apxs.in
2 index ad1287f..efcfcf6 100644
5 @@ -25,7 +25,18 @@ package apxs;
9 -my $installbuilddir = "@exp_installbuilddir@";
10 +# Awful hack to make apxs libdir-agnostic:
11 +my $pkg_config = "/usr/bin/pkg-config";
12 +if (! -x "$pkg_config") {
13 + error("$pkg_config not found!");
17 +my $libdir = `pkg-config --variable=libdir apr-1`;
20 +my $installbuilddir = $libdir . "/httpd/build";
22 get_config_vars("$installbuilddir/config_vars.mk",\%config_vars);
24 # read the configuration variables once
25 @@ -275,7 +286,7 @@ if ($opt_g) {
26 $data =~ s|%NAME%|$name|sg;
27 $data =~ s|%TARGET%|$CFG_TARGET|sg;
28 $data =~ s|%PREFIX%|$prefix|sg;
29 - $data =~ s|%INSTALLBUILDDIR%|$installbuilddir|sg;
30 + $data =~ s|%LIBDIR%|$libdir|sg;
32 my ($mkf, $mods, $src) = ($data =~ m|^(.+)-=#=-\n(.+)-=#=-\n(.+)|s);
34 @@ -453,11 +464,11 @@ if ($opt_c) {
35 my $ldflags = "$CFG_LDFLAGS";
38 - my $apr_libs=`$apr_config --cflags --ldflags --link-libtool --libs`;
39 + my $apr_libs=`$apr_config --cflags --ldflags --link-libtool`;
42 if ($apr_major_version < 2) {
43 - $apu_libs=`$apu_config --ldflags --link-libtool --libs`;
44 + $apu_libs=`$apu_config --ldflags --link-libtool`;
48 @@ -672,8 +683,8 @@ __DATA__
52 -top_builddir=%PREFIX%
53 -include %INSTALLBUILDDIR%/special.mk
54 +top_builddir=%LIBDIR%/httpd
55 +include %LIBDIR%/httpd/build/special.mk