Patch 9.0.1450
Problem:    MacOS: building fails if clock_gettime() is not available.
Solution:   Add a configure check for clock_gettime(). (closes #12242)
Files:      src/configure.ac, src/auto/configure, src/config.h.in, src/vim.h,
            src/evalfunc.c, src/gui.c, src/os_unix.c, src/errors.h


*** ../vim-9.0.1449/src/configure.ac    2023-04-12 16:23:59.456592887 +0100
--- src/configure.ac    2023-04-13 18:58:20.039579526 +0100
***************
*** 3709,3715 ****
        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)
  AC_FUNC_SELECT_ARGTYPES
  AC_FUNC_FSEEKO
  
--- 3709,3716 ----
        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 \
!       clock_gettime)
  AC_FUNC_SELECT_ARGTYPES
  AC_FUNC_FSEEKO
  
*** ../vim-9.0.1449/src/auto/configure  2023-04-12 16:23:59.460592878 +0100
--- src/auto/configure  2023-04-13 19:03:17.303423331 +0100
***************
*** 12528,12534 ****
        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
  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"
--- 12528,12535 ----
        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 \
!       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"
*** ../vim-9.0.1449/src/config.h.in     2022-12-30 10:42:19.766143906 +0000
--- src/config.h.in     2023-04-13 18:59:05.651555229 +0100
***************
*** 225,230 ****
--- 225,231 ----
  #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
*** ../vim-9.0.1449/src/vim.h   2023-03-16 21:43:07.343227878 +0000
--- src/vim.h   2023-04-13 19:00:58.651495598 +0100
***************
*** 1873,1879 ****
  #  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)
  typedef struct timespec proftime_T;
  #   define PROF_GET_TIME(tm) clock_gettime(CLOCK_MONOTONIC, tm)
  #   define tv_fsec tv_nsec
--- 1873,1880 ----
  #  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) && 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
*** ../vim-9.0.1449/src/evalfunc.c      2023-03-16 21:43:07.343227878 +0000
--- src/evalfunc.c      2023-04-13 19:01:07.951490726 +0100
***************
*** 6146,6152 ****
  #endif
                },
        {"prof_nsec",
! #ifdef HAVE_TIMER_CREATE
                1
  #else
                0
--- 6146,6152 ----
  #endif
                },
        {"prof_nsec",
! #ifdef PROF_NSEC
                1
  #else
                0
*** ../vim-9.0.1449/src/gui.c   2023-02-19 20:49:35.159795893 +0000
--- src/gui.c   2023-04-13 19:01:56.411465390 +0100
***************
*** 230,236 ****
      int               exit_status;
      pid_t     pid = -1;
  
! # if defined(FEAT_RELTIME) && defined(HAVE_TIMER_CREATE)
      // a timer is not carried forward
      delete_timer();
  # endif
--- 230,236 ----
      int               exit_status;
      pid_t     pid = -1;
  
! # if defined(FEAT_RELTIME) && defined(PROF_NSEC)
      // a timer is not carried forward
      delete_timer();
  # endif
*** ../vim-9.0.1449/src/os_unix.c       2023-03-12 21:20:51.441254187 +0000
--- src/os_unix.c       2023-04-13 19:02:39.559442909 +0100
***************
*** 8271,8277 ****
  #endif // USE_XSMP
  
  #if defined(FEAT_RELTIME) || defined(PROTO)
! # if defined(HAVE_TIMER_CREATE) || defined(PROTO)
  /*
   * Implement timeout with timer_create() and timer_settime().
   */
--- 8271,8277 ----
  #endif // USE_XSMP
  
  #if defined(FEAT_RELTIME) || defined(PROTO)
! # if defined(PROF_NSEC) || defined(PROTO)
  /*
   * Implement timeout with timer_create() and timer_settime().
   */
***************
*** 8371,8377 ****
      timer_created = FALSE;
  }
  
! # else // HAVE_TIMER_CREATE
  
  /*
   * Implement timeout with setitimer()
--- 8371,8377 ----
      timer_created = FALSE;
  }
  
! # else // PROF_NSEC
  
  /*
   * Implement timeout with setitimer()
***************
*** 8496,8500 ****
      timer_active = TRUE;
      return &timeout_flag;
  }
! # endif // HAVE_TIMER_CREATE
  #endif  // FEAT_RELTIME
--- 8496,8500 ----
      timer_active = TRUE;
      return &timeout_flag;
  }
! # endif // PROF_NSEC
  #endif  // FEAT_RELTIME
*** ../vim-9.0.1449/src/errors.h        2023-03-12 21:20:51.437254187 +0000
--- src/errors.h        2023-04-13 19:02:56.827433927 +0100
***************
*** 3276,3282 ****
        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
  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[]
--- 3276,3282 ----
        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 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[]
*** ../vim-9.0.1449/src/version.c       2023-04-13 17:32:19.025560263 +0100
--- src/version.c       2023-04-13 18:47:37.499945827 +0100
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1450,
  /**/

-- 
BROTHER MAYNARD: Armaments Chapter Two Verses Nine to Twenty One.
ANOTHER MONK:    And St.  Attila raised his hand grenade up on high saying "O
                 Lord bless this thy hand grenade that with it thou mayest
                 blow thine enemies to tiny bits, in thy mercy. "and the Lord
                 did grin and people did feast upon the lambs and sloths and
                 carp and anchovies and orang-utans and breakfast cereals and
                 fruit bats and...
BROTHER MAYNARD: Skip a bit brother ...
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230413181624.1E3571C0A7C%40moolenaar.net.

Raspunde prin e-mail lui