0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 9.0.1450: MacOS: building fails if clock_gettime() is not available

Problem:    MacOS: building fails if clock_gettime() is not available.
Solution:   Add a configure check for clock_gettime(). (closes #12242)
This commit is contained in:
Bram Moolenaar
2023-04-13 19:15:54 +01:00
parent ff6c230051
commit 08210f8def
9 changed files with 15 additions and 9 deletions

3
src/auto/configure vendored
View File

@@ -12528,7 +12528,8 @@ for ac_func in fchdir fchown fchmod fsync getcwd getpseudotty \
getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \ getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
sigprocmask sigvec strcasecmp strcoll strerror strftime stricmp strncasecmp \ sigprocmask sigvec strcasecmp strcoll strerror strftime stricmp strncasecmp \
strnicmp strpbrk strptime strtol tgetent towlower towupper iswupper \ 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 : do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

View File

@@ -225,6 +225,7 @@
#undef HAVE_BIND_TEXTDOMAIN_CODESET #undef HAVE_BIND_TEXTDOMAIN_CODESET
#undef HAVE_MBLEN #undef HAVE_MBLEN
#undef HAVE_TIMER_CREATE #undef HAVE_TIMER_CREATE
#undef HAVE_CLOCK_GETTIME
/* Define, if needed, for accessing large files. */ /* Define, if needed, for accessing large files. */
#undef _LARGE_FILES #undef _LARGE_FILES

View File

@@ -3709,7 +3709,8 @@ AC_CHECK_FUNCS(fchdir fchown fchmod fsync getcwd getpseudotty \
getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \ getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
sigprocmask sigvec strcasecmp strcoll strerror strftime stricmp strncasecmp \ sigprocmask sigvec strcasecmp strcoll strerror strftime stricmp strncasecmp \
strnicmp strpbrk strptime strtol tgetent towlower towupper iswupper \ 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_SELECT_ARGTYPES
AC_FUNC_FSEEKO AC_FUNC_FSEEKO

View File

@@ -3276,7 +3276,7 @@ EXTERN char e_could_not_clear_timeout_str[]
INIT(= N_("E1285: Could not clear timeout: %s")); INIT(= N_("E1285: Could not clear timeout: %s"));
EXTERN char e_could_not_set_timeout_str[] EXTERN char e_could_not_set_timeout_str[]
INIT(= N_("E1286: Could not set timeout: %s")); 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[] EXTERN char e_could_not_set_handler_for_timeout_str[]
INIT(= N_("E1287: Could not set handler for timeout: %s")); INIT(= N_("E1287: Could not set handler for timeout: %s"));
EXTERN char e_could_not_reset_handler_for_timeout_str[] EXTERN char e_could_not_reset_handler_for_timeout_str[]

View File

@@ -6146,7 +6146,7 @@ f_has(typval_T *argvars, typval_T *rettv)
#endif #endif
}, },
{"prof_nsec", {"prof_nsec",
#ifdef HAVE_TIMER_CREATE #ifdef PROF_NSEC
1 1
#else #else
0 0

View File

@@ -230,7 +230,7 @@ gui_do_fork(void)
int exit_status; int exit_status;
pid_t pid = -1; 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 // a timer is not carried forward
delete_timer(); delete_timer();
# endif # endif

View File

@@ -8271,7 +8271,7 @@ xsmp_close(void)
#endif // USE_XSMP #endif // USE_XSMP
#if defined(FEAT_RELTIME) || defined(PROTO) #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(). * Implement timeout with timer_create() and timer_settime().
*/ */
@@ -8371,7 +8371,7 @@ delete_timer(void)
timer_created = FALSE; timer_created = FALSE;
} }
# else // HAVE_TIMER_CREATE # else // PROF_NSEC
/* /*
* Implement timeout with setitimer() * Implement timeout with setitimer()
@@ -8496,5 +8496,5 @@ start_timeout(long msec)
timer_active = TRUE; timer_active = TRUE;
return &timeout_flag; return &timeout_flag;
} }
# endif // HAVE_TIMER_CREATE # endif // PROF_NSEC
#endif // FEAT_RELTIME #endif // FEAT_RELTIME

View File

@@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1450,
/**/ /**/
1449, 1449,
/**/ /**/

View File

@@ -1873,7 +1873,8 @@ typedef LARGE_INTEGER proftime_T;
# define PROF_TOTALS_HEADER "count total (s) self (s)" # define PROF_TOTALS_HEADER "count total (s) self (s)"
# else # else
// Use tv_fsec for fraction of second (micro or nano) of proftime_T // 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; typedef struct timespec proftime_T;
# define PROF_GET_TIME(tm) clock_gettime(CLOCK_MONOTONIC, tm) # define PROF_GET_TIME(tm) clock_gettime(CLOCK_MONOTONIC, tm)
# define tv_fsec tv_nsec # define tv_fsec tv_nsec