[vlc-devel] [PATCH] configure: Check the toolchain default _WIN32_WINNT in addition to a command line override

Steve Lhomme robux4 at ycbcr.xyz
Fri Apr 3 13:44:23 CEST 2020


On 2020-04-03 13:27, Martin Storsjö wrote:
> Since 255e2ce27, we try not to override _WIN32_WINNT in case it already
> is defined on the command line to a higher value. However, if it isn't
> specified on the command line, but the toolchain headers default to
> a newer version, we should also honor it and keep that version instead
> of forcing a lower version here. (If the toolchain defaults to a newer
> version, runtime libs of the toolchain may rely on such a new version
> anyway, so forcing a lower target within VLC might be useless.)

This seems OK although it may create issues with code like this:
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0601 // _WIN32_WINNT_WIN7
# undef _WIN32_WINNT
# define _WIN32_WINNT 0x0601 // _WIN32_WINNT_WIN7
#endif

In this case the user may not set value in the command-line and the 
default one from the toolchain is used. But it may be higher than Win7 
but then we force it down.

On the other hand it's not a regression. In that case we use to set the 
value in config.h to Win7 and it would never pick the default toolchain 
one. But we need to keep this in mind. Especially when backporting to 
3.0 (because win7 is a bad example since that's the minimum in 4.0 anyway).

I'm OK with the change if we decide we don't want people to compile 4.0 
for anything lower than Win7.

> ---
>   configure.ac | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index 9aba863449..16fd5f20d5 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -254,6 +254,11 @@ case "${host_os}" in
>       AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
>         [[#ifdef _WIN32_WINNT
>          # error _WIN32_WINNT already defined
> +       #else
> +       # include <windows.h>
> +       # if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0601
> +       #  error _WIN32_WINNT toolchain default high enough
> +       # endif
>          #endif
>         ]],[[;]])
>       ],[
> -- 
> 2.17.1
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list