[asterisk-commits] kpfleming: branch kpfleming/libasteriskssl r351976 - in /team/kpfleming/libas...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 20 16:29:35 CST 2012


Author: kpfleming
Date: Fri Jan 20 16:29:30 2012
New Revision: 351976

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=351976
Log:
Make the building of libasteriskssl.so optional (on by default).

Along the way, clean up trailing whitespace and some formatting issues
in configure.ac.


Modified:
    team/kpfleming/libasteriskssl/configure
    team/kpfleming/libasteriskssl/configure.ac
    team/kpfleming/libasteriskssl/include/asterisk/autoconfig.h.in
    team/kpfleming/libasteriskssl/main/Makefile
    team/kpfleming/libasteriskssl/main/libasteriskssl.c
    team/kpfleming/libasteriskssl/makeopts.in

Modified: team/kpfleming/libasteriskssl/configure.ac
URL: http://svnview.digium.com/svn/asterisk/team/kpfleming/libasteriskssl/configure.ac?view=diff&rev=351976&r1=351975&r2=351976
==============================================================================
--- team/kpfleming/libasteriskssl/configure.ac (original)
+++ team/kpfleming/libasteriskssl/configure.ac Fri Jan 20 16:29:30 2012
@@ -212,7 +212,7 @@
 )
 
 # cross-compile checks
-if test "${cross_compiling}" = "yes"; 
+if test "${cross_compiling}" = "yes";
 then
    AC_CHECK_TOOL(CC, gcc, :)
    AC_CHECK_TOOL(CXX, g++, :)
@@ -325,7 +325,7 @@
 AC_CHECK_PROGS([MD5], [md5 md5sum gmd5sum digest])
 
 if test "${MD5}" = "digest" ; then
-   MD5="${MD5} -a md5"   
+   MD5="${MD5} -a md5"
 fi
 
 ACX_PTHREAD
@@ -500,7 +500,7 @@
 # Another mandatory item (unless it's explicitly disabled)
 AC_ARG_ENABLE([xmldoc],
 	[AS_HELP_STRING([--disable-xmldoc],
-		[Explicity disable XML documentation])],
+		[Explicitly disable XML documentation])],
 	[case "${enableval}" in
 		y|ye|yes) disable_xmldoc=no ;;
 		n|no)  disable_xmldoc=yes ;;
@@ -624,7 +624,7 @@
 LDFLAGS=${old_LDFLAGS}
 rm -f conftest.dynamics
 
-AC_CHECK_HEADER([sys/poll.h], 
+AC_CHECK_HEADER([sys/poll.h],
    [HAS_POLL=1]
    AC_DEFINE([HAVE_SYS_POLL_H], 1, [Define to 1 if your system has working sys/poll.h]),
    )
@@ -639,7 +639,18 @@
 	esac])
 AC_SUBST(HAS_POLL)
 
-
+AC_ARG_ENABLE([asteriskssl],
+	[AS_HELP_STRING([--disable-asteriskssl],
+		[Disable Asterisk's SSL wrapper library])],
+	[case "${enableval}" in
+		y|ye|yes) AST_ASTERISKSSL=yes ;;
+		n|no)  AST_ASTERISKSSL=no ;;
+		*) AC_MSG_ERROR(bad value ${enableval} for --disable-asteriskssl)  ;;
+	esac], [AST_ASTERISKSSL=yes])
+AC_SUBST(AST_ASTERISKSSL)
+if test "${AST_ASTERISKSSL}" != "no" ; then
+   AC_DEFINE([AST_ASTERISKSSL], 1, [Define to 1 if the Asterisk SSL wrapper library is being built.])
+fi
 
 # https support (in main/http.c) uses funopen on BSD systems,
 # fopencookie on linux
@@ -1484,7 +1495,7 @@
 				fi
 			fi
 		fi
-	fi 
+	fi
 	if test "${IMAP_TK_DIR}" = "system"; then
 		#We will enter here if user specified "system" or if any of above checks failed
 		AC_MSG_CHECKING([for system c-client library...])
@@ -1742,7 +1753,7 @@
 			AC_DEFINE([HAVE_IMAP_TK2006], 1, [Define if your system has the UW IMAP Toolkit c-client library version 2006 or greater.])
 		fi
 	else
-		AC_MSG_RESULT(no) 
+		AC_MSG_RESULT(no)
 	fi
 	CPPFLAGS="${saved_cppflags}"
 	LIBS="${saved_libs}"
@@ -1813,7 +1824,7 @@
 AST_EXT_LIB_CHECK([OSS], [ossaudio], [oss_ioctl_mixer], [soundcard.h])
 
 PG_CONFIG=No
-if test "${USE_PGSQL}" != "no"; then	
+if test "${USE_PGSQL}" != "no"; then
    if test "x${PGSQL_DIR}" != "x"; then
       AC_PATH_TOOL([PG_CONFIG], [pg_config], No, [${PGSQL_DIR}/bin])
       if test x"${PG_CONFIG}" = xNo; then
@@ -1839,7 +1850,7 @@
          AC_MSG_NOTICE([*** including --without-postgres])
          exit 1
 	  fi
-   else 
+   else
       AC_CHECK_LIB([pq], [PQescapeStringConn], AC_DEFINE_UNQUOTED([HAVE_PGSQL], 1,
       [Define to indicate the PostgreSQL library]), [], -L${PGSQL_libdir} -lz)
 
@@ -1932,7 +1943,7 @@
 	fi
 	AST_CHECK_PWLIB()
 	AST_CHECK_PWLIB_VERSION([PWLib], [PWLIB], [ptbuildopts.h], [1], [9], [2], [P[[WT]]LIB_VERSION])
-		
+
 	if test "${HAS_PWLIB:-unset}" != "unset"; then
 		AST_CHECK_PWLIB_PLATFORM()
 
@@ -1962,7 +1973,7 @@
 		[${PWLIB_INCLUDE}], [${PWLIB_LIB}])
 fi
 
-AST_EXT_LIB_CHECK([LUA], [lua5.1], [luaL_newstate], [lua5.1/lua.h], [-lm]) 
+AST_EXT_LIB_CHECK([LUA], [lua5.1], [luaL_newstate], [lua5.1/lua.h], [-lm])
 if test "x${PBX_LUA}" = "x1" ; then
 	if test x"${LUA_DIR}" = x; then
 		LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua5.1"
@@ -1970,9 +1981,9 @@
 		LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua5.1"
 	fi
 fi
-	
+
 # Some distributions (like SuSE) remove the 5.1 suffix.
-AST_EXT_LIB_CHECK([LUA], [lua], [luaL_register], [lua.h], [-lm]) 
+AST_EXT_LIB_CHECK([LUA], [lua], [luaL_register], [lua.h], [-lm])
 
 AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
 
@@ -2138,11 +2149,11 @@
 	[#include <vpbapi.h>],
 	[int q = vpb_open(0,0);])
 	],
-	[	AC_MSG_RESULT(yes) 
-		ac_cv_lib_vpb_vpb_open="yes" 
+	[	AC_MSG_RESULT(yes)
+		ac_cv_lib_vpb_vpb_open="yes"
 	],
-	[	AC_MSG_RESULT(no) 
-		ac_cv_lib_vpb_vpb_open="no" 
+	[	AC_MSG_RESULT(no)
+		ac_cv_lib_vpb_vpb_open="no"
 	]
 	)
    LIBS="${saved_libs}"
@@ -2324,8 +2335,8 @@
 AC_MSG_NOTICE(Package configured for: )
 AC_MSG_NOTICE( OS type  : $host_os)
 AC_MSG_NOTICE( Host CPU : $host_cpu)
-AC_MSG_NOTICE( build-cpu:vendor:os: $build_cpu : $build_vendor : $build_os :) 
-AC_MSG_NOTICE( host-cpu:vendor:os: $host_cpu : $host_vendor : $host_os :) 
+AC_MSG_NOTICE( build-cpu:vendor:os: $build_cpu : $build_vendor : $build_os :)
+AC_MSG_NOTICE( host-cpu:vendor:os: $host_cpu : $host_vendor : $host_os :)
 if test "${cross_compiling}" = "yes"; then
    AC_MSG_NOTICE( Cross Compilation = YES)
 fi

Modified: team/kpfleming/libasteriskssl/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/team/kpfleming/libasteriskssl/include/asterisk/autoconfig.h.in?view=diff&rev=351976&r1=351975&r2=351976
==============================================================================
--- team/kpfleming/libasteriskssl/include/asterisk/autoconfig.h.in (original)
+++ team/kpfleming/libasteriskssl/include/asterisk/autoconfig.h.in Fri Jan 20 16:29:30 2012
@@ -6,6 +6,9 @@
 #include "asterisk/buildopts.h"
 
 
+
+/* Define to 1 if the Asterisk SSL wrapper library should be built. */
+#undef AST_ASTERISKSSL
 
 /* Define to 1 if internal poll should be used. */
 #undef AST_POLL_COMPAT

Modified: team/kpfleming/libasteriskssl/main/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/kpfleming/libasteriskssl/main/Makefile?view=diff&rev=351976&r1=351975&r2=351976
==============================================================================
--- team/kpfleming/libasteriskssl/main/Makefile (original)
+++ team/kpfleming/libasteriskssl/main/Makefile Fri Jan 20 16:29:30 2012
@@ -1,6 +1,6 @@
 #
 # Asterisk -- A telephony toolkit for Linux.
-# 
+#
 # Makefile to build main Asterisk binary
 #
 # Copyright (C) 1999-2006, Digium, Inc.
@@ -18,7 +18,10 @@
 include $(ASTTOPDIR)/Makefile.moddir_rules
 
 # Must include the extra ast_expr2.c, ast_expr2f.c, in case they need to be regenerated (because to force regeneration, we delete them)
-SRC=$(filter-out libasteriskssl.c,$(wildcard *.c)) ast_expr2.c ast_expr2f.c
+SRC:=$(wildcard *.c) ast_expr2.c ast_expr2f.c
+ifeq ($(AST_ASTERISKSSL),yes)
+SRC:=$(filter-out libasteriskssl.c,$(SRC))
+endif
 OBJSFILTER=fskmodem_int.o fskmodem_float.o cygload.o buildinfo.o
 OBJS=$(filter-out $(OBJSFILTER),$(SRC:.c=.o))
 
@@ -26,14 +29,18 @@
 # otherwise modules will not have them available if none of the static
 # objects use it.
 OBJS+=stdtime/localtime.o
+
 ifneq ($(firstword $(subst :, ,$(WEAKREF))),1)
 OBJS+=../res/res_adsi.o
 endif
 
-ASTSSL_LIBS += $(OPENSSL_LIB)
-AST_LIBS += $(BKTR_LIB)
-AST_LIBS += $(LIBXML2_LIB) 
-AST_LIBS += $(SQLITE3_LIB)
+ASTSSL_LIBS+=$(OPENSSL_LIB)
+AST_LIBS+=$(BKTR_LIB)
+AST_LIBS+=$(LIBXML2_LIB)
+AST_LIBS+=$(SQLITE3_LIB)
+ifeq ($(AST_ASTERISKSSL),no)
+AST_LIBS+=$(ASTSSL_LIBS)
+endif
 
 ifneq ($(findstring $(OSARCH), linux-gnu uclinux linux-uclibc linux-gnueabi kfreebsd-gnu linux-gnueabihf),)
   ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
@@ -78,7 +85,7 @@
 
 ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
   AST_LIBS+=-lminires -ldl
-  ASTLINK+= -shared -Wl,--out-implib,libasterisk.a
+  ASTLINK+=-shared -Wl,--out-implib,libasterisk.a
 endif
 ifeq ($(OSARCH),NetBSD)
   AST_LIBS+=-lpthread -lcrypto -lm -L/usr/pkg/lib $(EDITLINE_LIB)
@@ -141,7 +148,7 @@
 	$(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c
 	$(CC) -g -c -Iinclude -DSTANDALONE ast_expr2.c
 	$(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o -lm
-	rm ast_expr2.o ast_expr2f.o 
+	rm ast_expr2.o ast_expr2f.o
 
 db.o: _ASTCFLAGS+=$(SQLITE3_INCLUDE)
 
@@ -179,20 +186,25 @@
 
 $(OBJS): _ASTCFLAGS+=-DAST_MODULE=\"core\"
 
+ifeq ($(AST_ASTERISKSSL),yes)
+ASTSSL_LIB=libasteriskssl.so
+ASTSSL_LDLIBS=-L. -lasteriskssl
+endif
+
 ifeq ($(findstring $(OSARCH), mingw32 cygwin ),)
 # don't define -fPIC on mingw32 and cygwin, it is the default
 libasteriskssl.so: _ASTCFLAGS+=-fPIC
 endif
-libasteriskssl.so: _ASTCFLAGS+=-DAST_MODULE=\"libasteriskssl\"
+libasteriskssl.so: _ASTCFLAGS+=-DAST_MODULE=\"asteriskssl\"
 libasteriskssl.so: LIBS+=$(ASTSSL_LIBS)
 
-$(MAIN_TGT): $(OBJS) libasteriskssl.so editline/libedit.a $(AST_EMBED_LDSCRIPTS)
+$(MAIN_TGT): $(OBJS) $(ASTSSL_LIB) editline/libedit.a $(AST_EMBED_LDSCRIPTS)
 	@$(CC) -c -o buildinfo.o $(_ASTCFLAGS) buildinfo.c $(ASTCFLAGS)
 	$(ECHO_PREFIX) echo "   [LD] $(OBJS) editline/libedit.a $(AST_EMBED_LDSCRIPTS) -> $@"
 ifneq ($(findstring chan_h323,$(MENUSELECT_CHANNELS)),)
-	$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(OBJS) -L. -lasteriskssl editline/libedit.a $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(GMIMELDFLAGS)
-else
-	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $(OBJS) -L. -lasteriskssl editline/libedit.a $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS) $(GMIMELDFLAGS)
+	$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(OBJS) $(ASTSSL_LDLIBS) editline/libedit.a $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(GMIMELDFLAGS)
+else
+	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $(OBJS) $(ASTSSL_LDLIBS) editline/libedit.a $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS) $(GMIMELDFLAGS)
 endif
 
 ifeq ($(GNU_LD),1)

Modified: team/kpfleming/libasteriskssl/main/libasteriskssl.c
URL: http://svnview.digium.com/svn/asterisk/team/kpfleming/libasteriskssl/main/libasteriskssl.c?view=diff&rev=351976&r1=351975&r2=351976
==============================================================================
--- team/kpfleming/libasteriskssl/main/libasteriskssl.c (original)
+++ team/kpfleming/libasteriskssl/main/libasteriskssl.c Fri Jan 20 16:29:30 2012
@@ -139,6 +139,11 @@
 	/* we can't allow this to be called, ever */
 }
 
+/* if we are building the full Asterisk SSL wrapper library, a lot more
+ * functions from libssl need to be wrapped.
+ */
+#ifdef AST_ASTERISKSSL
+
 static int (*real_SSL_CTX_check_private_key)(const SSL_CTX *ctx);
 
 int SSL_CTX_check_private_key(const SSL_CTX *ctx)
@@ -292,6 +297,8 @@
 {
 	return real_TLSv1_client_method();
 }
+
+#endif /* AST_ASTERISKSSL */
 
 #endif /* HAVE_OPENSSL */
 
@@ -376,6 +383,7 @@
 	get_OpenSSL_function(ERR_load_BIO_strings);
 	real_ERR_load_BIO_strings();
 
+#ifdef AST_ASTERISKSSL
 	/* now retrieve the pointers to all the OpenSSL library functions used
 	 * by code in the main Asterisk binary, so that we can route them through
 	 * this library.
@@ -402,6 +410,7 @@
 	get_OpenSSL_function(SSLv23_server_method);
 	get_OpenSSL_function(SSLv3_client_method);
 	get_OpenSSL_function(TLSv1_client_method);
+#endif /* AST_ASTERISKSSL */
 
 #if 0
 	/* currently this is just another call to SSL_library_init, so we don't call it */

Modified: team/kpfleming/libasteriskssl/makeopts.in
URL: http://svnview.digium.com/svn/asterisk/team/kpfleming/libasteriskssl/makeopts.in?view=diff&rev=351976&r1=351975&r2=351976
==============================================================================
--- team/kpfleming/libasteriskssl/makeopts.in (original)
+++ team/kpfleming/libasteriskssl/makeopts.in Fri Jan 20 16:29:30 2012
@@ -97,6 +97,8 @@
 
 AST_CODE_COVERAGE=@AST_CODE_COVERAGE@
 
+AST_ASTERISKSSL=@AST_ASTERISKSSL@
+
 AST_DECLARATION_AFTER_STATEMENT=@AST_DECLARATION_AFTER_STATEMENT@
 AST_NO_STRICT_OVERFLOW=@AST_NO_STRICT_OVERFLOW@
 AST_SHADOW_WARNINGS=@AST_SHADOW_WARNINGS@




More information about the asterisk-commits mailing list