diff --git a/configure.ac b/configure.ac index e5ec669a23e13c89fd7eabd85a8b5f05a575e045..41b09003b12118f0f38c851687d0ae0307382f0f 100644 --- a/configure.ac +++ b/configure.ac @@ -912,6 +912,17 @@ if test "x$use_shared_memory" = "xyes"; then fi AC_SUBST(BOOST_MAPPED_FILE_CXXFLAG) +if test "$BOOST_OFFSET_PTR_OLD" = "yes" -a "$use_shared_memory" = "yes" ; then + AC_MSG_ERROR([You're trying to compile against boost older than 1.48 with +shared memory. Older versions of boost have a bug which causes segfaults in +offset_ptr implementation when compiled by GCC with optimisations enabled. +See ticket no. 3025 for details. + +Either update boost to newer version or use --without-shared-memory. +Note that most users likely don't need shared memory support. +]) +fi + # Add some default CPP flags needed for Boost, identified by the AX macro. CPPFLAGS="$CPPFLAGS $CPPFLAGS_BOOST_THREADCONF" diff --git a/m4macros/ax_boost_for_bind10.m4 b/m4macros/ax_boost_for_bind10.m4 index 3a71337e193ba5534606d6dc66e4d924aa5a38d7..cc6408c85e52315615f01e8146135117805b7687 100644 --- a/m4macros/ax_boost_for_bind10.m4 +++ b/m4macros/ax_boost_for_bind10.m4 @@ -31,6 +31,12 @@ dnl It is of no use if "WOULDFAIL" is yes. dnl BOOST_STATIC_ASSERT_WOULDFAIL set to "yes" if BOOST_STATIC_ASSERT would dnl cause build error; otherwise set to "no" +dnl BOOST_OFFSET_PTR_OLD set to "yes" if the version of boost is older than +dnl 1.48. Older versions of boost have a bug which +dnl causes segfaults in offset_ptr implementation when +dnl compiled by GCC with optimisations enabled. +dnl See ticket no. 3025 for details. + AC_DEFUN([AX_BOOST_FOR_BIND10], [ AC_LANG_SAVE AC_LANG([C++]) @@ -106,9 +112,21 @@ if test "X$GXX" = "Xyes"; then BOOST_NUMERIC_CAST_WOULDFAIL=yes]) CXXFLAGS="$CXXFLAGS_SAVED" + + AC_MSG_CHECKING([Boost rbtree is old]) + AC_TRY_COMPILE([ + #include + #if BOOST_VERSION < 104800 + #error Too old + #endif + ],,[AC_MSG_RESULT(no) + BOOST_OFFSET_PTR_OLD=no + ],[AC_MSG_RESULT(yes) + BOOST_OFFSET_PTR_OLD=yes]) else # This doesn't matter for non-g++ BOOST_NUMERIC_CAST_WOULDFAIL=no + BOOST_OFFSET_PTR_OLD=no fi # Boost interprocess::managed_mapped_file is highly system dependent and