]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2049] AX_FIND_LIBRARY: add libdir to rpath
authorAndrei Pavel <andrei.pavel@mail.com>
Tue, 7 Sep 2021 08:37:42 +0000 (11:37 +0300)
committerAndrei Pavel <andrei@isc.org>
Tue, 14 Sep 2021 08:27:25 +0000 (11:27 +0300)
m4macros/ax_find_library.m4
m4macros/ax_isc_rpath.m4

index b2d005501322710512ccf6f5f6563e5cf01ef340..52a1bde73dc5a30c9319ef6490e03cd2e8404f89 100644 (file)
@@ -101,7 +101,10 @@ AC_DEFUN([AX_FIND_LIBRARY], [
         fi
 
         libraries_found=true
-        LIBRARY_LIBS="-L${p}/lib -Wl,-rpath=${p}/lib"
+        LIBRARY_LIBS="-L${p}/lib"
+        if test -n "${ISC_RPATH_FLAG}"; then
+          LIBRARY_LIBS="${LIBRARY_LIBS} ${ISC_RPATH_FLAG}${p}/lib"
+        fi
         for i in ${list_of_libraries}; do
           i_found=false
           for l in lib lib64; do
@@ -129,11 +132,17 @@ AC_DEFUN([AX_FIND_LIBRARY], [
     fi
   fi
 
-  # Remove leading and trailing spaces.
   if "${LIBRARY_FOUND}"; then
+    # Remove leading and trailing spaces.
     LIBRARY_CPPFLAGS="$(printf '%s' "${LIBRARY_CPPFLAGS}" | sed 's/^ *//g;s/ *$//g')"
     LIBRARY_INCLUDEDIR="$(printf '%s' "${LIBRARY_INCLUDEDIR}" | sed 's/^ *//g;s/ *$//g')"
     LIBRARY_LIBS="$(printf '%s' "${LIBRARY_LIBS}" | sed 's/^ *//g;s/ *$//g')"
+
+    # Add to the runtime search path if the flag is not already added.
+    if test -n "${ISC_RPATH_FLAG}" && test "$(printf '%s\n' "${LIBRARY_LIBS}" | grep -Fc -e "${ISC_RPATH_FLAG}")" = 0; then
+      library_location=$(printf '%s\n' "${LIBRARY_LIBS}" | grep -Eo '\-L.*\b' | sed 's/-L//g')
+      LIBRARY_LIBS="${LIBRARY_LIBS} ${ISC_RPATH_FLAG}${library_location}"
+    fi
   fi
 ])
 
index cf90e5380cd7783152d7cf678832ab411d4866bc..cae89b968e119e6ff6104913844021250e5346b9 100644 (file)
@@ -45,7 +45,7 @@ if test x$rpath != xno; then
 
             # Apple clang 5.1 is now considers unknown parameters
             # passed to linker (ld) as errors.  However, the same
-            # unknown parameters passed to compiler (g++ ) are merely
+            # unknown parameters passed to compiler (g++) are merely
             # treated as warnings. To make sure that we pick those
             # up, is to use -Werror.
             CXXFLAGS="$CXXFLAGS_SAVED -R/usr/lib"