Build wtf/Atomics.cpp only if needed
authorAlberto Garcia <berto@igalia.com>
Wed, 26 Apr 2017 07:31:43 +0000 (07:31 +0000)
committerRaspbian forward porter <root@raspbian.org>
Wed, 26 Apr 2017 07:31:43 +0000 (07:31 +0000)
===================================================================

Gbp-Pq: Name fix-ftbfs-armel.patch

Source/WTF/wtf/CMakeLists.txt

index 867999ea9286b953f133709b6de49005e04c14ae..0ef7766545ad994f5c016baf4d2ce4c58d2e208c 100644 (file)
@@ -171,7 +171,6 @@ set(WTF_HEADERS
 
 set(WTF_SOURCES
     Assertions.cpp
-    Atomics.cpp
     BitVector.cpp
     CompilationThread.cpp
     CrossThreadCopier.cpp
@@ -276,6 +275,16 @@ 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)
+message(STATUS "Found __sync_add_and_fetch_8(): ${ATOMICS_BUILD_SUCCEEDED}")
+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
 )