From f151d31fc5772ef0249618e9f163f4abb0ef5538 Mon Sep 17 00:00:00 2001 From: Debian Qt/KDE Maintainers Date: Tue, 19 Feb 2019 20:25:35 +0000 Subject: [PATCH] atomic_config_test Gbp-Pq: Name atomic_config_test.diff --- Source/WebKit2/CMakeLists.txt | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/Source/WebKit2/CMakeLists.txt b/Source/WebKit2/CMakeLists.txt index e5d08ed6..aa7863cb 100644 --- a/Source/WebKit2/CMakeLists.txt +++ b/Source/WebKit2/CMakeLists.txt @@ -1,3 +1,6 @@ +include(CheckCXXSourceCompiles) +include(CheckFunctionExists) + set(WebKit2_INCLUDE_DIRECTORIES "${JAVASCRIPTCORE_DIR}/llint" "${WEBKIT2_DIR}" @@ -740,11 +743,33 @@ set(PluginProcess_LIBRARIES WebKit2 ) -# librt is needed for shm_open on Linux. -find_library(LIBRT_LIBRARIES NAMES rt) -mark_as_advanced(LIBRT_LIBRARIES) -if (LIBRT_LIBRARIES) - list(APPEND WebKit2_LIBRARIES ${LIBRT_LIBRARIES}) +if (COMPILER_IS_GCC_OR_CLANG) + set(ATOMIC_TEST_SOURCE + " + #include + int main() { std::atomic i(0); i++; return 0; } + " + ) + check_cxx_source_compiles("${ATOMIC_TEST_SOURCE}" ATOMIC_INT64_IS_BUILTIN) + if (NOT ATOMIC_INT64_IS_BUILTIN) + set(CMAKE_REQUIRED_LIBRARIES atomic) + check_cxx_source_compiles("${ATOMIC_TEST_SOURCE}" ATOMIC_INT64_REQUIRES_LIBATOMIC) + if (ATOMIC_INT64_REQUIRES_LIBATOMIC) + list(APPEND WebKit2_LIBRARIES atomic) + endif () + unset(CMAKE_REQUIRED_LIBRARIES) + endif () +endif () + +if (UNIX) + check_function_exists(shm_open SHM_OPEN_EXISTS) + if (NOT SHM_OPEN_EXISTS) + set(CMAKE_REQUIRED_LIBRARIES rt) + check_function_exists(shm_open SHM_OPEN_REQUIRES_LIBRT) + if (SHM_OPEN_REQUIRES_LIBRT) + list(APPEND WebKit2_LIBRARIES rt) + endif () + endif () endif () macro(ADD_WEBKIT2_PREFIX_HEADER _target) -- 2.30.2