Fixes #105: 1.0.0 clock_gettime runtime failure built with macOS 10.11 and Xcode 8.x

XCode 8 SDK declares clock_gettime() but macOS 10.11 and earlier do not
actually implement it. So just checking for a clock_gettime()
declaration in configure is insufficient.

Instead, do AC_SEARCH_LIBS first to check if -lrt is required, then use
AC_CHECK_FUNCS to check for clock_gettime() availability.
This commit is contained in:
Alexey Kopytov
2017-02-05 10:31:41 +01:00
parent f964f5bc1c
commit 481a9fa34a

View File

@ -330,13 +330,6 @@ AC_CHECK_SIZEOF(size_t)
AC_FUNC_MMAP
AC_FUNC_STRERROR_R
AC_CHECK_DECL([clock_gettime],
AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Define if you have clock_gettime() declared in <time.h>]),,
[
#define _XOPEN_SOURCE 500
#include <time.h>
]
)
AC_SEARCH_LIBS([clock_gettime], [rt])
save_CFLAGS="$CFLAGS"
@ -346,6 +339,7 @@ LIBS="$PTHREAD_LIBS $LIBS"
AC_CHECK_FUNCS([ \
alarm \
clock_gettime \
directio \
fdatasync \
gettimeofday \