[asterisk-commits] russell: branch group/asterisk-cpp r168372 - in /team/group/asterisk-cpp: ./ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 9 21:03:35 CST 2009


Author: russell
Date: Fri Jan  9 21:03:34 2009
New Revision: 168372

URL: http://svn.digium.com/view/asterisk?view=rev&rev=168372
Log:
Make the build system search for boost::thread and link it in to the main app

Added:
    team/group/asterisk-cpp/autoconf/ax_boost_thread.m4   (with props)
Modified:
    team/group/asterisk-cpp/configure
    team/group/asterisk-cpp/configure.ac
    team/group/asterisk-cpp/include/asterisk/autoconfig.h.in
    team/group/asterisk-cpp/main/Makefile
    team/group/asterisk-cpp/makeopts.in

Added: team/group/asterisk-cpp/autoconf/ax_boost_thread.m4
URL: http://svn.digium.com/view/asterisk/team/group/asterisk-cpp/autoconf/ax_boost_thread.m4?view=auto&rev=168372
==============================================================================
--- team/group/asterisk-cpp/autoconf/ax_boost_thread.m4 (added)
+++ team/group/asterisk-cpp/autoconf/ax_boost_thread.m4 Fri Jan  9 21:03:34 2009
@@ -1,0 +1,92 @@
+# http://ac-archive.sourceforge.net/ac-archive/ax_boost_thread.html
+
+AC_DEFUN([AX_BOOST_THREAD],
+[
+	AC_ARG_WITH([boost-thread],
+	AS_HELP_STRING([--with-boost-thread@<:@=special-lib@:>@],
+                   [use the Thread library from boost - it is possible to specify a certain library for the linker
+                        e.g. --with-boost-thread=boost_thread-gcc-mt ]),
+        [
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_thread_lib=""
+        else
+		    want_boost="yes"
+        	ax_boost_user_thread_lib="$withval"
+		fi
+        ],
+        [want_boost="yes"]
+	)
+
+	if test "x$want_boost" = "xyes"; then
+        AC_REQUIRE([AC_PROG_CC])
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+        AC_CACHE_CHECK(whether the Boost::Thread library is available,
+					   ax_cv_boost_thread,
+        [AC_LANG_PUSH([C++])
+			 CXXFLAGS_SAVE=$CXXFLAGS
+
+			 if test "x$build_os" = "xsolaris" ; then
+  				 CXXFLAGS="-pthreads $CXXFLAGS"
+			 elif test "x$build_os" = "xming32" ; then
+				 CXXFLAGS="-mthreads $CXXFLAGS"
+			 else
+				CXXFLAGS="-pthread $CXXFLAGS"
+			 fi
+			 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/thread/thread.hpp>]],
+                                   [[boost::thread_group thrds;
+                                   return 0;]]),
+                   ax_cv_boost_thread=yes, ax_cv_boost_thread=no)
+			 CXXFLAGS=$CXXFLAGS_SAVE
+             AC_LANG_POP([C++])
+		])
+		if test "x$ax_cv_boost_thread" = "xyes"; then
+           if test "x$build_os" = "xsolaris" ; then
+			  BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS"
+		   elif test "x$build_os" = "xming32" ; then
+			  BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS"
+		   else
+			  BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS"
+		   fi
+
+			AC_SUBST(BOOST_CPPFLAGS)
+
+			AC_DEFINE(HAVE_BOOST_THREAD,,[define if the Boost::Date_Time library is available])
+			BN=boost_thread
+
+            if test "x$ax_boost_user_thread_lib" = "x"; then
+			    # This list was modified to only check for the -mt versions
+				for ax_lib in $BN-mt $BN-$CC-mt $BN-$CC-mt-s \
+                              lib$BN-$CC-mt lib$BN-$CC-mt-s \
+                              BN-mgw-mt $BN-mgw-mt-s ; do
+				    AC_CHECK_LIB($ax_lib, main, [BOOST_THREAD_LIB="-l$ax_lib" AC_SUBST(BOOST_THREAD_LIB) link_thread="yes" break],
+                                 [link_thread="no"])
+  				done
+            else
+               for ax_lib in $ax_boost_user_thread_lib $BN-$ax_boost_user_thread_lib; do
+				      AC_CHECK_LIB($ax_lib, main,
+                                   [BOOST_THREAD_LIB="-l$ax_lib" AC_SUBST(BOOST_THREAD_LIB) link_thread="yes" break],
+                                   [link_thread="no"])
+                  done
+
+            fi
+			if test "x$link_thread" = "xno"; then
+				AC_MSG_ERROR(Could not find the boost::thread library.  Please install it.  On debian/ubuntu, install libboost-thread-dev)
+			fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    	LDFLAGS="$LDFLAGS_SAVED"
+	fi
+])
+
+

Propchange: team/group/asterisk-cpp/autoconf/ax_boost_thread.m4
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/group/asterisk-cpp/autoconf/ax_boost_thread.m4
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/group/asterisk-cpp/autoconf/ax_boost_thread.m4
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/group/asterisk-cpp/configure.ac
URL: http://svn.digium.com/view/asterisk/team/group/asterisk-cpp/configure.ac?view=diff&rev=168372&r1=168371&r2=168372
==============================================================================
--- team/group/asterisk-cpp/configure.ac (original)
+++ team/group/asterisk-cpp/configure.ac Fri Jan  9 21:03:34 2009
@@ -1546,6 +1546,8 @@
 
 AC_LANG_PUSH(C++)
 
+AX_BOOST_THREAD()
+
 if test "${USE_VPB}" != "no"; then
    AC_MSG_CHECKING(for vpb_open in -lvpb)
    saved_libs="${LIBS}"

Modified: team/group/asterisk-cpp/include/asterisk/autoconfig.h.in
URL: http://svn.digium.com/view/asterisk/team/group/asterisk-cpp/include/asterisk/autoconfig.h.in?view=diff&rev=168372&r1=168371&r2=168372
==============================================================================
--- team/group/asterisk-cpp/include/asterisk/autoconfig.h.in (original)
+++ team/group/asterisk-cpp/include/asterisk/autoconfig.h.in Fri Jan  9 21:03:34 2009
@@ -128,6 +128,9 @@
 
 /* Define to indicate the ${BKTR_DESCRIP} library version */
 #undef HAVE_BKTR_VERSION
+
+/* define if the Boost::Date_Time library is available */
+#undef HAVE_BOOST_THREAD
 
 /* Define to 1 if byteswap.h macros are available. */
 #undef HAVE_BYTESWAP_H

Modified: team/group/asterisk-cpp/main/Makefile
URL: http://svn.digium.com/view/asterisk/team/group/asterisk-cpp/main/Makefile?view=diff&rev=168372&r1=168371&r2=168372
==============================================================================
--- team/group/asterisk-cpp/main/Makefile (original)
+++ team/group/asterisk-cpp/main/Makefile Fri Jan  9 21:03:34 2009
@@ -43,6 +43,7 @@
 AST_LIBS += $(OPENSSL_LIB)
 AST_LIBS += $(BKTR_LIB)
 AST_LIBS += $(LIBXML2_LIB) 
+AST_LIBS += $(BOOST_THREAD_LIB)
 
 ifeq ($(POLL_AVAILABLE),)
   OBJS+=poll.o

Modified: team/group/asterisk-cpp/makeopts.in
URL: http://svn.digium.com/view/asterisk/team/group/asterisk-cpp/makeopts.in?view=diff&rev=168372&r1=168371&r2=168372
==============================================================================
--- team/group/asterisk-cpp/makeopts.in (original)
+++ team/group/asterisk-cpp/makeopts.in Fri Jan  9 21:03:34 2009
@@ -73,6 +73,8 @@
 ALSA_INCLUDE=@ALSA_INCLUDE@
 ALSA_LIB=@ALSA_LIB@
 
+BOOST_THREAD_LIB=@BOOST_THREAD_LIB@
+
 CURL_INCLUDE=@CURL_INCLUDE@
 CURL_LIB=@CURL_LIB@
 




More information about the asterisk-commits mailing list