diff options
author | Guillaume Tucker <guillaume.tucker@collabora.com> | 2019-06-24 17:22:33 +0100 |
---|---|---|
committer | Simon Ser <simon.ser@intel.com> | 2019-06-25 13:51:30 +0300 |
commit | 70303d211886ae109dfc0a88948c362359bdd07c (patch) | |
tree | 548f7d1df40b9b5bf432a2c839dbbd7443384588 /meson.build | |
parent | a6f5cc854efb4b7dfed7f0a2c1039a9ddd1a35a5 (diff) |
meson: add libatomic dependency
Add conditional dependency on GCC's libatomic in order to be able to
use the __atomic_* functions instead of the older __sync_* ones. The
libatomic library is only needed when there aren't any native support
on the current architecture, so a linker test is used for this
purpose. This makes atomic operations available on a wider number of
architectures including MIPS.
Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Reviewed-by: Simon Ser <simon.ser@intel.com>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/meson.build b/meson.build index b1028ee6..f0cb2543 100644 --- a/meson.build +++ b/meson.build @@ -180,6 +180,20 @@ realtime = cc.find_library('rt') dlsym = cc.find_library('dl') zlib = cc.find_library('z') +if cc.links(''' +#include <stdint.h> +int main(void) { + uint32_t x32 = 0; + uint64_t x64 = 0; + __atomic_load_n(&x32, __ATOMIC_SEQ_CST); + __atomic_load_n(&x64, __ATOMIC_SEQ_CST); + return 0; +}''', name : 'built-in atomics') + libatomic = null_dep +else + libatomic = cc.find_library('atomic') +endif + if cc.has_header('linux/kd.h') config.set('HAVE_LINUX_KD_H', 1) endif |