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 35 36 37 38
|
From: Sebastian Ramacher <sramacher@debian.org>
Date: Fri, 29 Oct 2021 11:15:29 +0200
Subject: Link atomic if necessary
---
meson.build | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/meson.build b/meson.build
index a624141..ce7956b 100644
--- a/meson.build
+++ b/meson.build
@@ -486,6 +486,25 @@ else # system not darwin or windows
]
endif # system
+test_atomic = '''
+#include <atomic>
+int main(void)
+{
+ std::atomic<int64_t> v;
+ v = -1;
+ return 0;
+}
+'''
+
+cxx = meson.get_compiler('cpp')
+if not cxx.links(test_atomic, name: 'std::atomic<int64_t> without libatomic')
+ libatomic = cxx.find_library('atomic', required: false)
+ if cxx.links(test_atomic, dependencies: libatomic, name: 'std::atomic<int64_t> with libatomic')
+ general_dependencies += libatomic
+ else
+ error('8-byte atomic operations are required')
+ endif
+endif
general_include_dirs += get_option('extra_include_dirs')
general_compile_args = [ arch_flags, feature_defines ]
|