lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] configure: Only link -ldl if needed


From: Paul Cercueil
Subject: [PATCH] configure: Only link -ldl if needed
Date: Fri, 20 Jan 2023 16:52:18 +0000

Check that the libdl (or libdld) exist and link to it if it does.
Otherwise, assume that the dynamic loading functions are provided
directly by the C library.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 configure.ac | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index e764808..8100162 100644
--- a/configure.ac
+++ b/configure.ac
@@ -196,11 +196,16 @@ else
 fi
 AM_CONDITIONAL(strong_type_checking, [test $STRONG_TYPE_CHECKING = yes])
 
-case "$host_os" in
-    *bsd*|osf*)                SHLIB=""        ;;
-    *hpux*)            SHLIB="-ldld"   ;;
-    *)                 SHLIB="-ldl"    ;;
-esac
+AC_CHECK_LIB(dl, dlopen, [HAVE_LIBDL="yes"])
+AC_CHECK_LIB(dld, dlopen, [HAVE_LIBDLD="yes"])
+
+if test "x$HAVE_LIBDL" = xyes; then
+    SHLIB="-ldl";
+elif test "x$HAVE_LIBDLD" = xyes; then
+    SHLIB="-ldld";
+else
+    SHLIB="";
+fi
 AC_SUBST(SHLIB)
 
 cpu=
-- 
2.39.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]