Commit 77cc480d authored by Peter Griess's avatar Peter Griess Committed by Sara Golemon

Detect libc++ in configure.ac.

Summary:
- Explicitly detect use of libc++ in configure.ac and reflect this in
folly-config.h. Do this rather than looking for to pop up organically
_LIBCPP_VERSION since this only exists if we've included some libc++
header files prior to refernce. This isn't always the case, e.g. in
Portability.h.

Test Plan:
- fbconfig -r folly && fbmake runtests
- ./configure && make check on Ubuntu/FC/Mac

Reviewed By: simpkins@fb.com

FB internal diff: D1002958
parent 1342be12
......@@ -121,7 +121,7 @@ struct MaxAlign { char c; } __attribute__((aligned));
// It turns out that GNU libstdc++ and LLVM libc++ differ on how they implement
// the 'std' namespace; the latter uses inline namepsaces. Wrap this decision
// up in a macro to make forward-declarations easier.
#ifdef _LIBCPP_VERSION
#if FOLLY_USE_LIBCPP
#define FOLLY_NAMESPACE_STD_BEGIN _LIBCPP_BEGIN_NAMESPACE_STD
#define FOLLY_NAMESPACE_STD_END _LIBCPP_END_NAMESPACE_STD
#else
......
......@@ -78,6 +78,15 @@ AC_COMPILE_IFELSE(
AC_DEFINE([OVERRIDE], [],
[Define to "override" if the compiler supports C++11 "override"])]
)
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE[
#include <type_traits>
#if !_LIBCPP_VERSION
#error No libc++
#endif
void func() {}]
],
[AC_DEFINE([USE_LIBCPP], [1], [Define to 1 if we're using libc++.])])
# Check for clock_gettime(2). This is not in an AC_CHECK_FUNCS() because we
# want to link with librt if necessary.
......
......@@ -15,6 +15,7 @@
*/
#include "folly/ScopeGuard.h"
#include "folly/Portability.h"
#include <gflags/gflags.h>
#include <gtest/gtest.h>
......@@ -126,7 +127,7 @@ TEST(ScopeGuard, GuardException) {
throw std::runtime_error("destructors should never throw!");
});
},
#ifdef _LIBCPP_VERSION
#if FOLLY_USE_LIBCPP
"terminate called throwing an exception"
#else
"destructors should never throw"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment