"libpng13d.dll" "libpng13.dll"))
'(jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll" "jpeg.dll")
'(tiff "libtiff3.dll" "libtiff.dll")
- '(gif "giflib4.dll" "libungif4.dll" "libungif.dll")
+ ;; Versions of giflib 5.0.0 and later changed signatures of
+ ;; several functions used by Emacs, which makes those versions
+ ;; incompatible with previous ones. We select the correct
+ ;; libraries according to the version of giflib we were
+ ;; compiled against. (If we were compiled without GIF support,
+ ;; libgif-version's value is -1.)
+ (if (>= libgif-version 50000)
+ ;; Yes, giflib 5.x uses 6 as the major version of the API,
+ ;; thus "libgif-6.dll" below (giflib 4.x used 5 as the
+ ;; major API version).
+ ;; giflib5.dll is from the lua-files project.
+ '(gif "libgif-6.dll" "giflib5.dll")
+ '(gif "libgif-5.dll" "giflib4.dll" "libungif4.dll" "libungif.dll"))
'(svg "librsvg-2-2.dll")
'(gdk-pixbuf "libgdk_pixbuf-2.0-0.dll")
'(glib "libglib-2.0-0.dll")
#define x_defined_color w32_defined_color
#define DefaultDepthOfScreen(screen) (one_w32_display_info.n_cbits)
-/* Version of libpng that we were compiled with, or -1 if no PNG
- support was compiled in. This is tested by w32-win.el to correctly
- set up the alist used to search for PNG libraries. */
-Lisp_Object Qlibpng_version;
+/* Versions of libpng and libgif that we were compiled with, or -1 if
+ no PNG/GIF support was compiled in. This is tested by w32-win.el
+ to correctly set up the alist used to search for the respective
+ image libraries. */
+Lisp_Object Qlibpng_version, Qlibgif_version;
#endif /* HAVE_NTGUI */
#ifdef HAVE_NS
#endif /* HAVE_NTGUI */
+/* Giflib before 5.0 didn't define these macros. */
#ifndef GIFLIB_MAJOR
-#define GIFLIB_MAJOR 0
+#define GIFLIB_MAJOR 4
+#endif
+#ifndef GIFLIB_MINOR
+#define GIFLIB_MINOR 0
+#endif
+#ifndef GIFLIB_RELEASE
+#define GIFLIB_RELEASE 0
#endif
#ifdef WINDOWSNT
#else
DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc, int *));
DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *, int *));
+DEF_IMGLIB_FN (char *, GifErrorString, (int));
#endif
static bool
LOAD_IMGLIB_FN (library, DGifSlurp);
LOAD_IMGLIB_FN (library, DGifOpen);
LOAD_IMGLIB_FN (library, DGifOpenFileName);
+#if GIFLIB_MAJOR >= 5
+ LOAD_IMGLIB_FN (library, GifErrorString);
+#endif
return 1;
}
#define fn_DGifSlurp DGifSlurp
#define fn_DGifOpen DGifOpen
#define fn_DGifOpenFileName DGifOpenFileName
+#define fn_GifErrorString GifErrorString
#endif /* WINDOWSNT */
Lisp_Object specified_data = image_spec_value (img->spec, QCdata, NULL);
unsigned long bgcolor = 0;
EMACS_INT idx;
+#if GIFLIB_MAJOR >= 5
+ int gif_err;
+#endif
if (NILP (specified_data))
{
/* Open the GIF file. */
#if GIFLIB_MAJOR < 5
gif = fn_DGifOpenFileName (SSDATA (file));
-#else
- gif = fn_DGifOpenFileName (SSDATA (file), NULL);
-#endif
if (gif == NULL)
{
image_error ("Cannot open `%s'", file, Qnil);
return 0;
}
+#else
+ gif = fn_DGifOpenFileName (SSDATA (file), &gif_err);
+ if (gif == NULL)
+ {
+ image_error ("Cannot open `%s': %s",
+ file, build_string (fn_GifErrorString (gif_err)));
+ return 0;
+ }
+#endif
}
else
{
#if GIFLIB_MAJOR < 5
gif = fn_DGifOpen (&memsrc, gif_read_from_memory);
-#else
- gif = fn_DGifOpen (&memsrc, gif_read_from_memory, NULL);
-#endif
if (!gif)
{
image_error ("Cannot open memory source `%s'", img->spec, Qnil);
return 0;
}
+#else
+ gif = fn_DGifOpen (&memsrc, gif_read_from_memory, &gif_err);
+ if (!gif)
+ {
+ image_error ("Cannot open memory source `%s': %s",
+ img->spec, build_string (fn_GifErrorString (gif_err)));
+ return 0;
+ }
+#endif
}
/* Before reading entire contents, check the declared image size. */
make_number (PNG_LIBPNG_VER)
#else
make_number (-1)
+#endif
+ );
+ DEFSYM (Qlibgif_version, "libgif-version");
+ Fset (Qlibgif_version,
+#ifdef HAVE_GIF
+ make_number (GIFLIB_MAJOR * 10000
+ + GIFLIB_MINOR * 100
+ + GIFLIB_RELEASE)
+#else
+ make_number (-1)
#endif
);
#endif