From 0acc164c6a3be5eb97ba3963264bdfa5211d6b9c Mon Sep 17 00:00:00 2001 From: JINMEI Tatuya Date: Mon, 19 Mar 2012 23:00:23 -0700 Subject: [PATCH] [1727] define BOOST_DISABLE_THREADS if Boost doesn't use theads by default. this will fix a crash in asiolink tests on OpenBSD due to its deviant behavior that could result in different configuration on the use of boost threads in different .cc files. --- configure.ac | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5ce897df05..0f2e66700e 100644 --- a/configure.ac +++ b/configure.ac @@ -780,7 +780,22 @@ if test "${boost_include_path}" ; then fi AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/foreach.hpp boost/interprocess/sync/interprocess_upgradable_mutex.hpp boost/date_time/posix_time/posix_time_types.hpp boost/bind.hpp boost/function.hpp],, AC_MSG_ERROR([Missing required header files.])) -CPPFLAGS="$CPPFLAGS_SAVES" + +# Detect whether Boost tries to use threads by default, and, if not, +# make it sure explicitly. In some systems the automatic detection +# may depend on preceding header files, and if inconsistency happens +# it could lead to a critical disruption. +AC_MSG_CHECKING([whether Boost tries to use threads]) +AC_TRY_COMPILE([ +#include +#ifdef BOOST_HAS_THREADS +#error "boost will use threads" +#endif],, +[AC_MSG_RESULT(no) + CPPFLAGS_BOOST_THREADCONF="-DBOOST_DISABLE_THREADS=1"], +[AC_MSG_RESULT(yes)]) + +CPPFLAGS="$CPPFLAGS_SAVES $CPPFLAGS_BOOST_THREADCONF" AC_SUBST(BOOST_INCLUDES) # I can't get some of the #include right without this