From d14c81eec79c626f017e015c7ecf24d7662504bc Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Fri, 1 Nov 2013 10:52:22 +0200 Subject: [PATCH] Support newer versions of libjpeg on MS-Windows. src/image.c (Qlibjpeg_version): New variable. (syms_of_image): DEFSYM and initialize it. lisp/term/w32-win.el (dynamic-library-alist): Support newer versions of libjpeg starting with v7: look only for the DLL from the version against which Emacs was built. --- lisp/ChangeLog | 6 ++++++ lisp/term/w32-win.el | 11 ++++++++++- src/ChangeLog | 5 +++++ src/image.c | 19 ++++++++++++++----- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e99950276d8..eecc10efbb9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-11-01 Claudio Bley + + * term/w32-win.el (dynamic-library-alist): Support newer versions + of libjpeg starting with v7: look only for the DLL from the + version against which Emacs was built. + 2013-11-01 Bozhidar Batsov * progmodes/ruby-mode.el (ruby-indent-tabs-mode) diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index 9690a5a7d75..bf5f1b6435c 100644 --- a/lisp/term/w32-win.el +++ b/lisp/term/w32-win.el @@ -221,8 +221,17 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") '(png "libpng12d.dll" "libpng12.dll" "libpng3.dll" "libpng.dll" ;; these are libpng 1.2.8 from GTK+ "libpng13d.dll" "libpng13.dll")) - '(jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll" "jpeg.dll") '(tiff "libtiff3.dll" "libtiff.dll") + (if (> libjpeg-version 62) + ;; Versions of libjpeg after 6b are incompatible with + ;; earlier versions, and each of versions 7, 8, and 9 is + ;; also incompatible with the preceding ones (the core data + ;; structures used for communications with the library + ;; gained additional members with each new version). So we + ;; must use only the version of the library which Emacs was + ;; compiled against. + (list 'jpeg (format "libjpeg-%d.dll" (/ libjpeg-version 10))) + '(jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll" "jpeg.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 diff --git a/src/ChangeLog b/src/ChangeLog index 0c76b176a1f..0d58733f4bf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-11-01 Claudio Bley + + * image.c (Qlibjpeg_version): New variable. + (syms_of_image): DEFSYM and initialize it. + 2013-10-31 Jan Djärv * emacs.c (main): Skip -psn args on OSX even if ! isatty (0). diff --git a/src/image.c b/src/image.c index 6691cfc8a10..fca1bb077f6 100644 --- a/src/image.c +++ b/src/image.c @@ -87,11 +87,12 @@ typedef struct w32_bitmap_record Bitmap_Record; #define x_defined_color w32_defined_color #define DefaultDepthOfScreen(screen) (one_w32_display_info.n_cbits) -/* 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; +/* Versions of libpng, libgif, and libjpeg 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, Qlibjpeg_version; + #endif /* HAVE_NTGUI */ #ifdef HAVE_NS @@ -9410,6 +9411,14 @@ non-numeric, there is no explicit limit on the size of images. */); + GIFLIB_RELEASE) #else make_number (-1) +#endif + ); + DEFSYM (Qlibjpeg_version, "libjpeg-version"); + Fset (Qlibjpeg_version, +#if HAVE_JPEG + make_number (JPEG_LIB_VERSION) +#else + make_number (-1) #endif ); #endif -- 2.39.2