]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
build: tidy up `__builtin_available` feature checks (Apple)
authorViktor Szakats <commit@vsz.me>
Sat, 6 Jul 2024 01:57:51 +0000 (03:57 +0200)
committerViktor Szakats <commit@vsz.me>
Wed, 10 Jul 2024 09:42:46 +0000 (11:42 +0200)
- sync detection snippet between autotools and cmake
  It wasn't causing issues, but it's useful to avoid unnecessary
  differences while debugging.

- cmake: limit check to `APPLE`.

Ref: b05dc7eb3592305de9fa85640767f3dd2a8d4c93 #14122
Cherry-picked from #14097
Closes #14127

CMake/CurlTests.c
CMake/Platforms/WindowsCache.cmake
CMakeLists.txt
acinclude.m4

index 483b9a218b0e3c48fe749ff95e3defa703ce41d7..f04abd79b2c8ab95ab6a7d6d7fdbd400a698e97f 100644 (file)
@@ -380,7 +380,7 @@ int main(void)
 #ifdef HAVE_BUILTIN_AVAILABLE
 int main(void)
 {
-  if(__builtin_available(macOS 10.12, *)) {}
+  if(__builtin_available(macOS 10.12, iOS 5.0, *)) {}
   return 0;
 }
 #endif
index 9fe977bcfedc13753fb7ce7fbee607813abe2fbe..5346f595ee8d479b486c72181a9d8e471639362f 100644 (file)
@@ -173,7 +173,6 @@ set(HAVE_IOCTLSOCKET_FIONBIO 1)
 set(HAVE_IOCTL_FIONBIO 0)
 set(HAVE_SETSOCKOPT_SO_NONBLOCK 0)
 set(HAVE_POSIX_STRERROR_R 0)
-set(HAVE_BUILTIN_AVAILABLE 0)
 set(HAVE_MSG_NOSIGNAL 0)
 set(HAVE_STRUCT_TIMEVAL 1)
 set(HAVE_STRUCT_SOCKADDR_STORAGE 1)
index 22c7cc9f4c47079030368c63688ed0bbc9ac8d3c..aec06e898bcb55f703df1e62bf42f06fa3305be8 100644 (file)
@@ -1484,8 +1484,10 @@ if(NOT WIN32)
   curl_internal_test(HAVE_CLOCK_GETTIME_MONOTONIC)
 endif()
 
-# Check compiler support of __builtin_available()
-curl_internal_test(HAVE_BUILTIN_AVAILABLE)
+if(APPLE)
+  # Check compiler support of __builtin_available()
+  curl_internal_test(HAVE_BUILTIN_AVAILABLE)
+endif()
 
 # Some other minor tests
 
index a44ae350e3609db6e7c167b29a513dfa9c671674..7b5526d36c00f7c11f5171ab6ee7f7ff3849ff79 100644 (file)
@@ -1649,9 +1649,8 @@ AC_DEFUN([CURL_SUPPORTS_BUILTIN_AVAILABLE], [
   AC_MSG_CHECKING([to see if the compiler supports __builtin_available()])
   AC_COMPILE_IFELSE([
     AC_LANG_PROGRAM([[
-#include <stdlib.h>
     ]],[[
-      if (__builtin_available(macOS 10.8, iOS 5.0, *)) {}
+      if(__builtin_available(macOS 10.12, iOS 5.0, *)) {}
     ]])
   ],[
     AC_MSG_RESULT([yes])