From 9284c568592645661af87febf5efd1c6bb28d424 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 16 Apr 2021 18:32:34 +0100 Subject: build: Fix libjpeg checks We are checking for libjpeg only if we find a header to include, but the dependency check with pkg-config, and the fallback with a wrap file, should happen outside of that check. --- meson.build | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 4724bf5cc..738e447d4 100644 --- a/meson.build +++ b/meson.build @@ -332,17 +332,30 @@ if get_option('jpeg') and not native_windows_loaders jpeg_dep = cc.find_library('libjpeg', required: false) endif - if not jpeg_dep.found() - jpeg_dep = dependency('libjpeg', required: false, fallback: 'libjpeg') + if jpeg_dep.found() + enabled_loaders += 'jpeg' + loaders_deps += jpeg_dep endif + endif + + # If we couldn't find libjpeg in our include/linker paths, + # then use pkg-config, and if that fails, fall back to the + # wrap + if not enabled_loaders.contains('jpeg') + jpeg_dep = dependency('libjpeg', required: false, fallback: 'libjpeg') - if jpeg_dep.found() and cc.has_function('jpeg_destroy_decompress', dependencies: jpeg_dep) + if jpeg_dep.found() enabled_loaders += 'jpeg' loaders_deps += jpeg_dep + endif + endif + + if jpeg_dep.found() + has_destroy_decompress = cc.has_function('jpeg_destroy_decompress', dependencies: jpeg_dep) + has_simple_progression = cc.has_function('jpeg_simple_progression', dependencies: jpeg_dep) - gdk_pixbuf_conf.set('HAVE_PROGRESSIVE_JPEG', - cc.has_function('jpeg_simple_progression', - dependencies: jpeg_dep)) + if has_destroy_decompress and has_simple_progression + gdk_pixbuf_conf.set('HAVE_PROGRESSIVE_JPEG', has_simple_progression) endif endif endif -- cgit v1.2.1