{"author":"Viktor Szakats","author_email":"commit@vsz.me","author_time":1753055846,"commit_time":1753097401,"committer":"Viktor Szakats","committer_email":"commit@vsz.me","hash":"a75110570a8427241c4128d3ac68a23d31ac0a71","message":"windows: fix `if_nametoindex()` detection with autotools, improve with cmake\n\n- autotools: fix auto-detection on the Windows platform.\n  It was mis-detected when targeting Windows XP/2003 64-bit.\n  It was permanently undetected when building for Windows 32-bit.\n  ```\n  lib/url.c: In function 'zonefrom_url':\n  lib/url.c:1802:18: error: implicit declaration of function 'if_nametoindex' [-Wimplicit-function-declaration]\n   1802 |       scopeidx = if_nametoindex(zoneid);\n        |                  ^~~~~~~~~~~~~~\n  lib/url.c:1802:18: error: nested extern declaration of 'if_nametoindex' [-Werror=nested-externs]\n  ```\n  Ref: https://github.com/curl/curl/actions/runs/16405598782/job/46351023138?pr=17982#step:10:29\n\n  Reported-by: LoRd_MuldeR\n  Fixes #17979\n\n  Without this patch the workaround for the 8.15.0 release is:\n  `export ac_cv_func_if_nametoindex=0` for Windows XP/2003 64-bit.\n\n  Background: Checking for the `if_nametoindex()` function via\n  `AC_CHECK_FUNCS()` (autotools) or `check_function_exists()` (cmake) do\n  not work on Windows, for two reasons:\n  - the function may be disabled at compile-time in Windows headers\n    when targeting old Windows versions (XP or WS2003 in curl context)\n    via `_WIN32_WINNT`. But it's always present in the system implib\n    `iphlpapi` where these checks are looking.\n  - for 32-bit Windows the function signature in the implib requires\n    a 4-byte argument, while these checks always use no arguments,\n    making them always fail.\n\n- cmake: call `if_nametoindex` dynamically with mingw-w64 v1.0.\n  This mingw-w64 version lacks prototype and implib entry for it.\n\n- cmake: add auto-detection for Windows and use as a fallback for\n  non-pre-fill cases.\n\n- cmake: disable pre-fill with `_CURL_PREFILL=OFF`. (for testing)\n\n- cmake: disable pre-fill for untested compilers. (i.e. non-MSVC,\n  non-mingw64)\n\n- GHA/windows: make an autotools job build for Windows XP.\n\nFollow-up to 0d71b18153c8edb996738f8a362373fc72d0013b #17413\n\nCloses #17982\n","parents":["3d302250ec1b6149f1d75dfb4910e567f3bb07de"],"tree_hash":"c1d3ace6b7328d46eddeba6cdc2d2dcc01d5fdd1"}