Skip to content

Commit

Permalink
Avoid clock_gettime() usage on MacOS
Browse files Browse the repository at this point in the history
The function is present in Sierra, but not on previous OS versions,
although the linker doesn't complain when `-mmacosx-version-min=`
mentions that we want to support OSX < 10.12.

So, just pretend it doesn't exist, and remember to remove that
hack the day everyone is running OSX >= 10.12.

Via an issue from @Thireus
  • Loading branch information
jedisct1 committed Feb 9, 2017
1 parent c6f42a8 commit 449d0f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 5 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,11 @@ dnl Checks for library functions.

AC_SEARCH_LIBS(pow, [m])
AC_SEARCH_LIBS(dlopen, [dl])
AC_SEARCH_LIBS(clock_gettime, [rt],
[AC_DEFINE(HAVE_CLOCK_GETTIME,[1],[define if you have clock_gettime()])])

AS_IF([test "$host_vendor" = "apple"], [],[
AC_SEARCH_LIBS(clock_gettime, [rt],
[AC_DEFINE(HAVE_CLOCK_GETTIME,[1],[define if you have clock_gettime()])])
])

AC_SEARCH_LIBS(backtrace, [execinfo],
[AC_DEFINE(HAVE_BACKTRACE,[1],[define if you have backtrace()])])
Expand Down
8 changes: 6 additions & 2 deletions src/libevent-modified/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ dnl Checks for libraries.
AC_SEARCH_LIBS([inet_ntoa], [nsl])
AC_SEARCH_LIBS([socket], [socket])
AC_SEARCH_LIBS([inet_aton], [resolv])
AC_SEARCH_LIBS([clock_gettime], [rt])

AS_IF([test "$host_vendor" = "apple"], [],[
AC_SEARCH_LIBS([clock_gettime], [rt])
])

AC_SEARCH_LIBS([sendfile], [sendfile])

dnl - check if the macro WIN32 is defined on this compiler.
Expand Down Expand Up @@ -291,7 +295,7 @@ AC_C_INLINE
AC_HEADER_TIME

dnl Checks for library functions.
AC_CHECK_FUNCS([gettimeofday vasprintf fcntl clock_gettime strtok_r strsep])
AC_CHECK_FUNCS([gettimeofday vasprintf fcntl strtok_r strsep])
AC_CHECK_FUNCS([getnameinfo strlcpy inet_ntop inet_pton signal sigaction strtoll inet_aton pipe eventfd sendfile mmap splice arc4random arc4random_buf arc4random_addrandom issetugid geteuid getegid getprotobynumber setenv unsetenv putenv sysctl])
AC_CHECK_FUNCS([umask])

Expand Down

0 comments on commit 449d0f0

Please sign in to comment.