summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2016-03-11 12:32:26 -0500
committerMathias Stearn <mathias@10gen.com>2016-03-14 17:04:31 -0400
commit4b6952e97e74d8c7bd16ebfc5fe6e412ccf0f48c (patch)
treeb5e72333c2449ced9087e40b0363a5e40f0ffb68
parentb11988543dbba0cf77adf1f01c558c796be9ff72 (diff)
downloadmongo-4b6952e97e74d8c7bd16ebfc5fe6e412ccf0f48c.tar.gz
SERVER-23088 fix boost's libstdcpp detection under clang
Fixes compilation errors introduced by SERVER-19936 when compiling with clang on a system without boost headers installed.
-rw-r--r--src/third_party/boost-1.56.0/boost/config/stdlib/libstdcpp3.hpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/third_party/boost-1.56.0/boost/config/stdlib/libstdcpp3.hpp b/src/third_party/boost-1.56.0/boost/config/stdlib/libstdcpp3.hpp
index 2fd6ea7d533..10799e80328 100644
--- a/src/third_party/boost-1.56.0/boost/config/stdlib/libstdcpp3.hpp
+++ b/src/third_party/boost-1.56.0/boost/config/stdlib/libstdcpp3.hpp
@@ -91,6 +91,18 @@
# endif
#endif
+
+// MONGO
+// Implement support for clang + libstdc++ similarly to new versions of boost. This is based on
+// https://github.com/boostorg/config/blob/boost-1.60.0/include/boost/config/stdlib/libstdcpp3.hpp#L115-L141
+#ifdef __clang__
+#if !__has_include(<ext/cmath>)
+#error "MongoDB does not support compiling with libstdc++ older than 4.8"
+#elif __has_include(<shared_mutex>)
+#define MONGO_CLANG_LIBSTDCPP49
+#endif
+#else
+
// stdlibc++ C++0x support is detected via __GNUC__, __GNUC_MINOR__, and possibly
// __GNUC_PATCHLEVEL__ at the suggestion of Jonathan Wakely, one of the stdlibc++
// developers. He also commented:
@@ -162,7 +174,11 @@
// Note that although <atomic> existed prior to gcc 4.8 it was largely unimplemented for many types:
# define BOOST_NO_CXX11_HDR_ATOMIC
#endif
-#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
+
+#endif // MONGO __clang__
+
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9) || !defined(__GXX_EXPERIMENTAL_CXX0X__) \
+ || !defined(MONGO_CLANG_LIBSTDCPP49)
// Although <regex> is present and compilable against, the actual implementation is not functional
// even for the simplest patterns such as "\d" or "[0-9]". This is the case at least in gcc up to 4.8, inclusively.
# define BOOST_NO_CXX11_HDR_REGEX