summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2021-04-16 18:32:34 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2021-04-16 18:32:34 +0100
commit9284c568592645661af87febf5efd1c6bb28d424 (patch)
tree0032a1c6cf2c167c15a6608c214bd88dea5ca3b4 /meson.build
parentd9b59fb70cdade59f56710360c6b52e9a19d9a13 (diff)
downloadgdk-pixbuf-9284c568592645661af87febf5efd1c6bb28d424.tar.gz
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.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build25
1 files changed, 19 insertions, 6 deletions
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