]> granicus.if.org Git - libevent/commitdiff
Adding option to ignore clock_gettime: --disable-clock-gettime
authorVlad Shcherban <shchvova@gmail.com>
Thu, 29 Sep 2016 22:31:53 +0000 (18:31 -0400)
committerAzat Khuzhin <a3at.mail@gmail.com>
Mon, 3 Oct 2016 00:16:20 +0000 (03:16 +0300)
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

index 074832427754d24bfab987f4009ae6ca0841a521..d4c0d68014c1b7aa26c2a407dd687b603ab0959a 100644 (file)
@@ -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 \