configure: fix WinIDN builds targeting old Windows

1. GHA/windows: enable WinIDN in Linux cross-builds.
   (to reveal the issue in CI.)

2. fix compiler warning when building with mingw-w64 supporting
   WinIDN, while targeting pre-Vista Windows, with a `WINVER` set to
   target Vista or newer. (Such was Ubuntu's mingw-w64 with the
   classic-mingw-specific trick in point 3 of this PR.)
   ```
   ../../lib/idn.c:154:23: error: redundant redeclaration of ‘IdnToAscii’ [-Werror=redundant-decls]
     154 | WINBASEAPI int WINAPI IdnToAscii(DWORD dwFlags,
         |                       ^~~~~~~~~~
   In file included from /usr/share/mingw-w64/include/windows.h:73,
                    from /usr/share/mingw-w64/include/winsock2.h:23,
                    from ../../lib/setup-win32.h:91,
                    from ../../lib/curl_setup.h:308,
                    from ../../lib/idn.c:29:
   /usr/share/mingw-w64/include/winnls.h:1075:30: note: previous declaration of ‘IdnToAscii’ was here
    1075 |   WINNORMALIZEAPI int WINAPI IdnToAscii (DWORD dwFlags, LPCWSTR lpUnicodeCharStr, int cchUnicodeChar, LPWSTR lpASCIICharStr, int cchASCIIChar);
         |                              ^~~~~~~~~~
   [...same for IdnToUnicode...]
   ```
   Ref: https://github.com/curl/curl/actions/runs/10542832783/job/29210098553#step:7:89

3. drop `WINVER` override for classic-mingw. curl no longer supports
   building with classic-mingw.
   Reverts 37f1c21cb9 #7581

4. sync `if IdnToUnicode can be linked` detection snippet with the live
   code in `lib/idn.c`. It fixes detection for the scenario in point 2.

5. delete unused `WINIDN_DIR` variable.

Bug: https://github.com/curl/curl/pull/12606#issuecomment-1885381038
Previous abandoned attempt: #12684
Reviewed-by: Jay Satiro
Closes #14680
This commit is contained in:
Viktor Szakats 2024-08-25 19:32:10 +02:00
parent 09437d8cd4
commit 2625360b5e
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
3 changed files with 12 additions and 24 deletions

View file

@ -371,7 +371,7 @@ jobs:
run: |
mkdir bld && cd bld && ../configure --enable-warnings --enable-werror \
--host=${TRIPLET} \
--with-schannel \
--with-schannel --with-winidn \
--without-libpsl \
--disable-dependency-tracking
@ -395,7 +395,7 @@ jobs:
-DCMAKE_UNITY_BUILD=ON \
-DCURL_WERROR=ON \
-DBUILD_EXAMPLES=ON \
-DCURL_USE_SCHANNEL=ON \
-DCURL_USE_SCHANNEL=ON -DUSE_WIN32_IDN=ON \
-DCURL_USE_LIBPSL=OFF
- name: 'cmake configure log'