From adc402ba5f0e15f4c77505852507f33b50f37ab6 Mon Sep 17 00:00:00 2001 From: Vlad Shcherban Date: Thu, 29 Sep 2016 18:31:53 -0400 Subject: [PATCH 1/2] Adding option to ignore clock_gettime: --disable-clock-gettime macOS 10.12 introduced `clock_gettime` to libsystem. This means, built on OS X 10.12 application would crash on earlier versions of OS X because it will try to call clock_gettime. This options is useful to make backwards compatible macOS apps. Fixes: #398 Fixes: #399 Fixes: #400 --- configure.ac | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 0748324277..d4c0d68014 100644 --- a/configure.ac +++ b/configure.ac @@ -132,6 +132,9 @@ AC_ARG_ENABLE([function-sections], AC_ARG_ENABLE([verbose-debug], AS_HELP_STRING([--enable-verbose-debug, verbose debug logging]), [], [enable_verbose_debug=no]) +AC_ARG_ENABLE([clock-gettime], + AS_HELP_STRING(--disable-clock-gettime, do not use clock_gettime even if it is available), + [], [enable_clock_gettime=yes]) AC_PROG_LIBTOOL @@ -149,7 +152,10 @@ 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]) +if test "x$enable_clock_gettime" = "xyes"; then + AC_SEARCH_LIBS([clock_gettime], [rt]) + AC_CHECK_FUNCS([clock_gettime]) +fi AC_SEARCH_LIBS([sendfile], [sendfile]) dnl - check if the macro _WIN32 is defined on this compiler. @@ -347,7 +353,6 @@ AC_CHECK_FUNCS([ \ accept4 \ arc4random \ arc4random_buf \ - clock_gettime \ eventfd \ epoll_create1 \ fcntl \ From 91559607fd5525df468c8be44ef2352b8ea3e495 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 3 Oct 2016 03:17:18 +0300 Subject: [PATCH 2/2] Add -DEVENT__DISABLE_CLOCK_GETTIME switch for cmake See-also: adc402ba5f0e15f4c77505852507f33b50f37ab6 ("Adding option to ignore clock_gettime: --disable-clock-gettime") --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9ca7e8b91..3e1183c20b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,6 +130,9 @@ option(EVENT__DISABLE_REGRESS option(EVENT__DISABLE_SAMPLES "Disable sample files" OFF) +option(EVENT__DISABLE_CLOCK_GETTIME + "Do not use clock_gettime even if it is available" OFF) + option(EVENT__FORCE_KQUEUE_CHECK "When crosscompiling forces running a test program that verifies that Kqueue works with pipes. Note that this requires you to manually run the test program on the the cross compilation target to verify that it works. See cmake documentation for try_run for more details" OFF) @@ -298,7 +301,9 @@ CHECK_INCLUDE_FILE(errno.h EVENT__HAVE_ERRNO_H) CHECK_FUNCTION_EXISTS_EX(epoll_create EVENT__HAVE_EPOLL) CHECK_FUNCTION_EXISTS_EX(epoll_ctl EVENT__HAVE_EPOLL_CTL) CHECK_FUNCTION_EXISTS_EX(eventfd EVENT__HAVE_EVENTFD) -CHECK_FUNCTION_EXISTS_EX(clock_gettime EVENT__HAVE_CLOCK_GETTIME) +if(NOT EVENT__DISABLE_CLOCK_GETTIME) + CHECK_FUNCTION_EXISTS_EX(clock_gettime EVENT__HAVE_CLOCK_GETTIME) +endif() CHECK_FUNCTION_EXISTS_EX(fcntl EVENT__HAVE_FCNTL) CHECK_FUNCTION_EXISTS_EX(getaddrinfo EVENT__HAVE_GETADDRINFO) CHECK_FUNCTION_EXISTS_EX(getnameinfo EVENT__HAVE_GETNAMEINFO)