Skip to content

Commit

Permalink
configure: Set WIN32_LEAN_AND_MEAN at configure time
Browse files Browse the repository at this point in the history
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@amyspark.me>
Signed-off-by: Martin Storsjö <martin@martin.st>
  • Loading branch information
amyspark authored and mstorsjo committed Aug 14, 2023
1 parent c704901 commit ddc1cd5
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 11 deletions.
1 change: 0 additions & 1 deletion compat/atomics/win32/stdatomic.h
Expand Up @@ -19,7 +19,6 @@
#ifndef COMPAT_ATOMICS_WIN32_STDATOMIC_H
#define COMPAT_ATOMICS_WIN32_STDATOMIC_H

#define WIN32_LEAN_AND_MEAN
#include <stddef.h>
#include <stdint.h>
#include <windows.h>
Expand Down
1 change: 0 additions & 1 deletion compat/w32pthreads.h
Expand Up @@ -35,7 +35,6 @@
* As most functions here are used without checking return values,
* only implement return values as necessary. */

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <process.h>
#include <time.h>
Expand Down
3 changes: 3 additions & 0 deletions configure
Expand Up @@ -5666,6 +5666,7 @@ case $target_os in
fi
! enabled small && test_cmd $windres --version && enable gnu_windres
enabled x86_32 && check_ldflags -Wl,--large-address-aware
add_cppflags -DWIN32_LEAN_AND_MEAN
shlibdir_default="$bindir_default"
SLIBPREF=""
SLIBSUF=".dll"
Expand Down Expand Up @@ -5716,6 +5717,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"
Expand Down Expand Up @@ -5745,6 +5747,7 @@ case $target_os in
enabled x86_64 && objformat="win64" || objformat="win32"
enable dos_paths
! enabled small && test_cmd $windres --version && enable gnu_windres
add_cppflags -DWIN32_LEAN_AND_MEAN
add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
;;
*-dos|freedos|opendos)
Expand Down
1 change: 0 additions & 1 deletion libavdevice/dshow_capture.h
Expand Up @@ -27,7 +27,6 @@
#include "avdevice.h"

#define COBJMACROS
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define NO_DSHOW_STRSAFE
#include <dshow.h>
Expand Down
1 change: 0 additions & 1 deletion libavdevice/opengl_enc.c
Expand Up @@ -30,7 +30,6 @@
#include "config.h"

#if HAVE_WINDOWS_H
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#if HAVE_OPENGL_GL3_H
Expand Down
1 change: 0 additions & 1 deletion libavfilter/vsrc_ddagrab.c
Expand Up @@ -22,7 +22,6 @@
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0A00
#endif
#define WIN32_LEAN_AND_MEAN

#include <windows.h>

Expand Down
6 changes: 2 additions & 4 deletions libavformat/os_support.c
Expand Up @@ -34,11 +34,9 @@
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif /* HAVE_SYS_TIME_H */
#if HAVE_WINSOCK2_H
#include <winsock2.h>
#elif HAVE_SYS_SELECT_H
#if HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif /* HAVE_WINSOCK2_H */
#endif /* HAVE_SYS_SELECT_H */
#endif /* !HAVE_POLL_H */

#include "network.h"
Expand Down
1 change: 0 additions & 1 deletion libavutil/wchar_filename.h
Expand Up @@ -21,7 +21,6 @@

#ifdef _WIN32

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "mem.h"

Expand Down
1 change: 0 additions & 1 deletion libswscale/utils.c
Expand Up @@ -34,7 +34,6 @@
#endif
#endif
#if HAVE_VIRTUALALLOC
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif

Expand Down

0 comments on commit ddc1cd5

Please sign in to comment.