curl_setup: disallow Windows IPv6 builds missing getaddrinfo

- On Windows if IPv6 is enabled but getaddrinfo is missing then #error
  the build.

curl can be built with IPv6 support (ENABLE_IPV6) but without the
ability to resolve hosts to IPv6 addresses (HAVE_GETADDRINFO). On
Windows this is highly unlikely and should be considered a bad build
configuration.

Such a bad configuration has already given us a bug that was hard to
diagnose. See #12134 and #12136 for discussion.

Ref: https://github.com/curl/curl/issues/12134
Ref: https://github.com/curl/curl/pull/12136

Closes https://github.com/curl/curl/pull/12221
This commit is contained in:
Jay Satiro 2023-10-28 00:23:40 -04:00
parent 2d6333101a
commit 904ae12238

View File

@ -586,6 +586,9 @@
#if defined(ENABLE_IPV6) && defined(HAVE_GETADDRINFO)
# define CURLRES_IPV6
#elif defined(ENABLE_IPV6) && (defined(WIN32) || defined(__CYGWIN__))
/* assume on Windows that IPv6 without getaddrinfo is a broken build */
# error "Unexpected build: IPv6 is enabled but getaddrinfo was not found."
#else
# define CURLRES_IPV4
#endif