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
This commit is contained in:
Jean Guyomarc'h 2016-10-01 17:32:13 +02:00
parent 00b0501424
commit 06a3629bec
1 changed files with 11 additions and 5 deletions

View File

@ -26,11 +26,13 @@
#include "eina_suite.h"
#ifdef __MACH__
# include <mach/clock.h>
# include <mach/mach.h>
#ifndef HAVE_CLOCK_GETTIME
#define CLOCK_REALTIME 0
# ifdef __MACH__
# include <mach/clock.h>
# include <mach/mach.h>
# 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;