[sr-dev] git:5.5:390c668e: tls: Makefile - pkg-config for libcrypto

Daniel-Constantin Mierla miconda at gmail.com
Thu Jun 24 18:35:39 CEST 2021


Module: kamailio
Branch: 5.5
Commit: 390c668e03d3347dbf429e395f7e5de230523629
URL: https://github.com/kamailio/kamailio/commit/390c668e03d3347dbf429e395f7e5de230523629

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-06-24T18:34:38+02:00

tls: Makefile - pkg-config for libcrypto

- some distros have it separate of libssl

(cherry picked from commit 2a9e8b9d5c5556a10229813c8878a81933325a01)

---

Modified: src/modules/tls/Makefile

---

Diff:  https://github.com/kamailio/kamailio/commit/390c668e03d3347dbf429e395f7e5de230523629.diff
Patch: https://github.com/kamailio/kamailio/commit/390c668e03d3347dbf429e395f7e5de230523629.patch

---

diff --git a/src/modules/tls/Makefile b/src/modules/tls/Makefile
index 48cb886619..3b90ec8fd6 100644
--- a/src/modules/tls/Makefile
+++ b/src/modules/tls/Makefile
@@ -20,25 +20,41 @@ SSL_BUILDER=$(shell \
 	if pkg-config --exists libssl; then \
 		echo 'pkg-config libssl'; \
 	fi)
+CRYPTO_BUILDER=$(shell \
+	if pkg-config --exists libcrypto; then \
+		echo 'pkg-config libcrypto'; \
+	fi)
 endif
 
 ifneq ($(SSL_BUILDER),)
+
 ifneq ($(LIBSSL_STATIC),yes)
 	DEFS += $(shell $(SSL_BUILDER) --cflags)
 	LIBS += $(shell $(SSL_BUILDER) --libs)
-else
+
+ifneq ($(CRYPTO_BUILDER),)
+	DEFS += $(shell $(CRYPTO_BUILDER) --cflags)
+	LIBS += $(shell $(CRYPTO_BUILDER) --libs)
+endif # ifneq ($(CRYPTO_BUILDER),)
+
+else # $(LIBSSL_STATIC),yes)
+
 ifneq ($(LIBSSL_STATIC_SRCLIB),yes)
 	## when static libs (*.a) from packages are compiled with -fPIC
 	DEFS += $(shell $(SSL_BUILDER) --cflags)
 	LIBS += $(shell $(SSL_BUILDER) --libs-only-L)
+	# TODO: explore use of LIBS += -Wl,-Bstatic $(shell $(SSL_BUILDER) --libs-only-l)
 	LIBS += -l:libssl.a -l:libcrypto.a -l:libz.a -l:libdl.a
 else
 	## when linking against static libs compiled from sources
 	DEFS += -I$(LIBSSL_STATIC_SRCPATH)/include
 	LIBS += $(LIBSSL_STATIC_SRCPATH)/libssl.a $(LIBSSL_STATIC_SRCPATH)/libcrypto.a
 endif # ifneq ($(LIBSSL_STATIC_SRCLIB),yes)
+
 endif # ifneq ($(LIBSSL_STATIC),yes)
-else
+
+else # ifneq ($(SSL_BUILDER),)
+
 	DEFS += -I$(LOCALBASE)/ssl/include
 	LIBS += -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib \
 			-L$(LOCALBASE)/lib64 -L$(LOCALBASE)/ssl/lib64 \
@@ -46,7 +62,8 @@ else
 	# NOTE: depending on the way in which libssl was compiled you might
 	#       have to add -lz -lkrb5   (zlib and kerberos5).
 	#       E.g.: make TLS_HOOKS=1 TLS_EXTRA_LIBS="-lz -lkrb5"
-endif
+
+endif # ifneq ($(SSL_BUILDER),)
 
 LIBS+= $(TLS_EXTRA_LIBS)
 




More information about the sr-dev mailing list