summaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorNick Zitzmann <nickzman@gmail.com>2017-08-16 12:24:39 -0500
committerGitHub <noreply@github.com>2017-08-16 12:24:39 -0500
commit870d849d48a26b8eeb0d4bb1f4655367a4a191ca (patch)
tree48415a008b75a845d0dc8f03c71b66fa4e59d299 /acinclude.m4
parentca9630f12843f0bb0baa3ae78491e07431ccf5de (diff)
downloadcurl-870d849d48a26b8eeb0d4bb1f4655367a4a191ca.tar.gz
configure: check for __builtin_available() availability (#1788)
This change does two things: 1. It un-breaks the build in Xcode 9.0. (Xcode 9.0 is currently failing trying to compile connectx() in lib/connect.c.) 2. It finally weak-links the connectx() function, and falls back on connect() when run on older operating systems.
Diffstat (limited to 'acinclude.m4')
-rwxr-xr-x[-rw-r--r--]acinclude.m426
1 files changed, 26 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 539322870..dd5d896bc 100644..100755
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -3243,3 +3243,29 @@ AC_DEFUN([CURL_MAC_CFLAGS], [
fi
])
+
+
+dnl CURL_SUPPORTS_BUILTIN_AVAILABLE
+dnl
+dnl Check to see if the compiler supports __builtin_available. This built-in
+dnl compiler function first appeared in Apple LLVM 9.0.0. It's so new that, at
+dnl the time this macro was written, the function was not yet documented. Its
+dnl purpose is to return true if the code is running under a certain OS version
+dnl or later.
+
+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, *)) {}
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(HAVE_BUILTIN_AVAILABLE, 1,
+ [Define to 1 if you have the __builtin_available function.])
+ ],[
+ AC_MSG_RESULT([no])
+ ])
+])