about summary refs log tree commit diff
path: root/Makeconfig
diff options
context:
space:
mode:
Diffstat (limited to 'Makeconfig')
-rw-r--r--Makeconfig9
1 files changed, 8 insertions, 1 deletions
diff --git a/Makeconfig b/Makeconfig
index e716776cb9..a610d057f5 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -291,8 +291,15 @@ endif
 endif
 ifndef link-libc
 ifeq (yes,$(build-shared))
-link-libc = -Wl,-rpath-link=$(common-objdir) -Wl,-rpath=$(libdir) \
+link-libc = -Wl,-rpath-link=$(common-objdir) -Wl,-rpath=$(default-rpath) \
 	    $(common-objpfx)libc.so $(gnulib)
+# Choose the default search path for the dynamic linker based on
+# where we will install libraries.
+ifneq ($(libdir),$(slibdir))
+default-rpath = $(slibdir):$(libdir)
+else
+default-rpath = $(libdir)
+endif
 else
 link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a
 endif