Skip to content

Commit 4331e70

Browse files
committed
windows: fix builds targeting WinXP, test it in CI
- appveyor: make a job target Windows XP. - examples/block_ip: force this specific example to target Vista to make it compile when building curl for Windows XP. Fixing: ``` docs\examples\block_ip.c(157): warning C4013: 'inet_pton' undefined; assuming extern returning int docs\examples\block_ip.c(272): warning C4013: 'inet_ntop' undefined; assuming extern returning int ``` Ref: https://ci.appveyor.com/project/curlorg/curl/builds/52102142/job/2ajdluhc20r4gmmw#L530 Cherry-picked from curl#17413 Closes curl#17415
1 parent 203b434 commit 4331e70

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

appveyor.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ if [ "${BUILD_SYSTEM}" = 'CMake' ]; then
5252
[ "${_chkprefill}" = '_chkprefill' ] && options+=' -D_CURL_PREFILL=OFF'
5353
[[ "${TARGET}" = *'ARM64'* ]] && SKIP_RUN='ARM64 architecture'
5454
[ -n "${TOOLSET:-}" ] && options+=" -T ${TOOLSET}"
55+
[ -n "${WINTARGET:-}" ] && options+=" -DCURL_TARGET_WINDOWS_VERSION=${WINTARGET}"
5556
[ "${OPENSSL}" = 'ON' ] && options+=" -DOPENSSL_ROOT_DIR=${openssl_root_win}"
5657
[ -n "${CURLDEBUG:-}" ] && options+=" -DENABLE_CURLDEBUG=${CURLDEBUG}"
5758
if [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2013' ]; then

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ environment:
7474
APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
7575
PRJ_GEN: 'Visual Studio 10 2010'
7676
TARGET: '-A x64'
77+
WINTARGET: 0x0501 # Windows XP
7778
PRJ_CFG: Debug
7879
SCHANNEL: 'ON'
7980
SHARED: 'ON'

docs/examples/block_ip.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ int main(void) { printf("Platform not supported.\n"); return 1; }
4141
#ifndef _CRT_NONSTDC_NO_DEPRECATE
4242
#define _CRT_NONSTDC_NO_DEPRECATE
4343
#endif
44-
#ifndef _WIN32_WINNT
45-
#define _WIN32_WINNT 0x0600
44+
#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600
45+
#undef _WIN32_WINNT
46+
#define _WIN32_WINNT 0x0600 /* Requires Windows Vista */
4647
#endif
4748
#include <winsock2.h>
4849
#include <ws2tcpip.h>

0 commit comments

Comments
 (0)