mirror of
https://github.com/curl/curl.git
synced 2024-11-27 05:50:21 +08:00
cmake: fix original MinGW builds
1. Re-enable `HAVE_GETADDRINFO` detection on Windows Commitd08ee3c83d
(in 2013) added logic that automatically assumed `getaddrinfo()` to be present for builds with IPv6 enabled. As it turns out, certain toolchains (e.g. original MinGW) by default target older Windows versions, and thus do not support `getaddrinfo()` out of the box. The issue was masked for a while by CMake builds forcing a newer Windows version, but that logic got deleted in commit8ba22ffb20
. Since then, some CI builds started failing due to IPv6 enabled, `HAVE_GETADDRINFO` set, but `getaddrinfo()` in fact missing. It also turns out that IPv6 works without `getaddrinfo()` since commit67a08dca27
(from 2019, via #4662). So, to resolve all this, we can now revert the initial commit, thus restoring `getaddrinfo()` detection and support IPv6 regardless of its outcome. Reported-by: Daniel Stenberg 2. Omit `bcrypt` with original MinGW Original (aka legacy/old) MinGW versions do not support `bcrypt` (introduced with Vista). We already have logic to handle that in `lib/rand.c` and autotools builds, where we do not call the unsupported API and do not link `bcrypt`, respectively, when using original MinGW. This patch ports that logic to CMake, fixing the link error: `c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: cannot find -lbcrypt` Ref: https://ci.appveyor.com/project/curlorg/curl/builds/44624888/job/40vle84cn4vle7s0#L508 Regression since76172511e7
Fixes #9214 Fixes #9393 Fixes #9395 Closes #9396
This commit is contained in:
parent
93d092867f
commit
7cd400a4d2
@ -88,11 +88,6 @@ if(NOT UNIX)
|
||||
set(TIME_WITH_SYS_TIME 0)
|
||||
set(HAVE_O_NONBLOCK 0)
|
||||
set(HAVE_IN_ADDR_T 0)
|
||||
if(ENABLE_IPV6)
|
||||
set(HAVE_GETADDRINFO 1)
|
||||
else()
|
||||
set(HAVE_GETADDRINFO 0)
|
||||
endif()
|
||||
set(STDC_HEADERS 1)
|
||||
|
||||
set(HAVE_SIGACTION 0)
|
||||
|
@ -1291,7 +1291,22 @@ if(WIN32)
|
||||
list(APPEND CURL_LIBS "advapi32" "crypt32")
|
||||
endif()
|
||||
|
||||
list(APPEND CURL_LIBS "bcrypt")
|
||||
# Matching logic used for Curl_win32_random()
|
||||
if(MINGW)
|
||||
check_c_source_compiles("
|
||||
#include <_mingw.h>
|
||||
#if defined(__MINGW64_VERSION_MAJOR)
|
||||
#error
|
||||
#endif
|
||||
int main(void) {
|
||||
return 0;
|
||||
}"
|
||||
HAVE_MINGW_ORIGINAL)
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_MINGW_ORIGINAL)
|
||||
list(APPEND CURL_LIBS "bcrypt")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
|
Loading…
Reference in New Issue
Block a user