Parcourir la source

Merge #3025

Detect old versions of boost and suggest either disabling shared memory
for them or upgrading.
Michal 'vorner' Vaner il y a 11 ans
Parent
commit
598e458c7a
2 fichiers modifiés avec 29 ajouts et 0 suppressions
  1. 11 0
      configure.ac
  2. 18 0
      m4macros/ax_boost_for_bind10.m4

+ 11 - 0
configure.ac

@@ -912,6 +912,17 @@ if test "x$use_shared_memory" = "xyes"; then
 fi
 fi
 AC_SUBST(BOOST_MAPPED_FILE_CXXFLAG)
 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.
 # Add some default CPP flags needed for Boost, identified by the AX macro.
 CPPFLAGS="$CPPFLAGS $CPPFLAGS_BOOST_THREADCONF"
 CPPFLAGS="$CPPFLAGS $CPPFLAGS_BOOST_THREADCONF"
 
 

+ 18 - 0
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   BOOST_STATIC_ASSERT_WOULDFAIL set to "yes" if BOOST_STATIC_ASSERT would
 dnl                                 cause build error; otherwise set to "no"
 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_DEFUN([AX_BOOST_FOR_BIND10], [
 AC_LANG_SAVE
 AC_LANG_SAVE
 AC_LANG([C++])
 AC_LANG([C++])
@@ -106,9 +112,21 @@ if test "X$GXX" = "Xyes"; then
     BOOST_NUMERIC_CAST_WOULDFAIL=yes])
     BOOST_NUMERIC_CAST_WOULDFAIL=yes])
 
 
    CXXFLAGS="$CXXFLAGS_SAVED"
    CXXFLAGS="$CXXFLAGS_SAVED"
+
+   AC_MSG_CHECKING([Boost rbtree is old])
+   AC_TRY_COMPILE([
+   #include <boost/version.hpp>
+   #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
 else
    # This doesn't matter for non-g++
    # This doesn't matter for non-g++
    BOOST_NUMERIC_CAST_WOULDFAIL=no
    BOOST_NUMERIC_CAST_WOULDFAIL=no
+   BOOST_OFFSET_PTR_OLD=no
 fi
 fi
 
 
 # Boost interprocess::managed_mapped_file is highly system dependent and
 # Boost interprocess::managed_mapped_file is highly system dependent and