]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1450: MacOS: building fails if clock_gettime() is not available v9.0.1450
authorBram Moolenaar <Bram@vim.org>
Thu, 13 Apr 2023 18:15:54 +0000 (19:15 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 13 Apr 2023 18:15:54 +0000 (19:15 +0100)
Problem:    MacOS: building fails if clock_gettime() is not available.
Solution:   Add a configure check for clock_gettime(). (closes #12242)

src/auto/configure
src/config.h.in
src/configure.ac
src/errors.h
src/evalfunc.c
src/gui.c
src/os_unix.c
src/version.c
src/vim.h

index 77d2f5e6570585c5814ef970e112e8ce38ad36e3..28eb7f33830eb236d256b65a2f51a6be4a98fe2b 100755 (executable)
@@ -12528,7 +12528,8 @@ for ac_func in fchdir fchown fchmod fsync getcwd getpseudotty \
        getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
        sigprocmask sigvec strcasecmp strcoll strerror strftime stricmp strncasecmp \
        strnicmp strpbrk strptime strtol tgetent towlower towupper iswupper \
-       tzset usleep utime utimes mblen ftruncate unsetenv posix_openpt
+       tzset usleep utime utimes mblen ftruncate unsetenv posix_openpt \
+       clock_gettime
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
index 6cb43da125b1e620780befcabb3659601f941e52..d0257ccabeb6a5f945036f228ecbf1f5ab245652 100644 (file)
 #undef HAVE_BIND_TEXTDOMAIN_CODESET
 #undef HAVE_MBLEN
 #undef HAVE_TIMER_CREATE
+#undef HAVE_CLOCK_GETTIME
 
 /* Define, if needed, for accessing large files. */
 #undef _LARGE_FILES
index 0c776a2c422c999fa8f27059332bb8b93689049d..6936ac9b7b14f4dc1ef4192fc46bbe41d03c3044 100644 (file)
@@ -3709,7 +3709,8 @@ AC_CHECK_FUNCS(fchdir fchown fchmod fsync getcwd getpseudotty \
        getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
        sigprocmask sigvec strcasecmp strcoll strerror strftime stricmp strncasecmp \
        strnicmp strpbrk strptime strtol tgetent towlower towupper iswupper \
-       tzset usleep utime utimes mblen ftruncate unsetenv posix_openpt)
+       tzset usleep utime utimes mblen ftruncate unsetenv posix_openpt \
+       clock_gettime)
 AC_FUNC_SELECT_ARGTYPES
 AC_FUNC_FSEEKO
 
index 644b1afb5d3af7932e87795f53205f7e4da6a3c0..f54adc70ff61d9f866fa3299cf2415339142ee72 100644 (file)
@@ -3276,7 +3276,7 @@ EXTERN char e_could_not_clear_timeout_str[]
        INIT(= N_("E1285: Could not clear timeout: %s"));
 EXTERN char e_could_not_set_timeout_str[]
        INIT(= N_("E1286: Could not set timeout: %s"));
-#ifndef HAVE_TIMER_CREATE
+#ifndef PROF_NSEC
 EXTERN char e_could_not_set_handler_for_timeout_str[]
        INIT(= N_("E1287: Could not set handler for timeout: %s"));
 EXTERN char e_could_not_reset_handler_for_timeout_str[]
index 29206b9a345dcee70cadf5e9e410521b660cd6d2..5c10f1ec9bac5252468f87f54a874f35d67b976b 100644 (file)
@@ -6146,7 +6146,7 @@ f_has(typval_T *argvars, typval_T *rettv)
 #endif
                },
        {"prof_nsec",
-#ifdef HAVE_TIMER_CREATE
+#ifdef PROF_NSEC
                1
 #else
                0
index 0e005478a961ace802ddbce26ca54fe1cc2e81a4..e9f951da796b58c944c8e2690a895c157b39a901 100644 (file)
--- a/src/gui.c
+++ b/src/gui.c
@@ -230,7 +230,7 @@ gui_do_fork(void)
     int                exit_status;
     pid_t      pid = -1;
 
-# if defined(FEAT_RELTIME) && defined(HAVE_TIMER_CREATE)
+# if defined(FEAT_RELTIME) && defined(PROF_NSEC)
     // a timer is not carried forward
     delete_timer();
 # endif
index 5801965874edacd05903d7ecea77b7b3ff169a0a..bba5d16e113357df5d9a3a3e474fc7dbf8e026f4 100644 (file)
@@ -8271,7 +8271,7 @@ xsmp_close(void)
 #endif // USE_XSMP
 
 #if defined(FEAT_RELTIME) || defined(PROTO)
-# if defined(HAVE_TIMER_CREATE) || defined(PROTO)
+# if defined(PROF_NSEC) || defined(PROTO)
 /*
  * Implement timeout with timer_create() and timer_settime().
  */
@@ -8371,7 +8371,7 @@ delete_timer(void)
     timer_created = FALSE;
 }
 
-# else // HAVE_TIMER_CREATE
+# else // PROF_NSEC
 
 /*
  * Implement timeout with setitimer()
@@ -8496,5 +8496,5 @@ start_timeout(long msec)
     timer_active = TRUE;
     return &timeout_flag;
 }
-# endif // HAVE_TIMER_CREATE
+# endif // PROF_NSEC
 #endif  // FEAT_RELTIME
index 23b39e7b1f2a17a2406714ec63c9f3caff39963a..ae81daa116f912c065c83d13339739961276cb50 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1450,
 /**/
     1449,
 /**/
index 5289214ec1baf01ad1756cd3fbe5e8ce2d61a1d9..656bcc9dab519045e64e5b3feb7b3cd1dc2c5319 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -1873,7 +1873,8 @@ typedef LARGE_INTEGER proftime_T;
 #  define PROF_TOTALS_HEADER "count  total (s)   self (s)"
 # else
    // Use tv_fsec for fraction of second (micro or nano) of proftime_T
-#  if defined(HAVE_TIMER_CREATE)
+#  if defined(HAVE_TIMER_CREATE) && defined(HAVE_CLOCK_GETTIME)
+#   define PROF_NSEC 1
 typedef struct timespec proftime_T;
 #   define PROF_GET_TIME(tm) clock_gettime(CLOCK_MONOTONIC, tm)
 #   define tv_fsec tv_nsec