From 835ac98a234aaea65395894a3f603bf729f3e92d Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 29 Oct 2018 12:07:06 +0300 Subject: [PATCH] Fail libgmpxx detection on Linux if libstdc++ is not used as the std library. libgmpxx was built against libstdc++, so if the application uses e.g. libc++, linking fails because of the standard symbols mismatch. --- test/Jamfile.v2 | 6 +++--- test/has_gmpxx.cpp | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 31dcd2a..d29689f 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -10,7 +10,7 @@ obj has_gmpxx : has_gmpxx.cpp ; explicit has_gmpxx ; test-suite integer - : + : [ run integer_traits_test.cpp ] [ run integer_test.cpp : : : gcc:-Wno-long-long darwin:-Wno-long-long sun:"-Qoption ccfe -tmpldepth=128" ] [ run integer_mask_test.cpp ] @@ -22,8 +22,8 @@ test-suite integer [ compile static_log2_include_test.cpp ] [ compile static_min_max_include_test.cpp ] [ compile integer_fwd_include_test.cpp ] - [ compile gcd_constexpr14_test.cpp ] - [ compile gcd_noexcept_test.cpp ] + [ compile gcd_constexpr14_test.cpp ] + [ compile gcd_noexcept_test.cpp ] [ compile-fail fail_int_exact.cpp ] [ compile-fail fail_int_fast.cpp ] [ compile-fail fail_int_least.cpp ] diff --git a/test/has_gmpxx.cpp b/test/has_gmpxx.cpp index edf62d8..4d4a41c 100644 --- a/test/has_gmpxx.cpp +++ b/test/has_gmpxx.cpp @@ -5,3 +5,11 @@ #include +// On Linux, libgmpxx is built with gcc and libstdc++. When the user application, such as tests, are built against libc++, +// linking fails because of the C++ standard library symbol names mismatch. So fail the test if we're not using libstdc++. +#if defined(__linux__) || defined(__linux) || defined(linux) +#include +#if !defined(__GLIBCPP__) && !defined(__GLIBCXX__) +#error "libgmpxx is not supported on this platform with this C++ standard library" +#endif +#endif