Support newer versions of libjpeg on MS-Windows.
[bpt/emacs.git] / lisp / term / w32-win.el
index 95dab10..bf5f1b6 100644 (file)
@@ -1,6 +1,6 @@
 ;;; w32-win.el --- parse switches controlling interface with W32 window system -*- lexical-binding: t -*-
 
-;; Copyright (C) 1993-1994, 2001-201 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2013 Free Software Foundation, Inc.
 
 ;; Author: Kevin Gallo
 ;; Keywords: terminals
@@ -221,15 +221,37 @@ 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")
-       '(gif "giflib4.dll" "libungif4.dll" "libungif.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
+       ;; 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")
        '(gobject "libgobject-2.0-0.dll")
        '(gnutls "libgnutls-28.dll" "libgnutls-26.dll")
-       '(libxml2 "libxml2-2.dll" "libxml2.dll")))
+       '(libxml2 "libxml2-2.dll" "libxml2.dll")
+       '(zlib "zlib1.dll" "libz-1.dll")))
 
 ;;; multi-tty support
 (defvar w32-initialized nil
@@ -237,6 +259,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
 
 (declare-function x-open-connection "w32fns.c"
                   (display &optional xrm-string must-succeed))
+(declare-function create-default-fontset "fontset" ())
 (declare-function create-fontset-from-fontset-spec "fontset"
                   (fontset-spec &optional style-variant noerror))
 (declare-function create-fontset-from-x-resource "fontset" ())
@@ -246,7 +269,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
 (declare-function x-parse-geometry "frame.c" (string))
 (defvar x-command-line-resources)
 
-(defun w32-initialize-window-system ()
+(defun w32-initialize-window-system (&optional _display)
   "Initialize Emacs for W32 GUI frames."
   (cl-assert (not w32-initialized))