From 06a3629bec77915df0ed6b4b64ce8846ccdfcc1e Mon Sep 17 00:00:00 2001 From: Jean Guyomarc'h Date: Sat, 1 Oct 2016 17:32:13 +0200 Subject: [PATCH] tests: check for the presence of clock_gettime() macOS Sierra provides clock_gettime(). Instead of testing for the Mach kernel to re-implement clock_gettime(), let first check that clock_gettime() is not already declared. Older OSX versions will have the Mach-only fallback. @fix --- src/tests/eina/eina_test_lock.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/tests/eina/eina_test_lock.c b/src/tests/eina/eina_test_lock.c index 02d5810a63..101d73c2da 100644 --- a/src/tests/eina/eina_test_lock.c +++ b/src/tests/eina/eina_test_lock.c @@ -26,11 +26,13 @@ #include "eina_suite.h" -#ifdef __MACH__ -# include -# include +#ifndef HAVE_CLOCK_GETTIME -#define CLOCK_REALTIME 0 +# ifdef __MACH__ +# include +# include + +# define CLOCK_REALTIME 0 int clock_gettime(int mode, struct timespec* ts) @@ -51,7 +53,11 @@ clock_gettime(int mode, struct timespec* ts) return 0; } -#endif +# else /* ! __MACH__ */ +# error No support for clock_gettime() +# endif /* __MACH__ *// + +#endif /* ! HAVE_CLOCK_GETTIME */ static Eina_Spinlock spin; static Eina_Thread thread;