Browse Source

[3025] Detect a too old version of boost

With old version of boost and some versions of gcc, the RBTree
implementation is not stable with optimisations turned on. Detect the
old boost if we use gcc (no idea how to trigger it with the whole
machinery of the crashing test, so testing against the version).

Fail in that case now, we'll do something more drastic in following
commits.
Michal 'vorner' Vaner 12 years ago
parent
commit
6faea42739
2 changed files with 19 additions and 0 deletions
  1. 4 0
      configure.ac
  2. 15 0
      m4macros/ax_boost_for_bind10.m4

+ 4 - 0
configure.ac

@@ -898,6 +898,10 @@ if test "$BOOST_NUMERIC_CAST_WOULDFAIL" = "yes" -a X"$werror_ok" = X1 -a $CLANGP
     AC_MSG_ERROR([Failed to compile a required header file.  If you are using FreeBSD and Boost installed via ports, retry with specifying --without-werror.  See the ChangeLog entry for Trac no. 1991 for more details.])
 fi
 
+if test "$BOOST_RBTREE_OLD" = "yes" ; then
+    AC_MSG_ERROR([Bah! Too old.])
+fi
+
 use_shared_memory=yes
 AC_ARG_WITH(shared-memory,
     AC_HELP_STRING([--with-shared-memory],

+ 15 - 0
m4macros/ax_boost_for_bind10.m4

@@ -30,6 +30,9 @@ dnl                             compile managed_mapped_file (can be empty).
 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_RBTREE_OLD if the version of boost is older than 1.48. The old
+dnl                    version confuses some versions of gcc optimisations and
+dnl                    certain files should be compiled without optimisations.
 
 AC_DEFUN([AX_BOOST_FOR_BIND10], [
 AC_LANG_SAVE
@@ -106,9 +109,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 <boost/version.hpp>
+   #if BOOST_VERSION < 104800
+   #error Too old
+   #endif
+   ],,[AC_MSG_RESULT(no)
+       BOOST_RBTREE_OLD=no
+   ],[AC_MSG_RESULT(yes)
+      BOOST_RBTREE_OLD=yes])
 else
    # This doesn't matter for non-g++
    BOOST_NUMERIC_CAST_WOULDFAIL=no
+   BOOST_RBTREE_OLD=no
 fi
 
 # Boost interprocess::managed_mapped_file is highly system dependent and