[FFmpeg-devel] [PATCH v3 1/1] configure: Set WIN32_LEAN_AND_MEAN at configure time
Martin Storsjö
martin at martin.st
Mon Aug 14 14:30:52 EEST 2023
On Sat, 5 Aug 2023, L. E. Segovia wrote:
> Including winsock2.h or windows.h without WIN32_LEAN_AND_MEAN cause
> bzlib.h to parse as nonsense, due to an instance of #define char small
> in rpcndr.h.
>
> See:
>
> https://stackoverflow.com/a/27794577
>
> Signed-off-by: L. E. Segovia <amy at amyspark.me>
> ---
> compat/atomics/win32/stdatomic.h | 1 -
> compat/w32pthreads.h | 1 -
> configure | 1 +
> libavdevice/dshow_capture.h | 1 -
> libavdevice/opengl_enc.c | 1 -
> libavfilter/vsrc_ddagrab.c | 1 -
> libavformat/os_support.c | 6 ++----
> libavutil/wchar_filename.h | 1 -
> libswscale/utils.c | 1 -
> 9 files changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/configure b/configure
> index 99388e7664..881a10bc0c 100755
> --- a/configure
> +++ b/configure
> @@ -5716,6 +5716,7 @@ case $target_os in
> fi
> ! enabled small && test_cmd $windres --version && enable gnu_windres
> enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
> + add_cppflags -DWIN32_LEAN_AND_MEAN
> shlibdir_default="$bindir_default"
> SLIBPREF=""
> SLIBSUF=".dll"
This is in the block for target_os = win32/win64 - but that's only used
for MSVC (or clang-cl) based builds - not for mingw or cygwin.
We'd want this define set for mingw and cygwin too.
Cygwin itself doesn't define _WIN32 and generally is mostly treated as
unix, but there are some codepaths that check for HAVE_WINDOWS_H and
include that header, and that's true in Cygwin too, so we'd like to keep
the WIN32_LEAN_AND_MEAN there too.
Other than that, this looks fine to me!
// Martin
More information about the ffmpeg-devel
mailing list