Module: sip-router
Branch: master
Commit: 62b824b10b6ff9a18e336ff20c55d2d6ea6cba3c
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=62b824b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Sat Dec 17 21:32:22 2011 +0100
tls: use pkg-config to get cflags and libs for compilation
---
modules/tls/Makefile | 30 ++++++++++++++++++++++--------
1 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/modules/tls/Makefile b/modules/tls/Makefile
index 6e00b70..c6f9fe7 100644
--- a/modules/tls/Makefile
+++ b/modules/tls/Makefile
@@ -9,14 +9,28 @@ include ../../Makefile.defs
auto_gen=
NAME=tls.so
-DEFS+= -I$(LOCALBASE)/ssl/include
-LIBS+= -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib \
- -L$(LOCALBASE)/lib64 -L$(LOCALBASE)/ssl/lib64 \
- -lssl -lcrypto \
- $(TLS_EXTRA_LIBS)
-# 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"
+CFLASFOUND = 0
+BUILDER = $(shell which pkg-config)
+ifneq ($(BUILDER),)
+ SSLLIBS = $(shell pkg-config --silence-errors --libs libssl)
+ ifneq ($(SSLLIBS),)
+ DEFS+= $(shell pkg-config --silence-errors --cflags libssl)
+ LIBS+= $(shell pkg-config --silence-errors --libs libssl)
+ LIBS+= $(TLS_EXTRA_LIBS)
+ CFLASFOUND = 1
+ endif
+endif
+
+ifeq ($(CFLASFOUND),0)
+ DEFS+= -I$(LOCALBASE)/ssl/include
+ LIBS+= -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib \
+ -L$(LOCALBASE)/lib64 -L$(LOCALBASE)/ssl/lib64 \
+ -lssl -lcrypto \
+ $(TLS_EXTRA_LIBS)
+ # 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
# dcm: tls.cfg installed via local 'install-cfg' to update paths
#MOD_INSTALL_CFGS=tls.cfg