summaryrefslogtreecommitdiffstats
path: root/meta/recipes-sato/webkit/webkitgtk/detect-atomics-during-configure.patch
blob: 12836f28f2ed65dbe9bb9cb64bee792d22cce15c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Taken from
https://bugs.webkit.org/show_bug.cgi?id=161900

Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>

Index: webkitgtk-2.16.1/Source/WTF/wtf/CMakeLists.txt
===================================================================
--- webkitgtk-2.16.1.orig/Source/WTF/wtf/CMakeLists.txt
+++ webkitgtk-2.16.1/Source/WTF/wtf/CMakeLists.txt
@@ -182,7 +182,6 @@ set(WTF_HEADERS
 
 set(WTF_SOURCES
     Assertions.cpp
-    Atomics.cpp
     AutomaticThread.cpp
     BitVector.cpp
     ClockType.cpp
@@ -301,6 +300,15 @@ if (NOT USE_SYSTEM_MALLOC)
     list(APPEND WTF_LIBRARIES bmalloc)
 endif ()
 
+file(WRITE ${CMAKE_BINARY_DIR}/test_atomics.cpp
+     "int main(void)\n"
+     "{ long long x = 1; return (int) __sync_add_and_fetch_8(&x, 1); }\n")
+try_compile(ATOMICS_BUILD_SUCCEEDED ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/test_atomics.cpp)
+if (NOT ATOMICS_BUILD_SUCCEEDED)
+    list(APPEND WTF_SOURCES Atomics.cpp)
+endif ()
+file(REMOVE ${CMAKE_BINARY_DIR}/test_atomics.cpp)
+
 list(APPEND WTF_SOURCES
     unicode/icu/CollatorICU.cpp
 )