summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2022-11-20 20:37:12 -0600
committersfan5 <sfan5@live.de>2023-01-24 15:56:56 +0100
commit37869fbcd72621eb036d51edb6f327160b98e0bf (patch)
tree1ee6f60f4a8a49cb02d0dcbe84ea46835bfca268
parent954d53612c541d6cc22fedf43fa5c8d119847e78 (diff)
downloadmpv-37869fbcd72621eb036d51edb6f327160b98e0bf.tar.bz2
mpv-37869fbcd72621eb036d51edb6f327160b98e0bf.tar.xz
meson: fix stdatomic detection on bsd
BSDs use compiler-rt instead of libatomic for atomic types. In this case, we can handle it similar to how dl is detected. Check for the library (allowing for it to fail), and then check for a header symbol while linking latomic. Fixes #10906.
-rw-r--r--meson.build7
1 files changed, 4 insertions, 3 deletions
diff --git a/meson.build b/meson.build
index c2916d5fb9..0eb10d4fe1 100644
--- a/meson.build
+++ b/meson.build
@@ -716,10 +716,11 @@ if features['sdl2-gamepad']
sources += files('input/sdl_gamepad.c')
endif
-stdatomic = cc.find_library('atomic', required: get_option('stdatomic'))
-features += {'stdatomic': stdatomic.found()}
+stdatomic_dep = cc.find_library('atomic', required: false)
+features += {'stdatomic': cc.has_header_symbol('stdatomic.h', 'atomic_int', dependencies: stdatomic_dep,
+ required: get_option('stdatomic'))}
if features['stdatomic']
- dependencies += stdatomic
+ dependencies += stdatomic_dep
endif
uchardet_opt = get_option('uchardet').require(