summaryrefslogtreecommitdiffstats
path: root/src/configure.ac
diff options
context:
space:
mode:
authorPaul Ollis <paul@cleversheep.org>2022-06-05 16:55:54 +0100
committerBram Moolenaar <Bram@vim.org>2022-06-05 16:55:54 +0100
commit6574577cacd393ab7591fc776ea060eebc939e55 (patch)
treef583ca9957280e7086b8d14ef44127302829fd40 /src/configure.ac
parent1d97db3d987c05af88c30ad20f537bcf3024f9c1 (diff)
patch 8.2.5057: using gettimeofday() for timeout is very inefficientv8.2.5057
Problem: Using gettimeofday() for timeout is very inefficient. Solution: Set a platform dependent timer. (Paul Ollis, closes #10505)
Diffstat (limited to 'src/configure.ac')
-rw-r--r--src/configure.ac40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/configure.ac b/src/configure.ac
index 913129f665..a6a926e681 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -1,7 +1,8 @@
dnl configure.ac: autoconf script for Vim
-dnl Process this file with autoconf 2.12 or 2.13 to produce "configure".
-dnl Should also work with autoconf 2.54 and later.
+dnl Process this file with autoconf 2.69 to produce "configure".
+dnl This should also work with other versions of autoconf, but 2.70 and later
+dnl generate lots of hard to fix "obsolete" warnings.
AC_INIT(vim.h)
AC_CONFIG_HEADER(auto/config.h:config.h.in)
@@ -3812,6 +3813,41 @@ AC_TRY_COMPILE(
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
AC_MSG_RESULT(no))
+dnl Check for timer_create. It probably requires the 'rt' library.
+AC_MSG_CHECKING([for timer_create])
+save_LIBS="$LIBS"
+LIBS="$LIBS -lrt"
+AC_TRY_LINK([
+#include<signal.h>
+#include<time.h>
+static void set_flag(union sigval) {}
+], [
+ struct timespec ts;
+ struct sigevent action = {0};
+ timer_t timer_id;
+
+ action.sigev_notify = SIGEV_THREAD;
+ action.sigev_notify_function = set_flag;
+ timer_create(CLOCK_REALTIME, &action, &timer_id);
+ ],
+ AC_MSG_RESULT(yes; with -lrt); AC_DEFINE(HAVE_TIMER_CREATE),
+ LIBS="$save_LIBS"
+ AC_TRY_LINK([
+#include<signal.h>
+#include<time.h>
+static void set_flag(union sigval) {}
+ ], [
+ struct timespec ts;
+ struct sigevent action = {0};
+ timer_t timer_id;
+
+ action.sigev_notify = SIGEV_THREAD;
+ action.sigev_notify_function = set_flag;
+ timer_create(CLOCK_REALTIME, &action, &timer_id);
+ ],
+ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIMER_CREATE),
+ AC_MSG_RESULT(no)))
+
AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
[
AC_RUN_IFELSE([AC_LANG_SOURCE([[