Skip to content

Commit 6da5f22

Browse files
huthbonzini
authored andcommitted
meson.build: Use -Wno-undef only for SDL2 versions that need it
There is no need to disable this useful compiler warning for all versions of the SDL. Unfortunately, various versions are buggy (beside SDL 2.0.8, the version 2.26.0 and 2.26.1 are broken, too, see libsdl-org/SDL#6619 ), but we can use a simple compiler check to see whether we need the -Wno-undef or not. This also enables the printing of the version number with good versions of the SDL in the summary of the meson output again. Signed-off-by: Thomas Huth <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent aece723 commit 6da5f22

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

meson.build

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,10 +1273,16 @@ if not get_option('sdl').auto() or have_system
12731273
sdl_image = not_found
12741274
endif
12751275
if sdl.found()
1276-
# work around 2.0.8 bug
1277-
sdl = declare_dependency(compile_args: '-Wno-undef',
1278-
dependencies: sdl,
1279-
version: sdl.version())
1276+
# Some versions of SDL have problems with -Wundef
1277+
if not cc.compiles('''
1278+
#include <SDL.h>
1279+
#include <SDL_syswm.h>
1280+
int main(int argc, char *argv[]) { return 0; }
1281+
''', dependencies: sdl, args: '-Werror=undef')
1282+
sdl = declare_dependency(compile_args: '-Wno-undef',
1283+
dependencies: sdl,
1284+
version: sdl.version())
1285+
endif
12801286
sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
12811287
method: 'pkg-config')
12821288
else

0 commit comments

Comments
 (0)