From: Viktor Szakats Date: Sat, 28 Oct 2023 10:52:23 +0000 (+0000) Subject: build: require Windows XP or newer X-Git-Tag: curl-8_5_0~175 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=960d601481eed46d7b46391380c4869bcf0d9f19;p=thirdparty%2Fcurl.git build: require Windows XP or newer After this patch we assume availability of `getaddrinfo` and `freeaddrinfo`, first introduced in Windows XP. Meaning curl now requires building for Windows XP as a minimum. TODO: assume these also in autotools. Ref: https://github.com/curl/curl/pull/12221#issuecomment-1783761806 Closes #12225 --- diff --git a/CMake/Platforms/WindowsCache.cmake b/CMake/Platforms/WindowsCache.cmake index c6610d0a8c..e4525300c4 100644 --- a/CMake/Platforms/WindowsCache.cmake +++ b/CMake/Platforms/WindowsCache.cmake @@ -82,6 +82,10 @@ else() endif() endif() +# Available in Windows XP and newer +set(HAVE_GETADDRINFO 1) +set(HAVE_FREEADDRINFO 1) + set(HAVE_FCHMOD 0) set(HAVE_SOCKETPAIR 0) set(HAVE_SENDMSG 0) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0654aee871..3786c56622 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1087,26 +1087,24 @@ if(WIN32) # avoid storing HAVE_WIN32_WINNT in CMake cache unset(HAVE_WIN32_WINNT CACHE) - # pre-fill detection results that are based on target OS version - if(HAVE_WIN32_WINNT AND (MINGW OR MSVC)) + if(HAVE_WIN32_WINNT) if(HAVE_WIN32_WINNT STRLESS "0x0501") - set(HAVE_GETADDRINFO 0) - set(HAVE_FREEADDRINFO 0) - else() # Windows XP or newer - set(HAVE_GETADDRINFO 1) - set(HAVE_FREEADDRINFO 1) + # Windows XP is required for freeaddrinfo, getaddrinfo + message(FATAL_ERROR "Building for Windows XP or newer is required.") endif() - unset(HAVE_GETADDRINFO CACHE) - unset(HAVE_FREEADDRINFO CACHE) - if(HAVE_WIN32_WINNT STRLESS "0x0600") - set(HAVE_INET_NTOP 0) - set(HAVE_INET_PTON 0) - else() # Windows Vista or newer - set(HAVE_INET_NTOP 1) - set(HAVE_INET_PTON 1) + + # pre-fill detection results based on target OS version + if(MINGW OR MSVC) + if(HAVE_WIN32_WINNT STRLESS "0x0600") + set(HAVE_INET_NTOP 0) + set(HAVE_INET_PTON 0) + else() # Windows Vista or newer + set(HAVE_INET_NTOP 1) + set(HAVE_INET_PTON 1) + endif() + unset(HAVE_INET_NTOP CACHE) + unset(HAVE_INET_PTON CACHE) endif() - unset(HAVE_INET_NTOP CACHE) - unset(HAVE_INET_PTON CACHE) endif() endif() diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 8c38aa9bb6..6bbd1cbabb 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -162,6 +162,8 @@ library check. # Windows +Building for Windows XP is required as a minimum. + ## Building Windows DLLs and C runtime (CRT) linkage issues As a general rule, building a DLL with static CRT linkage is highly diff --git a/lib/config-win32.h b/lib/config-win32.h index 6d110eb768..aa0d751338 100644 --- a/lib/config-win32.h +++ b/lib/config-win32.h @@ -331,8 +331,6 @@ # undef RECV_TYPE_ARG3 # undef SEND_TYPE_ARG1 # undef SEND_TYPE_ARG3 -# define HAVE_FREEADDRINFO -# define HAVE_GETADDRINFO # define HAVE_GETHOSTBYNAME_R # define HAVE_GETHOSTBYNAME_R_6 # define LWIP_POSIX_SOCKETS_IO_NAMES 0 @@ -353,13 +351,11 @@ #undef USE_WINSOCK #undef HAVE_WINSOCK2_H #undef HAVE_WS2TCPIP_H - #define HAVE_GETADDRINFO #define HAVE_SYS_IOCTL_H #define HAVE_SYS_SOCKET_H #define HAVE_NETINET_IN_H #define HAVE_NETDB_H #define HAVE_ARPA_INET_H - #define HAVE_FREEADDRINFO #define SOCKET int #endif @@ -473,24 +469,10 @@ Vista # endif #endif -/* Availability of freeaddrinfo, getaddrinfo, and if_nametoindex - functions is quite convoluted, compiler dependent and even build target - dependent. */ -#if defined(HAVE_WS2TCPIP_H) -# if defined(__POCC__) -# define HAVE_FREEADDRINFO 1 -# define HAVE_GETADDRINFO 1 -# define HAVE_GETADDRINFO_THREADSAFE 1 -# elif defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501) -# define HAVE_FREEADDRINFO 1 -# define HAVE_GETADDRINFO 1 -# define HAVE_GETADDRINFO_THREADSAFE 1 -# elif defined(_MSC_VER) && (_MSC_VER >= 1200) -# define HAVE_FREEADDRINFO 1 -# define HAVE_GETADDRINFO 1 -# define HAVE_GETADDRINFO_THREADSAFE 1 -# endif -#endif +/* Windows XP is required for freeaddrinfo, getaddrinfo */ +#define HAVE_FREEADDRINFO 1 +#define HAVE_GETADDRINFO 1 +#define HAVE_GETADDRINFO_THREADSAFE 1 #if defined(__POCC__) # ifndef _MSC_VER