Browse Source

[1991] added checks for FreeBSD build failure due to a ports bug.

JINMEI Tatuya 12 years ago
parent
commit
fb95fbd371
2 changed files with 24 additions and 3 deletions
  1. 8 1
      configure.ac
  2. 16 2
      m4macros/ax_boost_for_bind10.m4

+ 8 - 1
configure.ac

@@ -841,10 +841,17 @@ LIBS=$LIBS_SAVED
 AX_BOOST_FOR_BIND10
 AX_BOOST_FOR_BIND10
 # Boost offset_ptr is required in one library and not optional right now, so
 # Boost offset_ptr is required in one library and not optional right now, so
 # we unconditionally fail here if it doesn't work.
 # we unconditionally fail here if it doesn't work.
-if test "$BOOST_OFFSET_PTR_FAILURE" == "yes"; then
+if test "$BOOST_OFFSET_PTR_FAILURE" = "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.])
     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
 fi
 
 
+# There's a known bug in FreeBSD ports for Boost that would trigger a false
+# warning in build.
+if test "$BOOST_NUMERIC_CAST_WOULDFAIL" = "yes"; then
+    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
+
+# Add some default CPP flags needed for Boost, identified by the AX macro.
 CPPFLAGS="$CPPFLAGS_SAVES $CPPFLAGS_BOOST_THREADCONF"
 CPPFLAGS="$CPPFLAGS_SAVES $CPPFLAGS_BOOST_THREADCONF"
 
 
 # I can't get some of the #include <asio.hpp> right without this
 # I can't get some of the #include <asio.hpp> right without this

+ 16 - 2
m4macros/ax_boost_for_bind10.m4

@@ -19,8 +19,10 @@ dnl   AC_SUBST(BOOST_INCLUDES)
 dnl
 dnl
 dnl And possibly sets:
 dnl And possibly sets:
 dnl   CPPFLAGS_BOOST_THREADCONF should be added to CPPFLAGS by caller
 dnl   CPPFLAGS_BOOST_THREADCONF should be added to CPPFLAGS by caller
-dnl   BOOST_OFFSET_PTR_WOULDFAIL set to yes if offset_ptr would cause build
-dnl                              error; otherwise set to no
+dnl   BOOST_OFFSET_PTR_WOULDFAIL set to "yes" if offset_ptr would cause build
+dnl                              error; otherwise set to "no"
+dnl   BOOST_NUMERIC_CAST_WOULDFAIL set to "yes" if numeric_cast would cause
+dnl                                build error; otherwise set to "no"
 dnl
 dnl
 
 
 AC_DEFUN([AX_BOOST_FOR_BIND10], [
 AC_DEFUN([AX_BOOST_FOR_BIND10], [
@@ -81,6 +83,18 @@ AC_TRY_COMPILE([
 [AC_MSG_RESULT(no)
 [AC_MSG_RESULT(no)
  BOOST_OFFSET_PTR_WOULDFAIL=yes])
  BOOST_OFFSET_PTR_WOULDFAIL=yes])
 
 
+# Detect build failure case known to happen with Boost installed via
+# FreeBSD ports
+AC_MSG_CHECKING([Boost numeric_cast compiles])
+AC_TRY_COMPILE([
+#include <boost/numeric/conversion/cast.hpp>
+],[
+return (boost::numeric_cast<short>(0));
+],[AC_MSG_RESULT(yes)
+   BOOST_NUMERIC_CAST_WOULDFAIL=no],
+  [AC_MSG_RESULT(no)
+   BOOST_NUMERIC_CAST_WOULDFAIL=yes])
+
 AC_SUBST(BOOST_INCLUDES)
 AC_SUBST(BOOST_INCLUDES)
 
 
 CPPFLAGS="$CPPFLAGS_SAVED"
 CPPFLAGS="$CPPFLAGS_SAVED"