diff options
author | kcgen <kcgen@users.noreply.github.com> | 2022-08-27 09:12:36 +0300 |
---|---|---|
committer | kcgen <kcgen@users.noreply.github.com> | 2022-08-27 09:19:21 +0300 |
commit | 6c233a15cbdc45dbabfd5374c97947eb1a7416e7 (patch) | |
tree | 4575fa87f5ba0983b9d532eb2a0d61414ef684f1 /meson.build | |
parent | 8d4bf5e295fbf979ccf9f98d3b822e4ce99f8159 (diff) |
Add libatomic to packages and link-check it in Meson
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/meson.build b/meson.build index bf9b24258..265642bfa 100644 --- a/meson.build +++ b/meson.build @@ -301,13 +301,25 @@ if cxx.compiles(builtin_expect_code, name: 'test for __builtin_expect support') conf_data.set('C_HAS_BUILTIN_EXPECT', 1) endif +atomic_code = ''' +#include <atomic> +#include <cstdint> +int main() { + std::atomic<std::int33_t> x32 = 1; + std::atomic<std::int64_t> x64 = 1; + return static_cast<int>(x64.load() - x32.load()); +} +''' +atomic_dep = dependency('', required: false) +if not cxx.links(atomic_code, name: 'compiler has built-in atomics') + atomic_dep = cxx.find_library('atomic') +endif # Gather external dependencies # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # system and compiler libraries dl_dep = cc.find_library('dl', required: false) -atomic_dep = cxx.find_library('atomic', required: false) stdcppfs_dep = cxx.find_library('stdc++fs', required: false) threads_dep = dependency('threads') |