Browse code

tls: Makefile - pkg-config for libcrypto

- some distros have it separate of libssl

Daniel-Constantin Mierla authored on 24/06/2021 08:15:23
Showing 1 changed files
... ...
@@ -20,25 +20,41 @@ SSL_BUILDER=$(shell \
20 20
 	if pkg-config --exists libssl; then \
21 21
 		echo 'pkg-config libssl'; \
22 22
 	fi)
23
+CRYPTO_BUILDER=$(shell \
24
+	if pkg-config --exists libcrypto; then \
25
+		echo 'pkg-config libcrypto'; \
26
+	fi)
23 27
 endif
24 28
 
25 29
 ifneq ($(SSL_BUILDER),)
30
+
26 31
 ifneq ($(LIBSSL_STATIC),yes)
27 32
 	DEFS += $(shell $(SSL_BUILDER) --cflags)
28 33
 	LIBS += $(shell $(SSL_BUILDER) --libs)
29
-else
34
+
35
+ifneq ($(CRYPTO_BUILDER),)
36
+	DEFS += $(shell $(CRYPTO_BUILDER) --cflags)
37
+	LIBS += $(shell $(CRYPTO_BUILDER) --libs)
38
+endif # ifneq ($(CRYPTO_BUILDER),)
39
+
40
+else # $(LIBSSL_STATIC),yes)
41
+
30 42
 ifneq ($(LIBSSL_STATIC_SRCLIB),yes)
31 43
 	## when static libs (*.a) from packages are compiled with -fPIC
32 44
 	DEFS += $(shell $(SSL_BUILDER) --cflags)
33 45
 	LIBS += $(shell $(SSL_BUILDER) --libs-only-L)
46
+	# TODO: explore use of LIBS += -Wl,-Bstatic $(shell $(SSL_BUILDER) --libs-only-l)
34 47
 	LIBS += -l:libssl.a -l:libcrypto.a -l:libz.a -l:libdl.a
35 48
 else
36 49
 	## when linking against static libs compiled from sources
37 50
 	DEFS += -I$(LIBSSL_STATIC_SRCPATH)/include
38 51
 	LIBS += $(LIBSSL_STATIC_SRCPATH)/libssl.a $(LIBSSL_STATIC_SRCPATH)/libcrypto.a
39 52
 endif # ifneq ($(LIBSSL_STATIC_SRCLIB),yes)
53
+
40 54
 endif # ifneq ($(LIBSSL_STATIC),yes)
41
-else
55
+
56
+else # ifneq ($(SSL_BUILDER),)
57
+
42 58
 	DEFS += -I$(LOCALBASE)/ssl/include
43 59
 	LIBS += -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib \
44 60
 			-L$(LOCALBASE)/lib64 -L$(LOCALBASE)/ssl/lib64 \
... ...
@@ -46,7 +62,8 @@ else
46 62
 	# NOTE: depending on the way in which libssl was compiled you might
47 63
 	#       have to add -lz -lkrb5   (zlib and kerberos5).
48 64
 	#       E.g.: make TLS_HOOKS=1 TLS_EXTRA_LIBS="-lz -lkrb5"
49
-endif
65
+
66
+endif # ifneq ($(SSL_BUILDER),)
50 67
 
51 68
 LIBS+= $(TLS_EXTRA_LIBS)
52 69