Browse Source

[3039] Detect build failures due to BOOST_STATIC_ASSERT during configure

Mukund Sivaraman 12 years ago
parent
commit
30e7a2c749
2 changed files with 18 additions and 0 deletions
  1. 4 0
      configure.ac
  2. 14 0
      m4macros/ax_boost_for_bind10.m4

+ 4 - 0
configure.ac

@@ -875,6 +875,10 @@ if test "$BOOST_OFFSET_PTR_WOULDFAIL" = "yes"; then
     AC_MSG_ERROR([Failed to compile a required header file.  Try upgrading Boost to 1.44 or higher (when using clang++) or specifying --without-werror.  See the ChangeLog entry for Trac no. 2147 for more details.])
 fi
 
+if test "$BOOST_STATIC_ASSERT_WOULDFAIL" = "yes" -a X"$werror_ok" = X1; then
+    AC_MSG_ERROR([Failed to use Boost static assertions. Try upgrading Boost to 1.54 or higher (when using GCC 4.8) or specifying --without-werror.  See trac ticket no. 3039 for more details.])
+fi
+
 # There's a known bug in FreeBSD ports for Boost that would trigger a false
 # warning in build with g++ and -Werror (we exclude clang++ explicitly to
 # avoid unexpected false positives).

+ 14 - 0
m4macros/ax_boost_for_bind10.m4

@@ -28,6 +28,8 @@ dnl                               cause build failure; otherwise set to "no"
 dnl   BOOST_MAPPED_FILE_CXXFLAG set to the compiler flag that would need to
 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"
 
 AC_DEFUN([AX_BOOST_FOR_BIND10], [
 AC_LANG_SAVE
@@ -146,6 +148,18 @@ if test $BOOST_MAPPED_FILE_WOULDFAIL = yes; then
   AC_MSG_RESULT(no)
 fi
 
+# BOOST_STATIC_ASSERT in versions below Boost 1.54.0 is known to result
+# in warnings with GCC 4.8.  Detect it.
+AC_MSG_CHECKING([BOOST_STATIC_ASSERT compiles])
+AC_TRY_COMPILE([
+#include <boost/static_assert.hpp>
+void testfn(void) { BOOST_STATIC_ASSERT(true); }
+],,
+[AC_MSG_RESULT(yes)
+ BOOST_STATIC_ASSERT_WOULDFAIL=no],
+[AC_MSG_RESULT(no)
+ BOOST_STATIC_ASSERT_WOULDFAIL=yes])
+
 CXXFLAGS="$CXXFLAGS_SAVED"
 
 AC_SUBST(BOOST_INCLUDES)