windows: fix if_nametoindex() detection with autotools, improve with cmake#17982
Closed
vszakats wants to merge 11 commits intocurl:masterfrom
Closed
windows: fix if_nametoindex() detection with autotools, improve with cmake#17982vszakats wants to merge 11 commits intocurl:masterfrom
if_nametoindex() detection with autotools, improve with cmake#17982vszakats wants to merge 11 commits intocurl:masterfrom
Conversation
We want to set it to 0 or 1 if we are sure about these values and leave it to auto-detection in other cases
if_nametoindex() detection with autotools, improve with cmake
whrvt
added a commit
to neomodnet/neomod
that referenced
this pull request
Jul 22, 2025
maybe these are related? curl/curl#17728 curl/curl#17982 curl/curl#17979 idk what the downsides of this are though
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
autotools: fix auto-detection on the Windows platform.
It was mis-detected when targeting Windows XP/2003 64-bit.
It was permanently undetected when building for Windows 32-bit.
Ref: https://github.com/curl/curl/actions/runs/16405598782/job/46351023138?pr=17982#step:10:29
Reported-by: LoRd_MuldeR
Fixes cURL 8.15.0 fails to build for 64-Bit Windows XP target (mingw-w64), but not for 32-Bit Windows target #17979
Without this patch the workaround for the 8.15.0 release is:
export ac_cv_func_if_nametoindex=0for Windows XP/2003 64-bit.Background: Checking for the
if_nametoindex()function viaAC_CHECK_FUNCS()(autotools) orcheck_function_exists()(cmake) donot work on Windows, for two reasons:
when targeting old Windows versions (XP or WS2003 in curl context)
via
_WIN32_WINNT. But it's always present in the system implibiphlpapiwhere these checks are looking.a 4-byte argument, while these checks always use no arguments,
making them always fail.
cmake: call
if_nametoindexdynamically with mingw-w64 v1.0.This mingw-w64 version lacks prototype and implib entry for it.
cmake: add auto-detection for Windows and use as a fallback for
non-pre-fill cases.
cmake: disable pre-fill with
_CURL_PREFILL=OFF. (for testing)cmake: disable pre-fill for untested compilers. (i.e. non-MSVC,
non-mingw64)
GHA/windows: make an autotools job build for Windows XP.
Follow-up to 0d71b18 #17413