summaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-01-31 09:22:59 -0600
committerDudemanguy <random342@airmail.cc>2023-02-02 14:22:09 +0000
commitbf3228142521b0bec633b741c0c97042bb20fe93 (patch)
treed640fe06f14a5f370acd8b8ff571cb6b80908c15 /meson.build
parent7990dd8f3f664e01c984a405dad7c8af320cabf1 (diff)
downloadmpv-bf3228142521b0bec633b741c0c97042bb20fe93.tar.bz2
mpv-bf3228142521b0bec633b741c0c97042bb20fe93.tar.xz
meson: check pthread provider with has_function
Previously, we did this doing code fragments, but we can be a bit more clever and use has_function as well as the platform we're on.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build20
1 files changed, 10 insertions, 10 deletions
diff --git a/meson.build b/meson.build
index 71e78e84e4..6d8a10cdf5 100644
--- a/meson.build
+++ b/meson.build
@@ -521,27 +521,27 @@ features += {'vt.h': cc.has_header_symbol('sys/vt.h', 'VT_GETMODE')}
features += {'consio.h': not features['vt.h'] and cc.has_header_symbol('sys/consio.h', 'VT_GETMODE')}
-fragments = join_paths(source_root, 'waftools', 'fragments')
-
-features += {'glibc-thread-name': cc.compiles(files(join_paths(fragments, 'glibc_thread_name.c')),
- name: 'glibc-thread-name check') and posix}
+# macOS's pthread_setname_np is a special snowflake and differs from literally every other platform.
+features += {'osx-thread-name': darwin}
-features += {'osx-thread-name': false}
-if not features['glibc-thread-name']
- features += {'osx-thread-name': cc.compiles(files(join_paths(fragments, 'osx_thread_name.c')),
- name: 'osx-thread-name check')}
+features += {'glibc-thread-name': false}
+if not features['osx-thread-name']
+ features += {'glibc-thread-name': posix and cc.has_function('pthread_setname_np', args: '-D_GNU_SOURCE',
+ dependencies: pthreads, prefix: '#include <pthread.h>')}
endif
features += {'bsd-thread-name': false}
if not features['osx-thread-name'] and not features['glibc-thread-name']
- features += {'bsd-thread-name': cc.compiles(files(join_paths(fragments, 'bsd_thread_name.c')),
- name: 'bsd-thread-name check')}
+ features += {'bsd-thread-name': posix and cc.has_function('pthread_set_name_np', dependencies: pthreads,
+ prefix: '#include <pthread.h>\n#include <pthread_np.h>')}
endif
features += {'bsd-fstatfs': cc.has_function('fstatfs', prefix: '#include <sys/mount.h>\n#include <sys/param.h>')}
features += {'linux-fstatfs': cc.has_function('fstatfs', prefix: '#include <sys/vfs.h>')}
+fragments = join_paths(source_root, 'waftools', 'fragments')
+
vector = get_option('vector').require(
cc.compiles(files(join_paths(fragments, 'vector.c')), name: 'vector check'),
error_message: 'the compiler does not support gcc vectors!',