diff --git a/meson.build b/meson.build index fcb1332b43..42115ec0a8 100644 --- a/meson.build +++ b/meson.build @@ -981,6 +981,16 @@ endif ##################################################################### +libatomic = [] +if not cc.links('''#include + int main() { + char i; + __atomic_exchange_1(&i, 1, 0); + return 1; + }''', + name : 'Atomic builtin requires -latomic') + libatomic = cc.find_library('atomic') +endif threads = dependency('threads') librt = cc.find_library('rt') libm = cc.find_library('m') @@ -2968,7 +2978,7 @@ if conf.get('ENABLE_OOMD') == 1 systemd_oomd_sources, include_directories : includes, link_with : [libshared], - dependencies : [], + dependencies : [libatomic], install_rpath : rootlibexecdir, install : true, install_dir : rootlibexecdir) diff --git a/src/network/meson.build b/src/network/meson.build index 48d185195c..150ef0b3e4 100644 --- a/src/network/meson.build +++ b/src/network/meson.build @@ -280,13 +280,13 @@ tests += [ [['src/network/test-networkd-address.c'], [libnetworkd_core, libsystemd_network], - [], + [libatomic], network_includes], [['src/network/test-networkd-conf.c'], [libnetworkd_core, libsystemd_network], - [], + [libatomic], network_includes], [['src/network/test-networkd-util.c'], diff --git a/src/oom/meson.build b/src/oom/meson.build index 579bc0d4eb..b87ed6c448 100644 --- a/src/oom/meson.build +++ b/src/oom/meson.build @@ -28,5 +28,7 @@ endif tests += [ [['src/oom/test-oomd-util.c', 'src/oom/oomd-util.c', - 'src/oom/oomd-util.h']], + 'src/oom/oomd-util.h'], + [], + [libatomic]], ]