patch 9.1.0946: cross-compiling fails on osx-arm64

Commit: 
https://github.com/vim/vim/commit/cbdc3c1f7a534ca845675544f88021ed7b1af52c
Author: Brandon Maier <brandon.ma...@gmail.com>
Date:   Wed Dec 18 21:18:01 2024 +0100

    patch 9.1.0946: cross-compiling fails on osx-arm64
    
    Problem:  cross-compiling fails on osx-arm64
    Solution: use vim_cv_timer_create_with_lrt() instead of
              vim_cv_timer_create_works() (Brandon Maier)
    
    Cross-compiling to osx-arm64 fails with the following
    
      In file included from json.c:17:
      In file included from ./vim.h:457:
      ./macros.h:304:24: error: expected identifier or '('
        304 |      static inline int isnan(double x)
            |                        ^
      .../MacOSX11.0.sdk/usr/include/math.h:165:7: note: expanded from macro 
'isnan'
        165 |     ( sizeof(x) == sizeof(float)  ? __inline_isnanf((float)(x))
            |       ^
    
    This can be traced back to ./configure incorrectly detecting the
    compiler support for `isnan()`, from the config.log:
    
      configure:14567: checking for isnan()
      configure:14588: arm64-apple-darwin20.0.0-clang <...> -L$PREFIX/lib 
conftest.c  -lncurses -ltinfo -lrt >&5
      ld: library not found for -lrt
      arm64-apple-darwin20.0: error: linker command failed with exit code 1 
(use -v to see invocation)
    
    The `-lrt` linking is added by ./configure script when it detects
    compiler support for `timer_create()`. On the osx-arm64 platform
    `timer_create()` works but does not link with `-lrt`. This results in
    the following settings from config.log:
    
      vim_cv_timer_create=yes
      vim_cv_timer_create_with_lrt=no
      vim_cv_timer_create_works=yes
    
    But the configure.ac incorrectly uses `timer_create_works` to add
    `-lrt`, instead of using `timer_create_with_lrt`.
    
    fixes: https://github.com/conda-forge/vim-feedstock/pull/1664
    closes: #16242
    
    Signed-off-by: Brandon Maier <brandon.ma...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/auto/configure b/src/auto/configure
index 062119e77..2c9d9e8f2 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -14234,7 +14234,7 @@ fi
 if test "x$vim_cv_timer_create" = "xyes" ||
    test "x$vim_cv_timer_create_with_lrt" = "xyes"; then
   save_LIBS="$LIBS"
-  if test "x$vim_cv_timer_create_works" = "xyes" ; then
+  if test "x$vim_cv_timer_create_with_lrt" = "xyes" ; then
     LIBS="$LIBS -lrt"
   fi
 
@@ -14297,7 +14297,6 @@ printf "%s
" "$vim_cv_timer_create_works" >&6; }
   if test "x$vim_cv_timer_create_works" = "xyes" ; then
     printf "%s
" "#define HAVE_TIMER_CREATE 1" >>confdefs.h
 
-    LIBS="$LIBS -lrt"
   else
     LIBS="$save_LIBS"
   fi
diff --git a/src/configure.ac b/src/configure.ac
index 56895f66a..2943ec553 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -3908,7 +3908,7 @@ dnl works, on Solaris timer_create() exists but fails at 
runtime.
 if test "x$vim_cv_timer_create" = "xyes" ||
    test "x$vim_cv_timer_create_with_lrt" = "xyes"; then
   save_LIBS="$LIBS"
-  if test "x$vim_cv_timer_create_works" = "xyes" ; then
+  if test "x$vim_cv_timer_create_with_lrt" = "xyes" ; then
     LIBS="$LIBS -lrt"
   fi
 
@@ -3939,7 +3939,6 @@ if test "x$vim_cv_timer_create" = "xyes" ||
 
   if test "x$vim_cv_timer_create_works" = "xyes" ; then
     AC_DEFINE(HAVE_TIMER_CREATE)
-    LIBS="$LIBS -lrt"
   else
     LIBS="$save_LIBS"
   fi

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1tO0gF-005RPs-IG%40256bit.org.

Raspunde prin e-mail lui