mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Fix for build on Ubuntu 14.04 with system libraries (#1467)
* c++11: detect and correct for boost builds with an incompatible abi This is ugly, but temporary. boost::filesystem will likely be dropped soon after c++11 is enabled. Otherwise, we could simply roll our own copy_file. I've fixed this at the buildsystem level for now in order to avoid mixing in functional changes. Explanation: If boost (prior to 1.57) was built without c++11, it emulated scoped enums using c++98 constructs. Unfortunately, this implementation detail leaked into the abi. This was fixed in 1.57. When building against that installed version using c++11, the headers pick up on the native c++11 scoped enum support and enable it, however it will fail to link. This can be worked around by disabling c++11 scoped enums if linking will fail. Add an autoconf test to determine incompatibility. At build-time, if native enums are being used (a c++11 build), and force-disabling them causes a successful link, we can be sure that there's an incompatibility and enable the work-around. * c++11: add scoped enum fallbacks to CPPFLAGS rather than defining them locally Due to include ordering, defining in one place was not enough to ensure correct usage. Use global defines so that we don't have to worry abou this ordering. Also add a comment in configure about the test. * Remove unneeded include that was added by bitcoin commits
This commit is contained in:
parent
72176e5018
commit
634ef6c06e
36
configure.ac
36
configure.ac
@ -646,6 +646,42 @@ if test x$use_boost = xyes; then
|
|||||||
|
|
||||||
BOOST_LIBS="$BOOST_LDFLAGS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB $BOOST_PROGRAM_OPTIONS_LIB $BOOST_THREAD_LIB $BOOST_CHRONO_LIB"
|
BOOST_LIBS="$BOOST_LDFLAGS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB $BOOST_PROGRAM_OPTIONS_LIB $BOOST_THREAD_LIB $BOOST_CHRONO_LIB"
|
||||||
|
|
||||||
|
|
||||||
|
dnl If boost (prior to 1.57) was built without c++11, it emulated scoped enums
|
||||||
|
dnl using c++98 constructs. Unfortunately, this implementation detail leaked into
|
||||||
|
dnl the abi. This was fixed in 1.57.
|
||||||
|
|
||||||
|
dnl When building against that installed version using c++11, the headers pick up
|
||||||
|
dnl on the native c++11 scoped enum support and enable it, however it will fail to
|
||||||
|
dnl link. This can be worked around by disabling c++11 scoped enums if linking will
|
||||||
|
dnl fail.
|
||||||
|
dnl BOOST_NO_SCOPED_ENUMS was changed to BOOST_NO_CXX11_SCOPED_ENUMS in 1.51.
|
||||||
|
|
||||||
|
TEMP_LIBS="$LIBS"
|
||||||
|
LIBS="$BOOST_LIBS $LIBS"
|
||||||
|
TEMP_CPPFLAGS="$CPPFLAGS"
|
||||||
|
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
||||||
|
AC_MSG_CHECKING([for mismatched boost c++11 scoped enums])
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
#include "boost/config.hpp"
|
||||||
|
#include "boost/version.hpp"
|
||||||
|
#if !defined(BOOST_NO_SCOPED_ENUMS) && !defined(BOOST_NO_CXX11_SCOPED_ENUMS) && BOOST_VERSION < 105700
|
||||||
|
#define BOOST_NO_SCOPED_ENUMS
|
||||||
|
#define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||||
|
#define CHECK
|
||||||
|
#endif
|
||||||
|
#include "boost/filesystem.hpp"
|
||||||
|
]],[[
|
||||||
|
#if defined(CHECK)
|
||||||
|
boost::filesystem::copy_file("foo", "bar");
|
||||||
|
#else
|
||||||
|
choke;
|
||||||
|
#endif
|
||||||
|
]])],
|
||||||
|
[AC_MSG_RESULT(mismatched); BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_NO_SCOPED_ENUMS -DBOOST_NO_CXX11_SCOPED_ENUMS"], [AC_MSG_RESULT(ok)])
|
||||||
|
LIBS="$TEMP_LIBS"
|
||||||
|
CPPFLAGS="$TEMP_CPPFLAGS"
|
||||||
|
|
||||||
dnl Boost >= 1.50 uses sleep_for rather than the now-deprecated sleep, however
|
dnl Boost >= 1.50 uses sleep_for rather than the now-deprecated sleep, however
|
||||||
dnl it was broken from 1.50 to 1.52 when backed by nanosleep. Use sleep_for if
|
dnl it was broken from 1.50 to 1.52 when backed by nanosleep. Use sleep_for if
|
||||||
dnl a working version is available, else fall back to sleep. sleep was removed
|
dnl a working version is available, else fall back to sleep. sleep was removed
|
||||||
|
Loading…
Reference in New Issue
Block a user