From c40efca157f38db671891124de9c8ff82a97c47c Mon Sep 17 00:00:00 2001 From: Urvang Joshi Date: Thu, 15 Nov 2012 11:04:12 -0800 Subject: [PATCH] gif2webp build support with autoconf tools Change-Id: I51a007e7931f05f2eb2ac062038309c2127df3fd --- configure.ac | 26 ++++++++++++++++++++++++++ examples/Makefile.am | 10 ++++++++++ examples/gif2webp.c | 2 -- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index f6d39bbc..4cb6642c 100644 --- a/configure.ac +++ b/configure.ac @@ -148,6 +148,32 @@ AC_SUBST(TIFF_INCLUDES) CPPFLAGS=$SAVED_CPPFLAGS LIBS=$SAVED_LIBS +dnl === check for GIF support === + +WEBP_HAVE_GIF="" +GIF_LIBS="" +WITHLIB_OPTION([gif], [GIF]) + +SAVED_LIBS=$LIBS +LIBS="$GIF_LIBS $LIBS" + +AC_CHECK_HEADER(gif_lib.h, + AC_CHECK_LIB([gif], [DGifOpenFileHandle], + [GIF_LIBS="$GIF_LIBS -lgif" + WEBP_HAVE_GIF=1 + ], + AC_MSG_WARN(Optional gif library not found), + [$MATH_LIBS]), + AC_MSG_WARN(gif library not available - no gif_lib.h) +) +AC_SUBST(GIF_LIBS) + +CPPFLAGS=$SAVED_CPPFLAGS +LIBS=$SAVED_LIBS + +AM_CONDITIONAL([BUILD_GIF2WEBP], [test "$WEBP_HAVE_GIF" = "1" -a \ + "$enable_experimental_libwebpmux" = "yes"]) + dnl === check for WIC support === if test "$target_os" = "mingw32"; then diff --git a/examples/Makefile.am b/examples/Makefile.am index 9324f0ea..140b654e 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -4,6 +4,11 @@ bin_PROGRAMS = dwebp cwebp if WANT_MUX bin_PROGRAMS += webpmux endif + +if BUILD_GIF2WEBP + bin_PROGRAMS += gif2webp +endif + noinst_LTLIBRARIES = libexampleutil.la libexampleutil_la_SOURCES = example_util.c @@ -20,6 +25,11 @@ cwebp_CPPFLAGS = $(AM_CPPFLAGS) $(USE_EXPERIMENTAL_CODE) cwebp_CPPFLAGS += $(JPEG_INCLUDES) $(PNG_INCLUDES) $(TIFF_INCLUDES) cwebp_LDADD = ../src/libwebp.la $(JPEG_LIBS) $(PNG_LIBS) $(TIFF_LIBS) +gif2webp_SOURCES = gif2webp.c +gif2webp_CPPFLAGS = $(AM_CPPFLAGS) $(USE_EXPERIMENTAL_CODE) +gif2webp_LDADD = libexampleutil.la ../src/mux/libwebpmux.la ../src/libwebp.la +gif2webp_LDADD += $(GIF_LIBS) + webpmux_SOURCES = webpmux.c webpmux_CPPFLAGS = $(AM_CPPFLAGS) $(USE_EXPERIMENTAL_CODE) webpmux_LDADD = libexampleutil.la ../src/mux/libwebpmux.la ../src/libwebp.la diff --git a/examples/gif2webp.c b/examples/gif2webp.c index 1d16fc94..04c93735 100644 --- a/examples/gif2webp.c +++ b/examples/gif2webp.c @@ -19,8 +19,6 @@ #include "config.h" #endif -// TODO(later): Use WEBP_USE_GIF flag here, determined at config time. - #include #include "webp/encode.h" #include "webp/mux.h"