Commit 0630bb0f authored by Elizabeth Smith's avatar Elizabeth Smith Committed by Dave Watson

Better <bits/c++config.h> detection

Summary:
When worrying about only 2 cpp libraries, detection of "is this libstdc++ or libc++" works, but when throwing in a third option (msvc) this becomes a very brittle way of detecting features.  Also depending on how clang is used it may or may not have this header about

Changed to instead use configuration value for "do we have this header file" for including bits/c++config.h and changed the logic to be identical in all three use cases

Test Plan: fbmake runtests

Reviewed By: njormrod@fb.com

FB internal diff: D1291547
parent aafd8ff9
......@@ -63,8 +63,10 @@
#include <type_traits>
#include <algorithm>
// libc++ doesn't provide this header
#ifndef _LIBCPP_VERSION
#include "folly/Portability.h"
// libc++ doesn't provide this header, nor does msvc
#ifdef FOLLY_HAVE_BITS_CXXCONFIG_H
// This file appears in two locations: inside fbcode and in the
// libstdc++ source code (when embedding fbstring as std::string).
// To aid in this schizophrenic use, two macros are defined in
......
......@@ -31,8 +31,8 @@
#include <string>
#include <type_traits>
// libc++ doesn't provide this header
#if !FOLLY_USE_LIBCPP
// libc++ doesn't provide this header, nor does msvc
#ifdef FOLLY_HAVE_BITS_CXXCONFIG_H
// This file appears in two locations: inside fbcode and in the
// libstdc++ source code (when embedding fbstring as std::string).
// To aid in this schizophrenic use, two macros are defined in
......
......@@ -26,8 +26,8 @@
#include "folly/Portability.h"
// libc++ doesn't provide this header
#if !FOLLY_USE_LIBCPP
// libc++ doesn't provide this header, nor does msvc
#ifdef FOLLY_HAVE_BITS_CXXCONFIG_H
// This file appears in two locations: inside fbcode and in the
// libstdc++ source code (when embedding fbstring as std::string).
// To aid in this schizophrenic use, two macros are defined in
......
......@@ -52,7 +52,7 @@ AX_BOOST_SYSTEM
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h features.h inttypes.h limits.h stdint.h stdlib.h string.h sys/time.h unistd.h mutex.h malloc.h emmintrin.h byteswap.h bits/functexcept.h])
AC_CHECK_HEADERS([fcntl.h features.h inttypes.h limits.h stdint.h stdlib.h string.h sys/time.h unistd.h mutex.h malloc.h emmintrin.h byteswap.h bits/functexcept.h bits/c++config.h])
AC_CHECK_HEADER(double-conversion/double-conversion.h, [], [AC_MSG_ERROR(
[Couldn't find double-conversion.h, please download from \
......
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