From 40f97fe186d80648b2a9e8a31c522474a4d73756 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 13 Apr 2018 14:56:33 +0530 Subject: [PATCH] Only pass -DZ_SOLO on MSVC if using MSYS2 zlib This fixes the build when we're building our own zlib as a subproject. --- meson.build | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index b1ca55d..5ad62e4 100644 --- a/meson.build +++ b/meson.build @@ -15,11 +15,22 @@ subprojects = [ ] cc = meson.get_compiler('c') + +# Make it possible to use msys2 built zlib which fails +# when not using the mingw toolchain as it uses unistd.h if not meson.is_subproject() and cc.get_id() == 'msvc' - # Make it possible to use msys2 built zlib - # which fails when not using the mingw toolchain as - # it uses unistd.h - add_global_arguments('-DZ_SOLO', language: 'c') + uname = find_program('uname') + ret = run_command(uname, '-o') + if ret.returncode() == 0 and ret.stdout().lower() == 'msys' + ret = run_command(uname, '-r') + # The kernel version returned by uname is actually the msys version + if ret.returncode() == 0 and ret.stdout().startswith('2') + # If a system zlib is found, disable UNIX features in zlib.h and zconf.h + if cc.find_library('z').found() + add_global_arguments('-DZ_SOLO', language: 'c') + endif + endif + endif endif # FIXME Remove that check once we have ffmpeg as a gst-libav subproject -- 2.7.4