summaryrefslogtreecommitdiffstats
path: root/debian/patches/check-for-atomic.patch
blob: 4097100e5b90c97e69d0e525a857ca9ad9a1e8da (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
Description: Add -latomic where needed
 This is to fix the build on armel and mipsel
Author: Mattia Rizzolo <mattia@debian.org>
Forwarded: https://gitlab.com/inkscape/inkscape/-/merge_requests/1867
Last-Update: 2020-05-07

--- a/CMakeScripts/DefineDependsandFlags.cmake
+++ b/CMakeScripts/DefineDependsandFlags.cmake
@@ -60,6 +60,22 @@
     list(APPEND INKSCAPE_LIBS "-latomic")
 ENDIF()
 
+include(CheckCXXSourceCompiles)
+CHECK_CXX_SOURCE_COMPILES("
+#include <atomic>
+#include <cstdint>
+std::atomic<uint64_t> x (0);
+int main() {
+  uint64_t i = x.load(std::memory_order_relaxed);
+  return 0;
+}
+"
+LIBATOMIC_NOT_NEEDED)
+IF (NOT LIBATOMIC_NOT_NEEDED)
+    message(STATUS "  Adding -latomic to the libs.")
+    list(APPEND INKSCAPE_LIBS "-latomic")
+ENDIF()
+
 
 # ----------------------------------------------------------------------------
 # Helper macros