The perl modules were linked against
the build location of libapreq2.so.
That's obviously broken, so we now
rebuild them during make install to
link against the installed location.


git-svn-id: https://svn.apache.org/repos/asf/httpd/apreq/branches/v2_10@733407 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES b/CHANGES
index 74ce480..07688cf 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,11 @@
 
 @section v2_10 Changes with libapreq2-2.10 (released Nov 11, 2008)
 
+- Perl Glue
+  Fix install-time linking issue of the .so modules.
+  Previously they would remain linked against the src
+  library path, not the install path.
+
 - C API [joes]
   Add optional interface for apreq_handle_apache2().
 
diff --git a/glue/Makefile.am b/glue/Makefile.am
index f360ac0..dee4859 100644
--- a/glue/Makefile.am
+++ b/glue/Makefile.am
@@ -15,6 +15,7 @@
 	cd perl; $(MAKE) test
 
 perl_install:
+	cd perl; INSTALL=1 @PERL@ @PERL_OPTS@ Makefile.PL -apxs @APACHE2_APXS@ @MM_OPTS@
 	cd perl; $(MAKE) install
 
 perl_clean:
diff --git a/glue/perl/Makefile.PL b/glue/perl/Makefile.PL
index 2b62bc0..555214a 100644
--- a/glue/perl/Makefile.PL
+++ b/glue/perl/Makefile.PL
@@ -127,9 +127,19 @@
 
 }
 
-my $apreq_libs = WIN32 ?
-    qq{-L$base_dir/win32/libs -llib$apreq_libname -lmod_apreq2 -L$perl_lib -llibaprext -L$apache_dir/lib -lmod_perl} :
-    qx{$base_dir/apreq2-config --link-ld --ldflags --libs};
+
+my $apreq_libs;
+
+if (WIN32) {
+ $apreq_libs = qq{-L$base_dir/win32/libs -llib$apreq_libname -lmod_apreq2 -L$perl_lib -llibaprext -L$apache_dir/lib -lmod_perl};
+} else {
+    my $apreq2_config = "$base_dir/apreq2-config";
+    my $bindir = qx{$apreq2_config --bindir};
+    chomp $bindir;
+    $apreq2_config = "$bindir/apreq2-config" if $ENV{INSTALL};
+    $apreq_libs = qx{$apreq2_config --link-ld --ldflags --libs};
+    chomp $apreq_libs;
+}
 
 my $mp2_typemaps = Apache2::Build->new->typemaps;