Problem: configure does not actually check whether -lrt is needed for
timer_create(); the test only compiles instead of linking, so
the requirement is missed when cross-compiling
Solution: Use AC_LINK_IFELSE instead of AC_COMPILE_IFELSE for the
timer_create checks so the link actually decides whether -lrt
is required (Jessica Clarke)
AC_COMPILE_IFELSE won't try to link, so if the function exists in the
system headers, we will always detect that -lrt is not needed, as the
code will compile regardless of linker flags. If not cross-compiling,
the following AC_RUN_IFELSE will end up trying to link, so if -lrt is
needed it will fail to link and we will interpret timer_create as not
working, rather than that we just need to link with -lrt. But when we
are cross-compiling we will skip the AC_RUN_IFELSE and assume that it
works, failing to link when we later build if -lrt is in fact needed.
closes: #20605
related:
2cf145b78b88 ("patch 9.1.0837: cross-compiling has some issues")
Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"
+if ac_fn_c_try_link "$LINENO"
then :
vim_cv_timer_create=yes
else case e in #(
;;
esac
fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_timer_create" >&5
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"
+if ac_fn_c_try_link "$LINENO"
then :
vim_cv_timer_create_with_lrt=yes
else case e in #(
;;
esac
fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_timer_create_with_lrt" >&5
dnl Check for timer_create. It probably requires the 'rt' library.
AC_CACHE_CHECK([for timer_create without -lrt], [vim_cv_timer_create], [
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <time.h>
], [
timer_create(CLOCK_MONOTONIC, NULL, NULL);
save_LIBS="$LIBS"
LIBS="$LIBS -lrt"
AC_CACHE_CHECK([for timer_create with -lrt], [vim_cv_timer_create_with_lrt], [
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <time.h>
], [
timer_create(CLOCK_MONOTONIC, NULL, NULL);
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 700,
/**/
699,
/**/