From aa0d70fef73c77af68e238375669d1bda10e22a2 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 5 Mar 2025 01:31:58 +0100 Subject: [PATCH] build: tidy-ups around `inet_pton` - cmake: make the `inet_pton`/`inet_ntop` detection codepath explicit for WinCE. To not rely on an empty `HAVE_WIN32_WINNT`. - tests/server/mqttd: drop `inet_pton` header and lib source. - tests/server: move `inet_pton` lib source to a variable. Closes #16563 --- CMakeLists.txt | 2 +- tests/server/Makefile.inc | 21 ++++++++++----------- tests/server/mqttd.c | 1 - 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f9a736116..70812b5c6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1625,7 +1625,7 @@ if(WIN32) # Pre-fill detection results based on target OS version if(MINGW OR MSVC OR WINCE) - if(HAVE_WIN32_WINNT LESS 0x0600) + if(WINCE OR HAVE_WIN32_WINNT LESS 0x0600) set(HAVE_INET_NTOP 0) set(HAVE_INET_PTON 0) else() # Windows Vista or newer diff --git a/tests/server/Makefile.inc b/tests/server/Makefile.inc index f0b20b6a24..46ca041846 100644 --- a/tests/server/Makefile.inc +++ b/tests/server/Makefile.inc @@ -61,6 +61,9 @@ USEFUL = \ ../../lib/memdebug.c \ ../../lib/memdebug.h +INET_PTON = \ + ../../lib/inet_pton.c + UTIL = \ util.c \ util.h \ @@ -78,29 +81,25 @@ rtspd_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) \ rtspd_LDADD = @CURL_NETWORK_AND_TIME_LIBS@ rtspd_CFLAGS = $(AM_CFLAGS) -sockfilt_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) \ +sockfilt_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) $(INET_PTON) \ server_sockaddr.h \ - sockfilt.c \ - ../../lib/inet_pton.c + sockfilt.c sockfilt_LDADD = @CURL_NETWORK_AND_TIME_LIBS@ sockfilt_CFLAGS = $(AM_CFLAGS) -socksd_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) \ - server_sockaddr.h socksd.c \ - ../../lib/inet_pton.c +socksd_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) $(INET_PTON) \ + server_sockaddr.h socksd.c socksd_LDADD = @CURL_NETWORK_AND_TIME_LIBS@ socksd_CFLAGS = $(AM_CFLAGS) mqttd_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) \ - server_sockaddr.h mqttd.c \ - ../../lib/inet_pton.c + server_sockaddr.h mqttd.c mqttd_LDADD = @CURL_NETWORK_AND_TIME_LIBS@ mqttd_CFLAGS = $(AM_CFLAGS) -sws_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) \ +sws_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) $(INET_PTON) \ server_sockaddr.h \ - sws.c \ - ../../lib/inet_pton.c + sws.c sws_LDADD = @CURL_NETWORK_AND_TIME_LIBS@ sws_CFLAGS = $(AM_CFLAGS) diff --git a/tests/server/mqttd.c b/tests/server/mqttd.c index dbc844d823..d170ee31a0 100644 --- a/tests/server/mqttd.c +++ b/tests/server/mqttd.c @@ -55,7 +55,6 @@ #include "curlx.h" /* from the private lib dir */ #include "getpart.h" -#include "inet_pton.h" #include "server_sockaddr.h" #include "warnless.h" -- 2.47.3