[asterisk-commits] kpfleming: trunk r353317 - in /trunk: ./ addons/ build_tools/ include/ includ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 30 15:21:20 CST 2012


Author: kpfleming
Date: Mon Jan 30 15:21:16 2012
New Revision: 353317

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=353317
Log:
Address OpenSSL initialization issues when using third-party libraries.

When Asterisk is used with various third-party libraries (CURL, PostgresSQL,
many others) that have the ability themselves to use OpenSSL, it is possible
for conflicts to arise in how the OpenSSL libraries are initialized and
shutdown. This patch addresses these conflicts by 'wrapping' the important
functions from the OpenSSL libraries in a new shared library that is part
of Asterisk itself, and is loaded in such a way as to ensure that *all*
calls to these functions will be dispatched through the Asterisk wrapper
functions, not the native functions.

This new library is optional, but enabled by default. See the CHANGES file
for documentation on how to disable it.

Along the way, this patch also makes a few other minor changes:

* Changes MODULES_DIR to ASTMODDIR throughout the build system, in order to
  more closely match what is used during run-time configuration.

* Corrects some errors in the configure script where AC_CHECK_TOOLS was used
  instead of AC_PATH_PROG.

* Adds a new variable for linker flags in the build system (DYLINK), used for
  producing true shared libraries (as opposed to the dynamically loadable
  modules that the build system produces for 'regular' Asterisk modules).

* Moves the Makefile bits that handle installation and uninstallation of the
  main Asterisk binary into main/Makefile from the top-level Makefile.

* Moves a couple of useful preprocessor macros from optional_api.h to
  asterisk.h.

Review: https://reviewboard.asterisk.org/r/1006/

Added:
    trunk/main/libasteriskssl.c
      - copied unchanged from r353316, team/kpfleming/libasteriskssl/main/libasteriskssl.c
    trunk/main/libasteriskssl.exports.in
      - copied unchanged from r353316, team/kpfleming/libasteriskssl/main/libasteriskssl.exports.in
Removed:
    trunk/main/ssl.c
Modified:
    trunk/   (props changed)
    trunk/CHANGES
    trunk/Makefile
    trunk/Makefile.moddir_rules
    trunk/addons/   (props changed)
    trunk/build_tools/make_defaults_h
    trunk/build_tools/mkpkgconfig
    trunk/configure
    trunk/configure.ac
    trunk/include/asterisk.h
    trunk/include/asterisk/optional_api.h
    trunk/main/   (props changed)
    trunk/main/Makefile
    trunk/makeopts.in

Propchange: trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Jan 30 15:21:16 2012
@@ -1,26 +1,20 @@
-asterisk
-defaults.h
-ast_expr2.output
-.version
+.applied
+.cleancount
 .depend
-.applied
-mpg123-0.59r
-mpg123-0.59r.tar.gz
-update.out
 .lastclean
-.cleancount
 .tags-depend
 .tags-sources
+.version
+TAGS
+aclocal.m4
+autom4te.cache
+config.cache
+config.log
+config.status
+defaults.h
+makeopts
+makeopts.embed_rules
+menuselect-tree
+menuselect.makedeps
+menuselect.makeopts
 tags
-TAGS
-testexpr2
-makeopts
-menuselect.makeopts
-menuselect.makedeps
-config.status
-config.log
-menuselect-tree
-autom4te.cache
-makeopts.embed_rules
-aclocal.m4
-update.log

Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=353317&r1=353316&r2=353317
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Mon Jan 30 15:21:16 2012
@@ -16,6 +16,13 @@
 ----
  * The expression parser now recognizes the ABS() absolute value function,
    which will convert negative floating point values to positive values.
+ * The Asterisk build system will now build and install a shared library
+   (libasteriskssl.so) used to wrap various initialization and shutdown functions
+   from the libssl and libcrypto libraries provided by OpenSSL. This is done so
+   that Asterisk can ensure that these functions do *not* get called by any
+   modules that are loaded into Asterisk, since they should only be called once
+   in any single process. If desired, this feature can be disabled by supplying
+   the "--disable-asteriskssl" option to the configure script.
 
 CLI Changes
 -------------------
@@ -89,7 +96,7 @@
 ------------
  * New per parking lot options: comebackcontext and comebackdialtime. See
    configs/features.conf.sample for more details.
- 
+
  * Channel variable PARKER is now set when comebacktoorigin is disabled in
    a parking lot.
 

Modified: trunk/Makefile
URL: http://svnview.digium.com/svn/asterisk/trunk/Makefile?view=diff&rev=353317&r1=353316&r2=353317
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Mon Jan 30 15:21:16 2012
@@ -1,6 +1,6 @@
 #
 # Asterisk -- A telephony toolkit for Linux.
-# 
+#
 # Top level Makefile
 #
 # Copyright (C) 1999-2010, Digium, Inc.
@@ -19,8 +19,10 @@
 # _ASTLDFLAGS - linker flags (not libraries) provided by the build system
 # LIBS - additional libraries, at top-level for all links,
 #      on a single object just for that object
-# SOLINK - linker flags used only for creating shared objects (.so files),
-#      used for all .so links
+# SOLINK - linker flags used only for creating dynamically loadable modules
+#          as .so files
+# DYLINK - linker flags used only for creating shared libaries
+#          (.so files on Unix-type platforms, .dylib on Darwin)
 #
 # Values for ASTCFLAGS and ASTLDFLAGS can be specified in the
 # environment when running make, as follows:
@@ -49,13 +51,13 @@
 export INSTALL_PATH	# Additional prefix for the following paths
 export ASTETCDIR		# Path for config files
 export ASTVARRUNDIR
-export MODULES_DIR
 export ASTSPOOLDIR
 export ASTVARLIBDIR
 export ASTDATADIR
 export ASTDBDIR
 export ASTLOGDIR
 export ASTLIBDIR
+export ASTMODDIR
 export ASTMANDIR
 export ASTHEADERDIR
 export ASTSBINDIR
@@ -71,7 +73,9 @@
 export AST_DEVMODE		# Set to "yes" for additional compiler
                                 # and runtime checks
 
-export SOLINK			# linker flags for shared objects
+export _SOLINK			# linker flags for all shared objects
+export SOLINK			# linker flags for loadable modules
+export DYLINK			# linker flags for shared libraries
 export STATIC_BUILD		# Additional cflags, set to -static
                                 # for static builds. Probably
                                 # should go directly to ASTLDFLAGS
@@ -90,6 +94,8 @@
 export GREP
 export MD5
 export WGET_EXTRA_ARGS
+export LDCONFIG
+export LDCONFIG_FLAGS
 
 # even though we could use '-include makeopts' here, use a wildcard
 # lookup anyway, so that make won't try to build makeopts if it doesn't
@@ -129,7 +135,6 @@
 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
 # when starting Asterisk
 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
-MODULES_DIR=$(ASTLIBDIR)/modules
 AGI_DIR=$(ASTDATADIR)/agi-bin
 
 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
@@ -150,7 +155,7 @@
 
 # If the file .asterisk.makeopts is present in your home directory, you can
 # include all of your favorite menuselect options so that every time you download
-# a new version of Asterisk, you don't have to run menuselect to set them. 
+# a new version of Asterisk, you don't have to run menuselect to set them.
 # The file /etc/asterisk.makeopts will also be included but can be overridden
 # by the file in your home directory.
 
@@ -190,10 +195,12 @@
       ifeq ($(SUB_PROC),xscale)
         OPTIONS+=-fsigned-char -mcpu=xscale
       else
-        OPTIONS+=-fsigned-char 
+        OPTIONS+=-fsigned-char
       endif
     endif
   endif
+  # flag to tell 'ldconfig' to only process specified directories
+  LDCONFIG_FLAGS=-n
 endif
 
 ifeq ($(findstring -save-temps,$(_ASTCFLAGS) $(ASTCFLAGS)),)
@@ -214,7 +221,7 @@
   _ASTCFLAGS+=-Wunused
   _ASTCFLAGS+=$(AST_DECLARATION_AFTER_STATEMENT)
   _ASTCFLAGS+=$(AST_FORTIFY_SOURCE)
-  _ASTCFLAGS+=-Wundef 
+  _ASTCFLAGS+=-Wundef
   _ASTCFLAGS+=-Wmissing-format-attribute
   _ASTCFLAGS+=-Wformat=2
   ADDL_TARGETS+=validate-docs
@@ -247,6 +254,8 @@
   # -V is understood by BSD Make, not by GNU make.
   BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
   _ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
+  # flag to tell 'ldconfig' to only process specified directories
+  LDCONFIG_FLAGS=-m
 endif
 
 ifeq ($(OSARCH),NetBSD)
@@ -287,14 +296,17 @@
 
 ifneq ($(findstring darwin,$(OSARCH)),)
   _ASTCFLAGS+=-D__Darwin__
-  SOLINK=-bundle -Xlinker -macosx_version_min -Xlinker 10.4 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace
+  _SOLINK=-Xlinker -macosx_version_min -Xlinker 10.4 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace
   ifeq ($(shell if test `/usr/bin/sw_vers -productVersion | cut -c4` -gt 5; then echo 6; else echo 0; fi),6)
-    SOLINK+=/usr/lib/bundle1.o
+    _SOLINK+=/usr/lib/bundle1.o
   endif
+  SOLINK=-bundle $(_SOLINK)
+  DYLINK=-Xlinker -dylib $(_SOLINK)
   _ASTLDFLAGS+=-L/usr/local/lib
 else
 # These are used for all but Darwin
   SOLINK=-shared
+  DYLINK=$(SOLINK)
   ifneq ($(findstring BSD,$(OSARCH)),)
     _ASTLDFLAGS+=-L/usr/local/lib
   endif
@@ -302,10 +314,12 @@
 
 ifeq ($(OSARCH),SunOS)
   SOLINK=-shared -fpic -L/usr/local/ssl/lib -lrt
+  DYLINK=$(SOLINK)
 endif
 
 ifeq ($(OSARCH),OpenBSD)
   SOLINK=-shared -fpic
+  DYLINK=$(SOLINK)
 endif
 
 # comment to print directories during submakes
@@ -339,12 +353,12 @@
 endif
 
 all: _cleantest_all
-	@echo " +--------- Asterisk Build Complete ---------+"  
-	@echo " + Asterisk has successfully been built, and +"  
+	@echo " +--------- Asterisk Build Complete ---------+"
+	@echo " + Asterisk has successfully been built, and +"
 	@echo " + can be installed by running:              +"
 	@echo " +                                           +"
-	@echo " +               $(mK) install               +"  
-	@echo " +-------------------------------------------+"  
+	@echo " +               $(mK) install               +"
+	@echo " +-------------------------------------------+"
 
 # For parallel builds, we must call cleantest *before* running the
 # other dependencies on _all.
@@ -355,7 +369,7 @@
 
 makeopts: configure
 	@echo "****"
-	@echo "**** The configure script must be executed before running '$(MAKE)'." 
+	@echo "**** The configure script must be executed before running '$(MAKE)'."
 	@echo "****               Please run \"./configure\"."
 	@echo "****"
 	@exit 1
@@ -509,7 +523,7 @@
   endif
 endif
 
-update: 
+update:
 	@if [ -d .svn ]; then \
 		echo "Updating from Subversion..." ; \
 		fromrev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
@@ -530,7 +544,8 @@
 OLDHEADERS=$(filter-out $(NEWHEADERS) $(notdir $(DESTDIR)$(ASTHEADERDIR)),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
 
 installdirs:
-	$(INSTALL) -d "$(DESTDIR)$(MODULES_DIR)"
+	$(INSTALL) -d "$(DESTDIR)$(ASTLIBDIR)"
+	$(INSTALL) -d "$(DESTDIR)$(ASTMODDIR)"
 	$(INSTALL) -d "$(DESTDIR)$(ASTSBINDIR)"
 	$(INSTALL) -d "$(DESTDIR)$(ASTETCDIR)"
 	$(INSTALL) -d "$(DESTDIR)$(ASTVARRUNDIR)"
@@ -562,9 +577,10 @@
 	$(INSTALL) -d "$(DESTDIR)$(AGI_DIR)"
 	$(INSTALL) -d "$(DESTDIR)$(ASTDBDIR)"
 
-bininstall: _cleantest_all installdirs $(SUBDIRS_INSTALL)
-	$(INSTALL) -m 755 main/asterisk "$(DESTDIR)$(ASTSBINDIR)/"
-	$(LN) -sf asterisk "$(DESTDIR)$(ASTSBINDIR)/rasterisk"
+main-bininstall:
+	+ at DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" ASTLIBDIR="$(ASTLIBDIR)" $(SUBMAKE) -C main bininstall
+
+bininstall: _cleantest_all installdirs $(SUBDIRS_INSTALL) main-bininstall
 	$(INSTALL) -m 755 contrib/scripts/astgenkey "$(DESTDIR)$(ASTSBINDIR)/"
 	$(INSTALL) -m 755 contrib/scripts/autosupport "$(DESTDIR)$(ASTSBINDIR)/"
 	if [ ! -f "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk" -a ! -f /sbin/launchd ]; then \
@@ -590,17 +606,17 @@
 	fi
 
 $(SUBDIRS_INSTALL):
-	+ at DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(SUBMAKE) -C $(@:-install=) install 
+	+ at DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(SUBMAKE) -C $(@:-install=) install
 
 NEWMODS:=$(foreach d,$(MOD_SUBDIRS),$(notdir $(wildcard $(d)/*.so)))
-OLDMODS=$(filter-out $(NEWMODS) $(notdir $(DESTDIR)$(MODULES_DIR)),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
+OLDMODS=$(filter-out $(NEWMODS) $(notdir $(DESTDIR)$(ASTMODDIR)),$(notdir $(wildcard $(DESTDIR)$(ASTMODDIR)/*.so)))
 
 oldmodcheck:
 	@if [ -n "$(OLDMODS)" ]; then \
 		echo " WARNING WARNING WARNING" ;\
 		echo "" ;\
 		echo " Your Asterisk modules directory, located at" ;\
-		echo " $(DESTDIR)$(MODULES_DIR)" ;\
+		echo " $(DESTDIR)$(ASTMODDIR)" ;\
 		echo " contains modules that were not installed by this " ;\
 		echo " version of Asterisk. Please ensure that these" ;\
 		echo " modules are compatible with this version before" ;\
@@ -624,14 +640,14 @@
 	@if [ -x /usr/sbin/asterisk-post-install ]; then \
 		/usr/sbin/asterisk-post-install "$(DESTDIR)" . ; \
 	fi
-	@echo " +---- Asterisk Installation Complete -------+"  
+	@echo " +---- Asterisk Installation Complete -------+"
 	@echo " +                                           +"
 	@echo " +    YOU MUST READ THE SECURITY DOCUMENT    +"
 	@echo " +                                           +"
-	@echo " + Asterisk has successfully been installed. +"  
-	@echo " + If you would like to install the sample   +"  
+	@echo " + Asterisk has successfully been installed. +"
+	@echo " + If you would like to install the sample   +"
 	@echo " + configuration files (overwriting any      +"
-	@echo " + existing config files), run:              +"  
+	@echo " + existing config files), run:              +"
 	@echo " +                                           +"
 	@echo " +               $(mK) samples               +"
 	@echo " +                                           +"
@@ -687,7 +703,7 @@
 	if [ "$(OVERWRITE)" = "y" ]; then \
 		echo "Updating asterisk.conf" ; \
 		sed -e 's|^astetcdir.*$$|astetcdir => $(ASTETCDIR)|' \
-			-e 's|^astmoddir.*$$|astmoddir => $(MODULES_DIR)|' \
+			-e 's|^astmoddir.*$$|astmoddir => $(ASTMODDIR)|' \
 			-e 's|^astvarlibdir.*$$|astvarlibdir => $(ASTVARLIBDIR)|' \
 			-e 's|^astdbdir.*$$|astdbdir => $(ASTDBDIR)|' \
 			-e 's|^astkeydir.*$$|astkeydir => $(ASTKEYDIR)|' \
@@ -729,7 +745,7 @@
 	for x in images/*.gif; do \
 		$(INSTALL) -m 644 $$x "$(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/"; \
 	done
-	@echo " +--------- Asterisk Web Voicemail ----------+"  
+	@echo " +--------- Asterisk Web Voicemail ----------+"
 	@echo " +                                           +"
 	@echo " + Asterisk Web Voicemail is installed in    +"
 	@echo " + your cgi-bin directory:                   +"
@@ -745,11 +761,11 @@
 	@echo " + in your Makefile of HTTP_CGIDIR and       +"
 	@echo " + HTTP_DOCSDIR                              +"
 	@echo " +                                           +"
-	@echo " +-------------------------------------------+"  
+	@echo " +-------------------------------------------+"
 
 progdocs:
 	(cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
-	echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen - 
+	echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
 
 install-logrotate:
 	if [ ! -d "$(DESTDIR)$(ASTETCDIR)/../logrotate.d" ]; then \
@@ -836,7 +852,7 @@
 	$(MAKE) -C sounds all
 
 # If the cleancount has been changed, force a make clean.
-# .cleancount is the global clean count, and .lastclean is the 
+# .cleancount is the global clean count, and .lastclean is the
 # last clean count we had
 
 cleantest:
@@ -846,9 +862,11 @@
 $(SUBDIRS_UNINSTALL):
 	+@$(SUBMAKE) -C $(@:-uninstall=) uninstall
 
-_uninstall: $(SUBDIRS_UNINSTALL)
-	rm -f "$(DESTDIR)$(MODULES_DIR)/"*
-	rm -f "$(DESTDIR)$(ASTSBINDIR)/"*asterisk*
+main-binuninstall:
+	+ at DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" ASTLIBDIR="$(ASTLIBDIR)" $(SUBMAKE) -C main binuninstall
+
+_uninstall: $(SUBDIRS_UNINSTALL) main-binuninstall
+	rm -f "$(DESTDIR)$(ASTMODDIR)/"*
 	rm -f "$(DESTDIR)$(ASTSBINDIR)/astgenkey"
 	rm -f "$(DESTDIR)$(ASTSBINDIR)/autosupport"
 	rm -rf "$(DESTDIR)$(ASTHEADERDIR)"
@@ -860,18 +878,18 @@
 	$(MAKE) -C sounds uninstall
 
 uninstall: _uninstall
-	@echo " +--------- Asterisk Uninstall Complete -----+"  
-	@echo " + Asterisk binaries, sounds, man pages,     +"  
-	@echo " + headers, modules, and firmware builds,    +"  
-	@echo " + have all been uninstalled.                +"  
+	@echo " +--------- Asterisk Uninstall Complete -----+"
+	@echo " + Asterisk binaries, sounds, man pages,     +"
+	@echo " + headers, modules, and firmware builds,    +"
+	@echo " + have all been uninstalled.                +"
 	@echo " +                                           +"
 	@echo " + To remove ALL traces of Asterisk,         +"
 	@echo " + including configuration, spool            +"
 	@echo " + directories, and logs, run the following  +"
 	@echo " + command:                                  +"
 	@echo " +                                           +"
-	@echo " +            $(mK) uninstall-all            +"  
-	@echo " +-------------------------------------------+"  
+	@echo " +            $(mK) uninstall-all            +"
+	@echo " +-------------------------------------------+"
 
 uninstall-all: _uninstall
 	rm -rf "$(DESTDIR)$(ASTLIBDIR)"

Modified: trunk/Makefile.moddir_rules
URL: http://svnview.digium.com/svn/asterisk/trunk/Makefile.moddir_rules?view=diff&rev=353317&r1=353316&r2=353317
==============================================================================
--- trunk/Makefile.moddir_rules (original)
+++ trunk/Makefile.moddir_rules Mon Jan 30 15:21:16 2012
@@ -122,7 +122,7 @@
 
 install:: all
 	@echo "Installing modules from `basename $(CURDIR)`..."
-	@for x in $(LOADABLE_MODS:%=%.so); do $(INSTALL) -m 755 $$x "$(DESTDIR)$(MODULES_DIR)" ; done
+	@for x in $(LOADABLE_MODS:%=%.so); do $(INSTALL) -m 755 $$x "$(DESTDIR)$(ASTMODDIR)" ; done
 
 uninstall::
 

Propchange: trunk/addons/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Jan 30 15:21:16 2012
@@ -9,4 +9,4 @@
 *.so
 *.exports
 modules.link
-
+mp3

Modified: trunk/build_tools/make_defaults_h
URL: http://svnview.digium.com/svn/asterisk/trunk/build_tools/make_defaults_h?view=diff&rev=353317&r1=353316&r2=353317
==============================================================================
--- trunk/build_tools/make_defaults_h (original)
+++ trunk/build_tools/make_defaults_h Mon Jan 30 15:21:16 2012
@@ -8,7 +8,7 @@
 #define DEFAULT_CONFIG_FILE "${INSTALL_PATH}${ASTCONFPATH}"
 
 #define DEFAULT_CONFIG_DIR "${INSTALL_PATH}${ASTETCDIR}"
-#define DEFAULT_MODULE_DIR "${INSTALL_PATH}${MODULES_DIR}"
+#define DEFAULT_MODULE_DIR "${INSTALL_PATH}${ASTMODDIR}"
 #define DEFAULT_AGI_DIR    "${INSTALL_PATH}${AGI_DIR}"
 #define DEFAULT_LOG_DIR    "${INSTALL_PATH}${ASTLOGDIR}"
 

Modified: trunk/build_tools/mkpkgconfig
URL: http://svnview.digium.com/svn/asterisk/trunk/build_tools/mkpkgconfig?view=diff&rev=353317&r1=353316&r2=353317
==============================================================================
--- trunk/build_tools/mkpkgconfig (original)
+++ trunk/build_tools/mkpkgconfig Mon Jan 30 15:21:16 2012
@@ -39,7 +39,7 @@
 spooldir=$ASTSPOOLDIR
 logdir=$ASTLOGDIR
 confpath=$ASTCONFPATH
-moddir=$MODULES_DIR
+moddir=$ASTMODDIR
 agidir=$AGI_DIR
 
 Name: asterisk

Modified: trunk/configure.ac
URL: http://svnview.digium.com/svn/asterisk/trunk/configure.ac?view=diff&rev=353317&r1=353316&r2=353317
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Mon Jan 30 15:21:16 2012
@@ -47,7 +47,8 @@
 AC_SUBST([astsbindir],        ['${sbindir}'])dnl
 AC_SUBST([astetcdir],         ['${sysconfdir}/asterisk'])dnl
 AC_SUBST([astheaderdir],      ['${includedir}/asterisk'])dnl
-AC_SUBST([astlibdir],         ['${libdir}/asterisk'])dnl
+AC_SUBST([astlibdir],         ['${libdir}'])dnl
+AC_SUBST([astmoddir],         ['${libdir}/asterisk/modules'])dnl
 AC_SUBST([astmandir],         ['${mandir}'])dnl
 AC_SUBST([astvarlibdir],      ['${localstatedir}/lib/asterisk'])dnl
 AC_SUBST([astdatadir],        ['${astvarlibdir}'])dnl
@@ -93,7 +94,7 @@
      darwin*)
      ac_default_prefix=/usr/local
      if test ${prefix} = 'NONE'; then
-        astlibdir='/Library/Application Support/Asterisk/Modules'
+        astmoddir='/Library/Application Support/Asterisk/Modules'
         astvarlibdir='/Library/Application Support/Asterisk'
         astlogdir=/Library/Logs/Asterisk
         astvarrundir='/Library/Application Support/Asterisk/Run'
@@ -106,6 +107,7 @@
         astetcdir=/var/etc/asterisk
         astsbindir=/opt/asterisk/sbin
         astlibdir=/opt/asterisk/lib
+        astmoddir=/opt/asterisk/lib/modules
         astheaderdir=/opt/asterisk/include
         astmandir=/opt/asterisk/man
         astvarlibdir=/var/opt/asterisk
@@ -210,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++, :)
@@ -234,8 +236,6 @@
 
 AC_CHECK_TOOLS([STRIP], [strip gstrip], :)
 AC_CHECK_TOOLS([AR], [ar gar], :)
-AC_CHECK_TOOLS([SHA1SUM], [sha1sum], $ac_aux_dir/build_tools/sha1sum-sh)
-AC_CHECK_TOOLS([OPENSSL], [openssl], :)
 
 GNU_LD=0
 if test "x$with_gnu_ld" = "xyes" ; then
@@ -271,6 +271,9 @@
 fi
 fi
 AC_SUBST(DOWNLOAD)
+AC_PATH_PROG([LDCONFIG], [ldconfig], :)
+AC_PATH_PROG([SHA1SUM], [sha1sum], $ac_aux_dir/build_tools/sha1sum-sh)
+AC_PATH_PROG([OPENSSL], [openssl], :)
 
 AC_CACHE_CHECK([for bison that supports parse-param], [ac_cv_path_BISON2], [
 	if test "x$BISON" != "x:" ; then
@@ -323,7 +326,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
@@ -498,7 +501,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 ;;
@@ -622,7 +625,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]),
    )
@@ -637,7 +640,15 @@
 	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)
 
 # https support (in main/http.c) uses funopen on BSD systems,
 # fopencookie on linux
@@ -1482,7 +1493,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...])
@@ -1740,7 +1751,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}"
@@ -1811,7 +1822,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
@@ -1837,7 +1848,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)
 
@@ -1930,7 +1941,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()
 
@@ -1960,7 +1971,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"
@@ -1968,9 +1979,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])
 
@@ -2136,11 +2147,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}"
@@ -2322,8 +2333,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: trunk/include/asterisk.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk.h?view=diff&rev=353317&r1=353316&r2=353317
==============================================================================
--- trunk/include/asterisk.h (original)
+++ trunk/include/asterisk.h Mon Jan 30 15:21:16 2012
@@ -224,4 +224,8 @@
 #define bzero  0x__dont_use_bzero__use_memset_instead""
 #define bcopy  0x__dont_use_bcopy__use_memmove_instead()
 
+/* Some handy macros for turning a preprocessor token into (effectively) a quoted string */
+#define __stringify_1(x)	#x
+#define __stringify(x)		__stringify_1(x)
+
 #endif /* _ASTERISK_H */

Modified: trunk/include/asterisk/optional_api.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/optional_api.h?view=diff&rev=353317&r1=353316&r2=353317
==============================================================================
--- trunk/include/asterisk/optional_api.h (original)
+++ trunk/include/asterisk/optional_api.h Mon Jan 30 15:21:16 2012
@@ -88,9 +88,6 @@
  *
  * WARNING WARNING WARNING WARNING WARNING
  */
-
-#define __stringify_1(x)	#x
-#define __stringify(x)		__stringify_1(x)
 
 /*!
  * \brief A common value for optional API stub functions to return

Propchange: trunk/main/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Jan 30 15:21:16 2012
@@ -1,9 +1,11 @@
+*.d
+*.dylib*
+*.exports
+*.gcda
+*.gcno
+*.i
 *.o
-*.i
 *.s
-*.d
-*.exports
+*.so*
 asterisk
 version.c
-*.gcno
-*.gcda

Modified: trunk/main/Makefile
URL: http://svnview.digium.com/svn/asterisk/trunk/main/Makefile?view=diff&rev=353317&r1=353316&r2=353317
==============================================================================
--- trunk/main/Makefile (original)
+++ trunk/main/Makefile Mon Jan 30 15:21:16 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=$(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,16 @@
 # 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
 
-AST_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)
+AST_LIBS+=$(ASTSSL_LIBS)
 
 ifneq ($(findstring $(OSARCH), linux-gnu uclinux linux-uclibc linux-gnueabi kfreebsd-gnu linux-gnueabihf),)
   ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
@@ -78,7 +83,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)
@@ -89,7 +94,8 @@
 endif
 
 ifeq ($(OSARCH),SunOS)
-  AST_LIBS+=-lpthread -ldl -lrt -lnsl -lsocket -lresolv -L/opt/ssl/lib -L/usr/local/ssl/lib
+  AST_LIBS+=-lpthread -ldl -lrt -lnsl -lsocket -lresolv
+  ASTSSL_LIBS+=-L/opt/ssl/lib -L/usr/local/ssl/lib
   ASTLINK=
 endif
 
@@ -140,7 +146,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)
 
@@ -178,13 +184,61 @@
 
 $(OBJS): _ASTCFLAGS+=-DAST_MODULE=\"core\"
 
-$(MAIN_TGT): $(OBJS) editline/libedit.a $(AST_EMBED_LDSCRIPTS)
+ifeq ($(AST_ASTERISKSSL),yes)
+# The ABI *version* of the asteriskssl library; don't change this unless there truly is a
+# non-backwards-compatible ABI change in the library
+ASTSSL_SO_VERSION=1
+
+ASTSSL_LDLIBS=-L. -lasteriskssl
+
+ifeq ($(findstring darwin,$(OSARCH)),) # not Darwin
+ASTSSL_LIB:=libasteriskssl.so
+
+$(ASTSSL_LIB).$(ASTSSL_SO_VERSION): _ASTLDFLAGS+=-Wl,-soname=$(ASTSSL_LIB).$(ASTSSL_SO_VERSION)
+$(ASTSSL_LIB).$(ASTSSL_SO_VERSION): _ASTCFLAGS+=-fPIC -DAST_MODULE=\"asteriskssl\"
+$(ASTSSL_LIB).$(ASTSSL_SO_VERSION): LIBS+=$(ASTSSL_LIBS)
+$(ASTSSL_LIB).$(ASTSSL_SO_VERSION): SO_SUPPRESS_SYMBOLS=-Wl,--version-script,libasteriskssl.exports,--warn-common
+$(ASTSSL_LIB).$(ASTSSL_SO_VERSION): SOLINK=$(DYLINK)
+
+# These rules are duplicated from $(ASTTOPDIR)/Makefile.rules because the library name
+# being built does not match the "%.so" pattern; there are also additional steps
+# required to build a proper shared library (as opposed to the 'loadable module'
+# type that are built by the standard rules)
+$(ASTSSL_LIB).$(ASTSSL_SO_VERSION): libasteriskssl.o
+ifeq ($(GNU_LD),1)
+	$(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_version_script libasteriskssl "$(LINKER_SYMBOL_PREFIX)" "$(ASTTOPDIR)"
+endif
+	$(ECHO_PREFIX) echo "   [LD] $^ -> $@"
+	$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(CC_LDFLAGS_SO) $^ $(CC_LIBS)
+ifneq ($(LDCONFIG),)
+	$(LDCONFIG) $(LDCONFIG_FLAGS) .
+endif
+
+$(ASTSSL_LIB): $(ASTSSL_LIB).$(ASTSSL_SO_VERSION)
+	$(LN) -sf $< $@
+
+else # Darwin
+ASTSSL_LIB:=libasteriskssl.dylib
+
+$(ASTSSL_LIB): _ASTCFLAGS+=-fPIC -DAST_MODULE=\"asteriskssl\"
+$(ASTSSL_LIB): LIBS+=$(ASTSSL_LIBS)
+$(ASTSSL_LIB): SOLINK=$(DYLINK)
+
+# Special rules for building a shared library (not a dynamically loadable module)
+$(ASTSSL_LIB): libasteriskssl.o
+	$(ECHO_PREFIX) echo "   [LD] $^ -> $@"
+	$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(CC_LDFLAGS_SO) $^ $(CC_LIBS)
+endif
+
+endif
+
+$(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) 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) 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)
@@ -193,9 +247,28 @@
 	$(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_version_script asterisk $(LINKER_SYMBOL_PREFIX)
 endif
 
+bininstall:
+	$(INSTALL) -m 755 $(MAIN_TGT) "$(DESTDIR)$(ASTSBINDIR)/"
+ifeq ($(AST_ASTERISKSSL),yes)
+	$(INSTALL) -m 755 $(ASTSSL_LIB).$(ASTSSL_SO_VERSION) "$(DESTDIR)$(ASTLIBDIR)/"
+	$(LN) -sf "$(DESTDIR)$(ASTLIBDIR)/$(ASTSSL_LIB).$(ASTSSL_SO_VERSION)" "$(DESTDIR)$(ASTLIBDIR)/$(ASTSSL_LIB)"
+ifneq ($(LDCONFIG),)
+	$(LDCONFIG) $(LDCONFIG_FLAGS) "$(DESTDIR)$(ASTLIBDIR)/"
+endif
+endif
+	$(LN) -sf asterisk "$(DESTDIR)$(ASTSBINDIR)/rasterisk"
+
+binuninstall:
+	rm -f "$(DESTDIR)$(ASTSBINDIR)/$(MAIN_TGT)"
+	rm -f "$(DESTDIR)$(ASTSBINDIR)/rasterisk"
+	rm -f "$(DESTDIR)$(ASTLIBDIR)/$(ASTSSL_LIB).$(ASTSSL_SO_VERSION)"
+ifneq ($(LDCONFIG),)
+	$(LDCONFIG) $(LDCONFIG_FLAGS) "$(DESTDIR)$(ASTLIBDIR)/"
+endif
+
 clean::
-	rm -f asterisk
-	rm -f asterisk.exports
+	rm -f asterisk libasteriskssl.o $(ASTSSL_LIB) $(ASTSSL_LIB).*
+	rm -f asterisk.exports libasteriskssl.exports
 	@if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
 	@$(MAKE) -C stdtime clean
 	rm -f libresample/src/*.o

Modified: trunk/makeopts.in
URL: http://svnview.digium.com/svn/asterisk/trunk/makeopts.in?view=diff&rev=353317&r1=353316&r2=353317
==============================================================================
--- trunk/makeopts.in (original)
+++ trunk/makeopts.in Mon Jan 30 15:21:16 2012
@@ -34,6 +34,7 @@
 MD5=@MD5@
 SHA1SUM=@SHA1SUM@
 OPENSSL=@OPENSSL@
+LDCONFIG=@LDCONFIG@
 
 BUILD_PLATFORM=@BUILD_PLATFORM@
 BUILD_CPU=@BUILD_CPU@
@@ -81,6 +82,7 @@
 ASTETCDIR = @astetcdir@
 ASTHEADERDIR = @astheaderdir@
 ASTLIBDIR = @astlibdir@
+ASTMODDIR = @astmoddir@
 ASTMANDIR = @astmandir@
 astvarlibdir = @astvarlibdir@
 ASTVARLIBDIR = @astvarlibdir@
@@ -96,6 +98,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