On 5/31/2017 9:31 AM, Martin Storsjö wrote:
> On Wed, 31 May 2017, James Almer wrote:
> 
>> On 5/31/2017 7:21 AM, Martin Storsjö wrote:
>>> This makes the getaddrinfo functions visible, which aren't normally
>>> by default on legacy mingw.
>>>
>>> We already force __MSVCRT_VERSION__ to an XP version.
>>> ---
>>>  configure | 2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/configure b/configure
>>> index fb3920a261..77926bb85b 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -4133,6 +4133,8 @@ probe_libc(){
>>>          add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
>>>          check_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ <
>>> 0x0700" &&
>>>              add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700
>>> +        check_${pfx}cpp_condition windows.h "_WIN32_WINNT < 0x0501" &&
>>
>> defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0501
> 
> Well, after including windows.h, I would expect that it is defined
> already, but sure, I can add the extra defined().
> 
> I intentionally picked windows.h because e.g. legacy mingw32 defines the
> default in windef.h + winver.h, while mingw-w64 defines it in _mingw.h.
> This codeblock should only be used for legacy mingw32, but despite that
> I wanted to have a test that should work as intended even outside of that.
> 
> Hendrik mentioned that you might have something similiar in ffmpeg
> already, and I found 69f7aad5710 authored by you. There I noticed that
> you only check _mingw.h, but at least in my old mingw32 version,
> _mingw.h doesn't actually define _WIN32_WINNT at all, so the test there
> probably doesn't really check what you intended.

The check

"defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0502" || add_${pfx}cppflags
-D_WIN32_WINNT=0x0502

will succeed if _WIN32_WINNT is not defined, or if it's defined by the
header or the user with for example --extra-cflags with a value lower
than 0x0502. That way said value is forced as a minimum.
If what you say is true then it would only be a problem if a mingw32
toolchain at some point starts defaulting to for example 0x0601, in
which case it would wrongly supersede it, but i don't see that ever
happening. Including windows.h may be a good idea anyway to prevent that.

I didn't test that commit but others did before i pushed it, and it was
reportedly working as intended.
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to