diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-02-16 01:57:52 +0000 |
---|---|---|
committer | Bryce Harrington <bryce@osg.samsung.com> | 2016-03-07 12:05:52 -0800 |
commit | 66e1614122c22d455cc3a28db08b3afac2b7be29 (patch) | |
tree | c49551cf367bd3d13dd70fedfe140755cf29fb95 /shared | |
parent | b00c79b587a4903df576008a64a49f851fed234c (diff) | |
download | weston-66e1614122c22d455cc3a28db08b3afac2b7be29.tar.gz |
configure: Make jpeglib an optional dependency.
It doesn’t make sense to fail the entire build when jpeglib isn’t
present, so this commit makes it optional just like libwebp in the
previous one, disabled with --without-jpeg and forced with --with-jpeg.
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Diffstat (limited to 'shared')
-rw-r--r-- | shared/image-loader.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/shared/image-loader.c b/shared/image-loader.c index 050f0677..f477dfd7 100644 --- a/shared/image-loader.c +++ b/shared/image-loader.c @@ -30,13 +30,16 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <jpeglib.h> #include <png.h> #include <pixman.h> #include "shared/helpers.h" #include "image-loader.h" +#ifdef HAVE_JPEG +#include <jpeglib.h> +#endif + #ifdef HAVE_WEBP #include <webp/decode.h> #endif @@ -48,6 +51,14 @@ stride_for_width(int width) } static void +pixman_image_destroy_func(pixman_image_t *image, void *data) +{ + free(data); +} + +#ifdef HAVE_JPEG + +static void swizzle_row(JSAMPLE *row, JDIMENSION width) { JSAMPLE *s; @@ -68,12 +79,6 @@ error_exit(j_common_ptr cinfo) longjmp(cinfo->client_data, 1); } -static void -pixman_image_destroy_func(pixman_image_t *image, void *data) -{ - free(data); -} - static pixman_image_t * load_jpeg(FILE *fp) { @@ -132,6 +137,17 @@ load_jpeg(FILE *fp) return pixman_image; } +#else + +static pixman_image_t * +load_jpeg(FILE *fp) +{ + fprintf(stderr, "JPEG support disabled at compile-time\n"); + return NULL; +} + +#endif + static inline int multiply_alpha(int alpha, int color) { |