瀏覽代碼

tls: fix ssl cross-compilation

Ovidiu Sas 12 年之前
父節點
當前提交
c16ae05d5b
共有 1 個文件被更改,包括 14 次插入21 次删除
  1. 14 21
      modules/tls/Makefile

+ 14 - 21
modules/tls/Makefile

@@ -9,40 +9,32 @@ include ../../Makefile.defs
 auto_gen=
 auto_gen=
 NAME=tls.so
 NAME=tls.so
 
 
-CFLASFOUND = 0
-
 ifeq ($(CROSS_COMPILE),)
 ifeq ($(CROSS_COMPILE),)
-BUILDER = $(shell which pkg-config)
-endif
-
-ifneq ($(BUILDER),)
-	ifeq ($(CROSS_COMPILE),)
-	SSLLIBS = $(shell pkg-config --silence-errors --libs libssl)
-	endif
-	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
+SSL_BUILDER=$(shell \
+	if pkg-config --exists libssl; then \
+		echo 'pkg-config libssl'; \
+	fi)
 endif
 endif
 
 
-ifeq ($(CFLASFOUND),0)
-	DEFS+= -I$(LOCALBASE)/ssl/include
-	LIBS+=	-L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib \
+ifneq ($(SSL_BUILDER),)
+	DEFS += $(shell $(SSL_BUILDER) --cflags)
+	LIBS += $(shell $(SSL_BUILDER) --libs)
+else
+	DEFS += -I$(LOCALBASE)/ssl/include
+	LIBS += -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib \
 			-L$(LOCALBASE)/lib64 -L$(LOCALBASE)/ssl/lib64 \
 			-L$(LOCALBASE)/lib64 -L$(LOCALBASE)/ssl/lib64 \
-			-lssl  -lcrypto \
-			$(TLS_EXTRA_LIBS)
+			-lssl -lcrypto
 	# NOTE: depending on the way in which libssl was compiled you might
 	# NOTE: depending on the way in which libssl was compiled you might
 	#       have to add -lz -lkrb5   (zlib and kerberos5).
 	#       have to add -lz -lkrb5   (zlib and kerberos5).
 	#       E.g.: make TLS_HOOKS=1 TLS_EXTRA_LIBS="-lz -lkrb5"
 	#       E.g.: make TLS_HOOKS=1 TLS_EXTRA_LIBS="-lz -lkrb5"
 endif
 endif
 
 
+LIBS+= $(TLS_EXTRA_LIBS)
+
 # dcm: tls.cfg installed via local 'install-cfg' to update paths
 # dcm: tls.cfg installed via local 'install-cfg' to update paths
 #MOD_INSTALL_CFGS=tls.cfg
 #MOD_INSTALL_CFGS=tls.cfg
 
 
 DEFS+=-DKAMAILIO_MOD_INTERFACE
 DEFS+=-DKAMAILIO_MOD_INTERFACE
-
 include ../../Makefile.modules
 include ../../Makefile.modules
 
 
 
 
@@ -60,3 +52,4 @@ install-cfg:  install-tls-cert
 		mv -f "$(cfg_prefix)/$(cfg_dir)tls.cfg.sample" \
 		mv -f "$(cfg_prefix)/$(cfg_dir)tls.cfg.sample" \
 						"$(cfg_prefix)/$(cfg_dir)tls.cfg" ; \
 						"$(cfg_prefix)/$(cfg_dir)tls.cfg" ; \
 	fi
 	fi
+