diff --git a/meson.build b/meson.build index 6089a620eaf..ae6ecc60836 100644 --- a/meson.build +++ b/meson.build @@ -1371,9 +1371,12 @@ else dep_clock = cc.find_library('rt') endif -# TODO: some of these may be conditional -dep_zlib = dependency('zlib', version : '>= 1.2.3', fallback : ['zlib', 'zlib_dep']) -pre_args += '-DHAVE_ZLIB' +dep_zlib = dependency('zlib', version : '>= 1.2.3', + fallback : ['zlib', 'zlib_dep'], + required : get_option('zlib')) +if dep_zlib.found() + pre_args += '-DHAVE_ZLIB' +endif _zstd = get_option('zstd') if _zstd == 'true' diff --git a/meson_options.txt b/meson_options.txt index 949d7d39774..fd9958f87a8 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -441,6 +441,12 @@ option( value : 'auto', description : 'Use ZSTD instead of ZLIB in some cases.' ) +option( + 'zlib', + type : 'feature', + value : 'enabled', + description : 'Use ZLIB to build driver. Default: enabled' +) option( 'sse2', type : 'boolean',