mirror of
https://github.com/curl/curl.git
synced 2026-08-25 16:23:36 +03:00
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.
This commit is contained in:
parent
ca9630f128
commit
870d849d48
3 changed files with 45 additions and 9 deletions
27
lib/connect.c
Normal file → Executable file
27
lib/connect.c
Normal file → Executable file
|
|
@ -1059,16 +1059,25 @@ static CURLcode singleipconnect(struct connectdata *conn,
|
|||
if(!isconnected && (conn->socktype == SOCK_STREAM)) {
|
||||
if(conn->bits.tcp_fastopen) {
|
||||
#if defined(CONNECT_DATA_IDEMPOTENT) /* OS X */
|
||||
sa_endpoints_t endpoints;
|
||||
endpoints.sae_srcif = 0;
|
||||
endpoints.sae_srcaddr = NULL;
|
||||
endpoints.sae_srcaddrlen = 0;
|
||||
endpoints.sae_dstaddr = &addr.sa_addr;
|
||||
endpoints.sae_dstaddrlen = addr.addrlen;
|
||||
#ifdef HAVE_BUILTIN_AVAILABLE
|
||||
if(__builtin_available(macOS 10.11, iOS 9.0, tvOS 9.0, watchOS 2.0, *)) {
|
||||
#endif /* HAVE_BUILTIN_AVAILABLE */
|
||||
sa_endpoints_t endpoints;
|
||||
endpoints.sae_srcif = 0;
|
||||
endpoints.sae_srcaddr = NULL;
|
||||
endpoints.sae_srcaddrlen = 0;
|
||||
endpoints.sae_dstaddr = &addr.sa_addr;
|
||||
endpoints.sae_dstaddrlen = addr.addrlen;
|
||||
|
||||
rc = connectx(sockfd, &endpoints, SAE_ASSOCID_ANY,
|
||||
CONNECT_RESUME_ON_READ_WRITE | CONNECT_DATA_IDEMPOTENT,
|
||||
NULL, 0, NULL, NULL);
|
||||
rc = connectx(sockfd, &endpoints, SAE_ASSOCID_ANY,
|
||||
CONNECT_RESUME_ON_READ_WRITE | CONNECT_DATA_IDEMPOTENT,
|
||||
NULL, 0, NULL, NULL);
|
||||
#ifdef HAVE_BUILTIN_AVAILABLE
|
||||
}
|
||||
else {
|
||||
rc = connect(sockfd, &addr.sa_addr, addr.addrlen);
|
||||
}
|
||||
#endif /* HAVE_BUILTIN_AVAILABLE */
|
||||
#elif defined(MSG_FASTOPEN) /* Linux */
|
||||
if(conn->given->flags & PROTOPT_SSL)
|
||||
rc = connect(sockfd, &addr.sa_addr, addr.addrlen);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue