comparison src/configure.ac @ 29523:1733b6162f75 v9.0.0103

patch 9.0.0103: if running configure with cached results -lrt may be missing Commit: https://github.com/vim/vim/commit/efffa5360ebb2b6919c5eb1998c5df4c8849a407 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jul 28 22:39:54 2022 +0100 patch 9.0.0103: if running configure with cached results -lrt may be missing Problem: If running configure with cached results -lrt may be missing. Solution: Use two cache variables, one without and one with -lrt. (closes #10799) Swap checks to avoid adding -lrt unnecessarily.
author Bram Moolenaar <Bram@vim.org>
date Thu, 28 Jul 2022 23:45:02 +0200
parents e6d788e0c121
children e491e48757d7
comparison
equal deleted inserted replaced
29522:1deb9ffc5948 29523:1733b6162f75
3805 AC_MSG_RESULT(no)) 3805 AC_MSG_RESULT(no))
3806 3806
3807 dnl Check for timer_create. It probably requires the 'rt' library. 3807 dnl Check for timer_create. It probably requires the 'rt' library.
3808 dnl Run the program to find out if timer_create(CLOCK_MONOTONIC) actually 3808 dnl Run the program to find out if timer_create(CLOCK_MONOTONIC) actually
3809 dnl works, on Solaris timer_create() exists but fails at runtime. 3809 dnl works, on Solaris timer_create() exists but fails at runtime.
3810 AC_CACHE_CHECK([for timer_create], [vim_cv_timer_create], [ 3810 AC_CACHE_CHECK([for timer_create without -lrt], [vim_cv_timer_create], [
3811 save_LIBS="$LIBS"
3812 LIBS="$LIBS -lrt"
3813 AC_RUN_IFELSE([AC_LANG_PROGRAM([ 3811 AC_RUN_IFELSE([AC_LANG_PROGRAM([
3814 #if STDC_HEADERS 3812 #if STDC_HEADERS
3815 # include <stdlib.h> 3813 # include <stdlib.h>
3816 # include <stddef.h> 3814 # include <stddef.h>
3817 #endif 3815 #endif
3826 action.sigev_notify = SIGEV_THREAD; 3824 action.sigev_notify = SIGEV_THREAD;
3827 action.sigev_notify_function = set_flag; 3825 action.sigev_notify_function = set_flag;
3828 if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0) 3826 if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
3829 exit(1); // cannot create a monotonic timer 3827 exit(1); // cannot create a monotonic timer
3830 ])], 3828 ])],
3831 AC_MSG_NOTICE(timer_create with -lrt); vim_cv_timer_create=yes, 3829 vim_cv_timer_create=yes,
3830 vim_cv_timer_create=no,
3831 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_timer_create')
3832 )])
3833
3834 dnl If the previous failed, check for timer_create() and linking with -lrt.
3835 if test "x$vim_cv_timer_create" = "xno" ; then
3836 save_LIBS="$LIBS"
3837 LIBS="$LIBS -lrt"
3838 AC_CACHE_CHECK([for timer_create with -lrt], [vim_cv_timer_create_with_lrt], [
3839 AC_RUN_IFELSE([AC_LANG_PROGRAM([
3840 #if STDC_HEADERS
3841 # include <stdlib.h>
3842 # include <stddef.h>
3843 #endif
3844 #include <signal.h>
3845 #include <time.h>
3846 static void set_flag(union sigval sv) {}
3847 ], [
3848 struct timespec ts;
3849 struct sigevent action = {0};
3850 timer_t timer_id;
3851
3852 action.sigev_notify = SIGEV_THREAD;
3853 action.sigev_notify_function = set_flag;
3854 if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
3855 exit(1); // cannot create a monotonic timer
3856 ])],
3857 vim_cv_timer_create_with_lrt=yes,
3858 vim_cv_timer_create_with_lrt=no,
3859 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_timer_create_with_lrt')
3860 )])
3832 LIBS="$save_LIBS" 3861 LIBS="$save_LIBS"
3833 AC_RUN_IFELSE([AC_LANG_PROGRAM([ 3862 else
3834 #if STDC_HEADERS 3863 vim_cv_timer_create_with_lrt=no
3835 # include <stdlib.h> 3864 fi
3836 # include <stddef.h>
3837 #endif
3838 #include<signal.h>
3839 #include<time.h>
3840 static void set_flag(union sigval sv) {}
3841 ], [
3842 struct timespec ts;
3843 struct sigevent action = {0};
3844 timer_t timer_id;
3845
3846 action.sigev_notify = SIGEV_THREAD;
3847 action.sigev_notify_function = set_flag;
3848 if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
3849 exit(1); // cannot create a monotonic timer
3850 ])],
3851 vim_cv_timer_create=yes,
3852 vim_cv_timer_create=no),
3853 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_timer_create')
3854 )]
3855 )
3856 3865
3857 if test "x$vim_cv_timer_create" = "xyes" ; then 3866 if test "x$vim_cv_timer_create" = "xyes" ; then
3858 AC_DEFINE(HAVE_TIMER_CREATE) 3867 AC_DEFINE(HAVE_TIMER_CREATE)
3859 fi 3868 fi
3860 3869 if test "x$vim_cv_timer_create_with_lrt" = "xyes" ; then
3870 AC_DEFINE(HAVE_TIMER_CREATE)
3871 LIBS="$LIBS -lrt"
3872 fi
3861 3873
3862 AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash], 3874 AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
3863 [ 3875 [
3864 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 3876 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3865 #include "confdefs.h" 3877 #include "confdefs.h"