1
0
forked from aniani/vim

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.
This commit is contained in:
Bram Moolenaar
2022-07-28 22:39:54 +01:00
parent a6f9e30016
commit efffa5360e
3 changed files with 103 additions and 74 deletions

107
src/auto/configure vendored
View File

@@ -13037,14 +13037,12 @@ $as_echo "no" >&6; }
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for timer_create" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for timer_create without -lrt" >&5
$as_echo_n "checking for timer_create... " >&6; } $as_echo_n "checking for timer_create without -lrt... " >&6; }
if ${vim_cv_timer_create+:} false; then : if ${vim_cv_timer_create+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
save_LIBS="$LIBS"
LIBS="$LIBS -lrt"
if test "$cross_compiling" = yes; then : if test "$cross_compiling" = yes; then :
as_fn_error $? "cross-compiling: please set 'vim_cv_timer_create'" "$LINENO" 5 as_fn_error $? "cross-compiling: please set 'vim_cv_timer_create'" "$LINENO" 5
@@ -13077,45 +13075,6 @@ main ()
return 0; return 0;
} }
_ACEOF _ACEOF
if ac_fn_c_try_run "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: timer_create with -lrt" >&5
$as_echo "$as_me: timer_create with -lrt" >&6;}; vim_cv_timer_create=yes
else
LIBS="$save_LIBS"
if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#endif
#include<signal.h>
#include<time.h>
static void set_flag(union sigval sv) {}
int
main ()
{
struct timespec ts;
struct sigevent action = {0};
timer_t timer_id;
action.sigev_notify = SIGEV_THREAD;
action.sigev_notify_function = set_flag;
if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
exit(1); // cannot create a monotonic timer
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then : if ac_fn_c_try_run "$LINENO"; then :
vim_cv_timer_create=yes vim_cv_timer_create=yes
else else
@@ -13125,21 +13084,77 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext conftest.$ac_objext conftest.beam conftest.$ac_ext
fi fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vim_cv_timer_create" >&5
$as_echo "$vim_cv_timer_create" >&6; }
if test "x$vim_cv_timer_create" = "xno" ; then
save_LIBS="$LIBS"
LIBS="$LIBS -lrt"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for timer_create with -lrt" >&5
$as_echo_n "checking for timer_create with -lrt... " >&6; }
if ${vim_cv_timer_create_with_lrt+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
as_fn_error $? "cross-compiling: please set 'vim_cv_timer_create_with_lrt'" "$LINENO" 5
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#endif
#include <signal.h>
#include <time.h>
static void set_flag(union sigval sv) {}
int
main ()
{
struct timespec ts;
struct sigevent action = {0};
timer_t timer_id;
action.sigev_notify = SIGEV_THREAD;
action.sigev_notify_function = set_flag;
if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
exit(1); // cannot create a monotonic timer
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
vim_cv_timer_create_with_lrt=yes
else
vim_cv_timer_create_with_lrt=no
fi fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext conftest.$ac_objext conftest.beam conftest.$ac_ext
fi fi
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vim_cv_timer_create" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vim_cv_timer_create_with_lrt" >&5
$as_echo "$vim_cv_timer_create" >&6; } $as_echo "$vim_cv_timer_create_with_lrt" >&6; }
LIBS="$save_LIBS"
else
vim_cv_timer_create_with_lrt=no
fi
if test "x$vim_cv_timer_create" = "xyes" ; then if test "x$vim_cv_timer_create" = "xyes" ; then
$as_echo "#define HAVE_TIMER_CREATE 1" >>confdefs.h $as_echo "#define HAVE_TIMER_CREATE 1" >>confdefs.h
fi fi
if test "x$vim_cv_timer_create_with_lrt" = "xyes" ; then
$as_echo "#define HAVE_TIMER_CREATE 1" >>confdefs.h
LIBS="$LIBS -lrt"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat() ignores a trailing slash" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat() ignores a trailing slash" >&5
$as_echo_n "checking whether stat() ignores a trailing slash... " >&6; } $as_echo_n "checking whether stat() ignores a trailing slash... " >&6; }

View File

@@ -3807,9 +3807,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
dnl Check for timer_create. It probably requires the 'rt' library. dnl Check for timer_create. It probably requires the 'rt' library.
dnl Run the program to find out if timer_create(CLOCK_MONOTONIC) actually dnl Run the program to find out if timer_create(CLOCK_MONOTONIC) actually
dnl works, on Solaris timer_create() exists but fails at runtime. dnl works, on Solaris timer_create() exists but fails at runtime.
AC_CACHE_CHECK([for timer_create], [vim_cv_timer_create], [ AC_CACHE_CHECK([for timer_create without -lrt], [vim_cv_timer_create], [
save_LIBS="$LIBS"
LIBS="$LIBS -lrt"
AC_RUN_IFELSE([AC_LANG_PROGRAM([ AC_RUN_IFELSE([AC_LANG_PROGRAM([
#if STDC_HEADERS #if STDC_HEADERS
# include <stdlib.h> # include <stdlib.h>
@@ -3828,36 +3826,50 @@ static void set_flag(union sigval sv) {}
if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0) if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
exit(1); // cannot create a monotonic timer exit(1); // cannot create a monotonic timer
])], ])],
AC_MSG_NOTICE(timer_create with -lrt); vim_cv_timer_create=yes, vim_cv_timer_create=yes,
LIBS="$save_LIBS" vim_cv_timer_create=no,
AC_RUN_IFELSE([AC_LANG_PROGRAM([ AC_MSG_ERROR(cross-compiling: please set 'vim_cv_timer_create')
#if STDC_HEADERS )])
# include <stdlib.h>
# include <stddef.h>
#endif
#include<signal.h>
#include<time.h>
static void set_flag(union sigval sv) {}
], [
struct timespec ts;
struct sigevent action = {0};
timer_t timer_id;
action.sigev_notify = SIGEV_THREAD; dnl If the previous failed, check for timer_create() and linking with -lrt.
action.sigev_notify_function = set_flag; if test "x$vim_cv_timer_create" = "xno" ; then
if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0) save_LIBS="$LIBS"
exit(1); // cannot create a monotonic timer LIBS="$LIBS -lrt"
])], AC_CACHE_CHECK([for timer_create with -lrt], [vim_cv_timer_create_with_lrt], [
vim_cv_timer_create=yes, AC_RUN_IFELSE([AC_LANG_PROGRAM([
vim_cv_timer_create=no), #if STDC_HEADERS
AC_MSG_ERROR(cross-compiling: please set 'vim_cv_timer_create') # include <stdlib.h>
)] # include <stddef.h>
) #endif
#include <signal.h>
#include <time.h>
static void set_flag(union sigval sv) {}
], [
struct timespec ts;
struct sigevent action = {0};
timer_t timer_id;
action.sigev_notify = SIGEV_THREAD;
action.sigev_notify_function = set_flag;
if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
exit(1); // cannot create a monotonic timer
])],
vim_cv_timer_create_with_lrt=yes,
vim_cv_timer_create_with_lrt=no,
AC_MSG_ERROR(cross-compiling: please set 'vim_cv_timer_create_with_lrt')
)])
LIBS="$save_LIBS"
else
vim_cv_timer_create_with_lrt=no
fi
if test "x$vim_cv_timer_create" = "xyes" ; then if test "x$vim_cv_timer_create" = "xyes" ; then
AC_DEFINE(HAVE_TIMER_CREATE) AC_DEFINE(HAVE_TIMER_CREATE)
fi fi
if test "x$vim_cv_timer_create_with_lrt" = "xyes" ; then
AC_DEFINE(HAVE_TIMER_CREATE)
LIBS="$LIBS -lrt"
fi
AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash], AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
[ [

View File

@@ -735,6 +735,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 */
/**/
103,
/**/ /**/
102, 102,
/**/ /**/