fi
### Use -lwebp if available, unless '--with-webp=no'
-### mingw32 doesn't use -lwebp, since it loads the library dynamically.
HAVE_WEBP=no
if test "${with_webp}" != "no"; then
- if test "$opsys" = mingw32; then
- AC_CHECK_HEADER([webp/decode.h], [HAVE_WEBP=yes])
- elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes" \
- || test "${HAVE_NS}" = "yes"; then
+ if test "${HAVE_X11}" = "yes" || test "${opsys}" = "mingw32" \
+ || test "${HAVE_W32}" = "yes" || test "${HAVE_NS}" = "yes"; then
WEBP_REQUIRED=0.6.0
WEBP_MODULE="libwebp >= $WEBP_REQUIRED"
EMACS_CHECK_MODULES([WEBP], [$WEBP_MODULE])
AC_SUBST(WEBP_CFLAGS)
AC_SUBST(WEBP_LIBS)
-
- if test $HAVE_WEBP = yes; then
- AC_DEFINE(HAVE_WEBP, 1, [Define to 1 if using libwebp.])
- CFLAGS="$CFLAGS $WEBP_CFLAGS"
+ fi
+ if test $HAVE_WEBP = yes; then
+ AC_DEFINE(HAVE_WEBP, 1, [Define to 1 if using libwebp.])
+ CFLAGS="$CFLAGS $WEBP_CFLAGS"
+ # Windows loads libwebp dynamically
+ if test "${opsys}" = "mingw32"; then
+ WEBP_LIBS=
fi
fi
fi
'(gif "libgif-6.dll" "giflib5.dll" "gif.dll")
'(gif "libgif-5.dll" "giflib4.dll" "libungif4.dll" "libungif.dll")))
'(svg "librsvg-2-2.dll")
- '(libwebp "libwebp-7.dll" "libwebp.dll")
+ '(webp "libwebp-7.dll" "libwebp.dll")
'(gdk-pixbuf "libgdk_pixbuf-2.0-0.dll")
'(glib "libglib-2.0-0.dll")
'(gio "libgio-2.0-0.dll")
without it by specifying the --without-rsvg switch to the configure
script.
- For WebP images you will need libwebp:
+ For WebP images you will need libwebp. You can find it here:
+
+ http://sourceforge.net/projects/ezwinports/files/
+
+ Note: the MS-Windows binary distribution on the Google site:
https://developers.google.com/speed/webp/
+ were compiled by MSVC, and include only static libraries, no DLLs.
+ So you cannot use that to build Emacs with WebP support on
+ MS-Windows, as that needs libwebp as a DLL.
+
Binaries for the other image libraries can be found on the
ezwinports site or at the GnuWin32 project (the latter are generally
very old, so not recommended). Note specifically that, due to some
mingw-w64-x86_64-libpng \
mingw-w64-x86_64-libjpeg-turbo \
mingw-w64-x86_64-librsvg \
+ mingw-w64-x86_64-libwebp \
mingw-w64-x86_64-lcms2 \
mingw-w64-x86_64-jansson \
mingw-w64-x86_64-libxml2 \
/* WebP library details. */
DEF_DLL_FN (int, WebPGetInfo, (const uint8_t *, size_t, int *, int *));
-DEF_DLL_FN (VP8StatusCode, WebPGetFeatures, (const uint8_t *, size_t, WebPBitstreamFeatures *));
+/* WebPGetFeatures is a static inline function defined in WebP's
+ decode.h. Since we cannot use that with dynamically-loaded libwebp
+ DLL, we instead load the internal function it calls and redirect to
+ that through a macro. */
+DEF_DLL_FN (VP8StatusCode, WebPGetFeaturesInternal,
+ (const uint8_t *, size_t, WebPBitstreamFeatures *, int));
+DEF_DLL_FN (uint8_t *, WebPDecodeRGBA, (const uint8_t *, size_t, int *, int *));
DEF_DLL_FN (uint8_t *, WebPDecodeRGB, (const uint8_t *, size_t, int *, int *));
-DEF_DLL_FN (uint8_t *, WebPDecodeBGR, (const uint8_t *, size_t, int *, int *));
-DEF_DLL_FN (void, WebPFreeDecBuffer (WebPDecBuffer *));
+DEF_DLL_FN (void, WebPFree, (void *));
static bool
init_webp_functions (void)
return false;
LOAD_DLL_FN (library, WebPGetInfo);
- LOAD_DLL_FN (library, WebPGetFeatures);
+ LOAD_DLL_FN (library, WebPGetFeaturesInternal);
LOAD_DLL_FN (library, WebPDecodeRGBA);
LOAD_DLL_FN (library, WebPDecodeRGB);
LOAD_DLL_FN (library, WebPFree);
#undef WebPFree
#define WebPGetInfo fn_WebPGetInfo
-#define WebPGetFeatures fn_WebPGetFeatures
+#define WebPGetFeatures(d,s,f) \
+ fn_WebPGetFeaturesInternal(d,s,f,WEBP_DECODER_ABI_VERSION)
#define WebPDecodeRGBA fn_WebPDecodeRGBA
#define WebPDecodeRGB fn_WebPDecodeRGB
#define WebPFree fn_WebPFree