summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt8
-rw-r--r--include/__config14
-rw-r--r--include/__config_site.in2
3 files changed, 19 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6b111a871..ccf4b969b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,6 +99,8 @@ cmake_dependent_option(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY
"LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY;LIBCXX_INSTALL_LIBRARY" OFF)
set(LIBCXX_ABI_VERSION 1 CACHE STRING "ABI version of libc++.")
option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF)
+option(LIBCXX_ABI_ITANIUM "Ignore auto-detection and force use of the Itanium ABI.")
+option(LIBCXX_ABI_MICROSOFT "Ignore auto-detection and force use of the Microsoft ABI.")
option(LIBCXX_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF)
if (NOT LIBCXX_ENABLE_SHARED AND NOT LIBCXX_ENABLE_STATIC)
@@ -337,6 +339,10 @@ if (LIBCXX_HAS_MUSL_LIBC AND NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
"when building for Musl with LIBCXX_HAS_MUSL_LIBC.")
endif()
+if (LIBCXX_ABI_ITANIUM AND LIBCXX_ABI_MICROSOFT)
+ message(FATAL_ERROR "Only one of LIBCXX_ABI_ITANIUM and LIBCXX_ABI_MICROSOFT can be specified.")
+endif ()
+
#===============================================================================
# Configure System
#===============================================================================
@@ -594,6 +600,8 @@ if (NOT LIBCXX_ABI_VERSION EQUAL "1")
config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION)
endif()
config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE)
+config_define_if(LIBCXX_ABI_ITANIUM _LIBCPP_ABI_ITANIUM)
+config_define_if(LIBCXX_ABI_MICROSOFT _LIBCPP_ABI_MICROSOFT)
config_define_if_not(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE)
config_define_if_not(LIBCXX_ENABLE_STDIN _LIBCPP_HAS_NO_STDIN)
diff --git a/include/__config b/include/__config
index 8d0eeb2c9..ad34fcfab 100644
--- a/include/__config
+++ b/include/__config
@@ -157,11 +157,15 @@
// FIXME: ABI detection should be done via compiler builtin macros. This
// is just a placeholder until Clang implements such macros. For now assume
-// that Windows compilers pretending to be MSVC++ target the microsoft ABI.
-#if defined(_WIN32) && defined(_MSC_VER)
-# define _LIBCPP_ABI_MICROSOFT
-#else
-# define _LIBCPP_ABI_ITANIUM
+// that Windows compilers pretending to be MSVC++ target the Microsoft ABI,
+// and allow the user to explicitly specify the ABI to handle cases where this
+// heuristic falls short.
+#if !defined(_LIBCPP_ABI_ITANIUM) && !defined(_LIBCPP_ABI_MICROSOFT)
+# if defined(_WIN32) && defined(_MSC_VER)
+# define _LIBCPP_ABI_MICROSOFT
+# else
+# define _LIBCPP_ABI_ITANIUM
+# endif
#endif
// Need to detect which libc we're using if we're on Linux.
diff --git a/include/__config_site.in b/include/__config_site.in
index b8de0baf2..80360aa42 100644
--- a/include/__config_site.in
+++ b/include/__config_site.in
@@ -12,6 +12,8 @@
#cmakedefine _LIBCPP_ABI_VERSION @_LIBCPP_ABI_VERSION@
#cmakedefine _LIBCPP_ABI_UNSTABLE
+#cmakedefine _LIBCPP_ABI_ITANIUM
+#cmakedefine _LIBCPP_ABI_MICROSOFT
#cmakedefine _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
#cmakedefine _LIBCPP_HAS_NO_STDIN
#cmakedefine _LIBCPP_HAS_NO_STDOUT