diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 8a8a19d310..bfc1673c28 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -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' diff --git a/configure.ac b/configure.ac index 71514c8642..52e6fdbb5a 100644 --- a/configure.ac +++ b/configure.ac @@ -2617,7 +2617,6 @@ if test "$curl_cv_native_windows" = 'yes'; then if test "$want_winidn" = "yes"; then dnl WinIDN library support has been requested - clean_CFLAGS="$CFLAGS" clean_CPPFLAGS="$CPPFLAGS" clean_LDFLAGS="$LDFLAGS" clean_LIBS="$LIBS" @@ -2629,27 +2628,8 @@ if test "$curl_cv_native_windows" = 'yes'; then dnl pkg-config not available or provides no info WINIDN_LDFLAGS="-L$want_winidn_path/lib$libsuff" WINIDN_CPPFLAGS="-I$want_winidn_path/include" - WINIDN_DIR="$want_winidn_path/lib$libsuff" fi # - dnl WinIDN requires a minimum supported OS version of at least Vista (0x0600) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - #include - ]],[[ - #if (WINVER < 0x600) && (_WIN32_WINNT < 0x600) - #error - #endif - ]]) - ],[ - ],[ - CFLAGS=`echo $CFLAGS | $SED -e 's/-DWINVER=[[^ ]]*//g'` - CFLAGS=`echo $CFLAGS | $SED -e 's/-D_WIN32_WINNT=[[^ ]]*//g'` - CPPFLAGS=`echo $CPPFLAGS | $SED -e 's/-DWINVER=[[^ ]]*//g'` - CPPFLAGS=`echo $CPPFLAGS | $SED -e 's/-D_WIN32_WINNT=[[^ ]]*//g'` - WINIDN_CPPFLAGS="$WINIDN_CPPFLAGS -DWINVER=0x0600" - ]) - # CPPFLAGS="$CPPFLAGS $WINIDN_CPPFLAGS" LDFLAGS="$LDFLAGS $WINIDN_LDFLAGS" LIBS="$WINIDN_LIBS $LIBS" @@ -2659,6 +2639,14 @@ if test "$curl_cv_native_windows" = 'yes'; then AC_LANG_PROGRAM([[ #include ]],[[ + #if (!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x600) && \ + (!defined(WINVER) || WINVER < 0x600) + WINBASEAPI int WINAPI IdnToUnicode(DWORD dwFlags, + const WCHAR *lpASCIICharStr, + int cchASCIIChar, + WCHAR *lpUnicodeCharStr, + int cchUnicodeChar); + #endif IdnToUnicode(0, NULL, 0, NULL, 0); ]]) ],[ @@ -2675,7 +2663,6 @@ if test "$curl_cv_native_windows" = 'yes'; then curl_idn_msg="enabled (Windows-native)" else AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled]) - CFLAGS="$clean_CFLAGS" CPPFLAGS="$clean_CPPFLAGS" LDFLAGS="$clean_LDFLAGS" LIBS="$clean_LIBS" diff --git a/lib/idn.c b/lib/idn.c index ac17718ef5..ed20cdc16b 100644 --- a/lib/idn.c +++ b/lib/idn.c @@ -150,7 +150,8 @@ static CURLcode mac_ascii_to_idn(const char *in, char **out) #ifdef USE_WIN32_IDN /* using Windows kernel32 and normaliz libraries. */ -#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x600 +#if (!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x600) && \ + (!defined(WINVER) || WINVER < 0x600) WINBASEAPI int WINAPI IdnToAscii(DWORD dwFlags, const WCHAR *lpUnicodeCharStr, int cchUnicodeChar,