
Libraries should be linked with -rpath $libdir but programs should not.
Doing so for the latter means that a redundant RPATH entry of $libdir
will end up in the binaries.

The redundant RPATH can also cause obscure build failures by causing
in-build binaries to pick up libraries from the system environment,
which libtool will otherwise avoid.

Index: subversion-1.6.1/build/generator/gen_base.py
===================================================================
--- subversion-1.6.1.orig/build/generator/gen_base.py
+++ subversion-1.6.1/build/generator/gen_base.py
@@ -455,6 +455,9 @@ class TargetLib(TargetLinked):
     self.msvc_fake = options.get('msvc-fake') == 'yes' # has fake target
     self.msvc_export = options.get('msvc-export', '').split()
 
+    ### hmm. this is Makefile-specific
+    self.link_cmd = '$(LINK_LIB)'
+
 class TargetApacheMod(TargetLib):
 
   def __init__(self, name, options, gen_obj):
Index: subversion-1.6.1/Makefile.in
===================================================================
--- subversion-1.6.1.orig/Makefile.in
+++ subversion-1.6.1/Makefile.in
@@ -184,6 +184,7 @@ COMPILE_JAVAHL_CXX = $(LIBTOOL) $(LTCXXF
 COMPILE_JAVAHL_JAVAC = $(JAVAC) $(JAVAC_FLAGS)
 COMPILE_JAVAHL_JAVAH = $(JAVAH)
 
+LINK_LIB = $(LINK) -rpath $(libdir)
 LINK = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LT_LDFLAGS) $(CFLAGS) $(LDFLAGS) -rpath $(libdir)
 LINK_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=link $(CXX) $(LT_LDFLAGS) $(CXXFLAGS) $(LDFLAGS) -rpath $(libdir)
 
