Skip to content

Check for more symbols before defining HAVE_CLOCK_MONOTONIC in Meson

Jordan Williams requested to merge jwillikers/dbus:meson-monotonic-macos into master

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 (closed).

Checks correctly detect the missing symbol pthread_condattr_setclock on macOS:

Header "pthread.h" has symbol "CLOCK_MONOTONIC" : YES 
Header "pthread.h" has symbol "pthread_condattr_setclock" : NO 

Checks correctly detect monotonic support on Linux:

Header "pthread.h" has symbol "CLOCK_MONOTONIC" : YES (cached)
Header "pthread.h" has symbol "pthread_condattr_setclock" : YES (cached)
Header "pthread.h" has symbol "clock_getres" : YES (cached)
Edited by Jordan Williams

Merge request reports