Browse code

Makefile.defs: Only add -ldl on systems that use it

kamailio uses dlopen, and on some systems, one must link with -ldl.
On others, this is not needed and there is no libdl. For now, simply
omit -ldl on NetBSD (which doesn't have or require it), and don't try
to change behavior on other systems.

(cherry picked from commit bca9768b6f2667bad8472fa99a113b8249ca0f9a)

Greg Troxel authored on 18/03/2020 23:03:08 • Daniel-Constantin Mierla committed on 19/03/2020 18:20:26
Showing 1 changed files
... ...
@@ -210,9 +210,18 @@ endif
210 210
 
211 211
 endif
212 212
 
213
+# dlopen requires -ldl on some systems, but not others.  Until there
214
+# is clarity on which require -ldl, add just enough ifeq to fix
215
+# systems known not to use it.
216
+ifeq ($(OS), netbsd)
217
+LIBDL=""
218
+else
219
+LIBDL="-ldl"
220
+endif
221
+
213 222
 ifeq ($(LIBSSL_SET_MUTEX_SHARED), 1)
214 223
 CC_PMUTEX_OPTS = -pthread -DKSR_PTHREAD_MUTEX_SHARED
215
-LD_PMUTEX_OPTS = -pthread -rdynamic -ldl -Wl,-Bsymbolic-functions
224
+LD_PMUTEX_OPTS = -pthread -rdynamic $(LIBDL) -Wl,-Bsymbolic-functions
216 225
 else
217 226
 CC_PMUTEX_OPTS =
218 227
 LD_PMUTEX_OPTS =