]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
Check for more symbols before defining HAVE_CLOCK_MONOTONIC in Meson
authorJordan Williams <jordan@jwillikers.com>
Thu, 6 Oct 2022 13:56:36 +0000 (08:56 -0500)
committerJordan Williams <jordan@jwillikers.com>
Thu, 6 Oct 2022 18:22:06 +0000 (13:22 -0500)
MacOS has limited support for monotonic clock in its pthread implementation.
When building with Meson, `HAVE_MONOTONIC_CLOCK` is defined despite this.
This PR checks for the existence of the missing function `pthread_condattr_setclock`.
To match parity with AutoTools, it also checks for `clock_getres`.

Fixes #419.

meson.build

index 3b5b182c106ffc4762f2520d403f489ad5ed3321..20e9dbc6d53d53c1521a43c42ae94e5cd3b655cf 100644 (file)
@@ -328,7 +328,9 @@ data_config.set('top_builddir', meson.project_build_root())
 threads = dependency('threads')
 config.set(
     'HAVE_MONOTONIC_CLOCK',
-    cc.has_header_symbol('pthread.h', 'CLOCK_MONOTONIC', args: compile_args_c),
+    cc.has_header_symbol('pthread.h', 'CLOCK_MONOTONIC', args: compile_args_c)
+    and cc.has_header_symbol('pthread.h', 'pthread_condattr_setclock', args: compile_args_c)
+    and cc.has_header_symbol('time.h', 'clock_getres', args: compile_args_c),
 )
 
 glib = dependency(