llvm.org GIT mirror llvm / 60af313
Add secondary libstdc++ 4.8 and 5.1 detection mechanisms Summary: The date-based approach to detecting unsupported versions of libstdc++ does not handle bug fix releases of older versions. As an example, the `__GLIBCXX__` value associated with version 5.1, `20150422`, is less than the values associated with versions 4.8.5 and 4.9.3. This patch adds secondary checks based on certain properties in sufficiently new versions of libstdc++. Reviewers: jfb, tstellar, rnk, sfertile, nemanjai Reviewed By: jfb Subscribers: mgorny, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58682 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355638 91177308-0d34-0410-b5e6-96231b3b80d8 Hubert Tong 7 months ago
1 changed file(s) with 15 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
5757 set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
5858 set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
5959 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++0x")
60 # Test for libstdc++ version of at least 4.8 by checking for _ZNKSt17bad_function_call4whatEv.
61 # Note: We should check _GLIBCXX_RELEASE when possible (i.e., for GCC 7.1 and up).
6062 check_cxx_source_compiles("
6163 #include
6264 #if defined(__GLIBCXX__)
6466 #error Unsupported libstdc++ version
6567 #endif
6668 #endif
67 int main() { return 0; }
69 #if defined(__GLIBCXX__)
70 extern const char _ZNKSt17bad_function_call4whatEv[];
71 const char *chk = _ZNKSt17bad_function_call4whatEv;
72 #else
73 const char *chk = \"\";
74 #endif
75 int main() { ++chk; return 0; }
6876 "
6977 LLVM_LIBSTDCXX_MIN)
7078 if(NOT LLVM_LIBSTDCXX_MIN)
7179 message(FATAL_ERROR "libstdc++ version must be at least ${GCC_MIN}.")
7280 endif()
81 # Test for libstdc++ version of at least 5.1 by checking for std::iostream_category().
82 # Note: We should check _GLIBCXX_RELEASE when possible (i.e., for GCC 7.1 and up).
7383 check_cxx_source_compiles("
7484 #include
7585 #if defined(__GLIBCXX__)
7686 #if __GLIBCXX__ < ${GCC_SOFT_ERROR_DATE}
7787 #error Unsupported libstdc++ version
7888 #endif
89 #endif
90 #if defined(__GLIBCXX__)
91 #include
92 void foo(void) { (void) std::iostream_category(); }
7993 #endif
8094 int main() { return 0; }
8195 "