AX_BOOST_FOR_BIND10
# Boost offset_ptr is required in one library and not optional right now, so
# 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.])
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"
# I can't get some of the #include <asio.hpp> right without this
dnl
dnl And possibly sets:
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
AC_DEFUN([AX_BOOST_FOR_BIND10], [
[AC_MSG_RESULT(no)
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)
CPPFLAGS="$CPPFLAGS_SAVED"