]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0700: configure: -lrt requirement for timer_create not detected v9.2.0700
authorJessica Clarke <jrtc27@jrtc27.com>
Mon, 22 Jun 2026 17:58:04 +0000 (17:58 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 22 Jun 2026 17:58:04 +0000 (17:58 +0000)
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>
src/auto/configure
src/configure.ac
src/version.c

index a20eea1667722f7632cc01193157744afc60e70e..f5d6dea01ca24ea5bdd2c3a076fbb772ab0c68c0 100755 (executable)
@@ -15078,7 +15078,7 @@ main (void)
   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 #(
@@ -15086,7 +15086,8 @@ 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
@@ -15117,7 +15118,7 @@ main (void)
   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 #(
@@ -15125,7 +15126,8 @@ 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
index 710cb317fcaf8f9e4d00610f4c6febd1f6a73243..b71e553394b139b97431f10fa8ff144bb9fa5bcb 100644 (file)
@@ -4037,7 +4037,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
 
 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);
@@ -4051,7 +4051,7 @@ if test "x$vim_cv_timer_create" = "xno" ; then
   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);
index b93bdd9e1c01460b700075780fba8bd12f315d79..ddd8a02ca6b3c0bd756b1d2b39c930a6503e632a 100644 (file)
@@ -759,6 +759,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    700,
 /**/
     699,
 /**/