meson: use better zlib dependency fallback

zlib is required, and if it isn't found it is checked several ways and
then forced via subproject(). This code was added in commit
b93e37592a, to account for systems where
zlib doesn't have pkg-config files installed.

But Meson already does dependency fallback, and also, since 0.54.0, does
the in-between checks for find_library('z') and has_header('zlib.h') via
the "system" type dependency. Simplify dependency lookup by marking it
as required, which also makes sure that the console log doesn't
confusingly list "not found".

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2484>
This commit is contained in:
Eli Schwartz 2022-05-23 21:24:40 -04:00 committed by GStreamer Marge Bot
parent 8433bab0b5
commit 79c3bbc2ed
2 changed files with 2 additions and 14 deletions

View file

@ -70,13 +70,7 @@ endif
core_conf.set('HAVE_ISO_CODES', have_iso_codes)
# could drop optional zlib dep and use g_zlib_decompressor_new()
zlib_dep = dependency('zlib', required : false)
if not zlib_dep.found()
zlib_dep = cc.find_library('z', required : false)
if not zlib_dep.found() or not cc.has_header('zlib.h')
zlib_dep = subproject('zlib').get_variable('zlib_dep')
endif
endif
zlib_dep = dependency('zlib')
core_conf.set('HAVE_ZLIB', true)
tag_deps = [gst_base_dep, libm, zlib_dep]

View file

@ -361,13 +361,7 @@ if have_gstgl
endif
endif
zlib_dep = dependency('zlib', required : false)
if not zlib_dep.found()
zlib_dep = cc.find_library('z', required : false)
if not zlib_dep.found() or not cc.has_header('zlib.h')
zlib_dep = subproject('zlib').get_variable('zlib_dep')
endif
endif
zlib_dep = dependency('zlib')
cdata.set('HAVE_ZLIB', true)
gio_dep = dependency('gio-2.0', version: glib_req)