Module: kamailio
Branch: master
Commit: 79619717aa67c219fc36dfaac8d06919b8f2018e
URL:
https://github.com/kamailio/kamailio/commit/79619717aa67c219fc36dfaac8d0691…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-09-13T12:57:38+02:00
Makefile.defs: detect if libssl version is 1.1+
- link against pthread to be able to set PTHREAD_PROCESS_SHARED attribute
for mutex and rwlock initialization
---
Modified: src/Makefile.defs
---
Diff:
https://github.com/kamailio/kamailio/commit/79619717aa67c219fc36dfaac8d0691…
Patch:
https://github.com/kamailio/kamailio/commit/79619717aa67c219fc36dfaac8d0691…
---
diff --git a/src/Makefile.defs b/src/Makefile.defs
index 69416e8003..2a8a80cb2b 100644
--- a/src/Makefile.defs
+++ b/src/Makefile.defs
@@ -178,6 +178,42 @@ CC_EXTRA_OPTS ?=
# extra LD command line options
LD_EXTRA_OPTS ?=
+
+# enable workaround for libssl 1.1+ to set shared mutex attribute
+LIBSSL_SET_MUTEX_SHARED ?=
+ifneq ($(LIBSSL_SET_MUTEX_SHARED), 1)
+
+ifeq ($(CROSS_COMPILE),)
+LIBSSL_PKGCONFIG=$(shell \
+ if pkg-config --exists libssl; then \
+ echo 'pkg-config libssl'; \
+ fi)
+endif
+
+ifneq ($(LIBSSL_PKGCONFIG),)
+
+# numerical version (good for comparisons: A.B.C => A*1000000+B*1000+C)
+LIBSSL_VERNUM:= $(shell $(LIBSSL_PKGCONFIG) --modversion | sed -e 's/^[^0-9]*//'
\
+ -e 's/^\([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*$$/\1/g' | \
+ (IFS=. read A B C D; R=0; \
+ [ -n "$$A" ] && R=`expr $$R \* 1000 + $$A` && \
+ [ -n "$$B" ] && R=`expr $$R \* 1000 + $$B` && \
+ [ -n "$$C" ] && R=`expr $$R \* 1000 + $$C`; echo $$R ) )
+
+# libssl version greater or equal than 1.1
+ifeq ($(shell [ $(LIBSSL_VERNUM) -ge 1001000 ] && echo libssl11plus),
libssl11plus)
+LIBSSL_SET_MUTEX_SHARED := 1
+endif
+
+endif
+
+endif
+
+ifeq ($(LIBSSL_SET_MUTEX_SHARED), 1)
+CC_EXTRA_OPTS+= -pthread -DKSR_PTHREAD_MUTEX_SHARED
+LD_EXTRA_OPTS+= -pthread -rdynamic -ldl -Wl,-Bsymbolic-functions
+endif
+
ifeq ($(OS), solaris)
#use GNU versions
INSTALL ?= ginstall