From: Paul Eggert <eggert@cs.ucla.edu>
To: Ulrich Mueller <ulm@gentoo.org>, Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: No support for ImageMagick 7 in emacs-26
Date: Mon, 26 Nov 2018 17:38:28 -0800 [thread overview]
Message-ID: <056e8aae-9a70-54e2-f3fd-19ede5bef749@cs.ucla.edu> (raw)
In-Reply-To: <w6glg5gcmqa.fsf@kph.uni-mainz.de>
[-- Attachment #1: Type: text/plain, Size: 1241 bytes --]
On 11/25/18 11:38 PM, Ulrich Mueller wrote:
>>> (In fact, Gentoo has a consolidated patch for 26.1:
>>> https://gitweb.gentoo.org/proj/emacs-patches.git/tree/emacs/26.1/02_all_imagemagick-7.patch)
> Effectively, the only code change in the consolidated patch is the
> following in image.c:
>
> - MagickRealType color_scale = 65535.0 / QuantumRange;
> + double quantum_range = QuantumRange;
> + MagickRealType color_scale = 65535.0 / quantum_range;
We don't need to apply this to the emacs-26 branch, as it does not
affect behavior and is used only to pacify a GCC warning. I suppose
Gentoo enables warnings somehow, and doesn't want that warning. But in
general we no longer worry about --enable-gcc-warnings diagnostics in
the emacs-26 branch.
Anyway, the business part of the Gentoo patch is everything else in that
patch.
On 11/26/18 9:38 AM, Eli Zaretskii wrote:
> The other one is that inclusion of a header file
> was moved to a different place for some reason. (Yes, I'm being
> paranoid
This is OK since exactly the same include files are included, in exactly
the same order, when HAVE_IMAGEMAGICK7 is not defined.
So how about the attached patch for the emacs-26 branch?
[-- Attachment #2: 0001-Support-ImageMagick-version-7.patch --]
[-- Type: text/x-patch, Size: 3462 bytes --]
From 9648f9e622471b36111847c0ed352303c8c09504 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 26 Nov 2018 17:37:16 -0800
Subject: [PATCH] Support ImageMagick version 7
Backport from master.
* configure.ac (HAVE_IMAGEMAGICK7): New macro.
(HAVE_IMAGEMAGICK): Also define if using ImageMagick 7 or later.
* src/image.c [HAVE_IMAGEMAGICK7]: Include
<MagickWand/MagickWand.h> and <MagickCore/version.h> instead of
<wand/MagickWand.h> and <magick/version.h>.
(PixelSetMagickColor, MagickPixelPacket) [HAVE_IMAGEMAGICK7]:
New compatibility definitions.
---
configure.ac | 15 +++++++++------
src/image.c | 13 +++++++++++--
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/configure.ac b/configure.ac
index dc6d776d45..a4d0feaad5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2521,11 +2521,14 @@ AC_DEFUN
HAVE_IMAGEMAGICK=no
if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${HAVE_W32}" = "yes"; then
if test "${with_imagemagick}" != "no"; then
- ## 6.3.5 is the earliest version known to work; see Bug#17339.
- ## 6.8.2 makes Emacs crash; see Bug#13867.
- ## 7 and later have not been ported to; See Bug#25967.
- IMAGEMAGICK_MODULE="Wand >= 6.3.5 Wand != 6.8.2 Wand < 7"
- EMACS_CHECK_MODULES([IMAGEMAGICK], [$IMAGEMAGICK_MODULE])
+ EMACS_CHECK_MODULES([IMAGEMAGICK], [MagickWand >= 7])
+ if test $HAVE_IMAGEMAGICK = yes; then
+ AC_DEFINE([HAVE_IMAGEMAGICK7], 1, [Define to 1 if using ImageMagick7.])
+ else
+ ## 6.3.5 is the earliest version known to work; see Bug#17339.
+ ## 6.8.2 makes Emacs crash; see Bug#13867.
+ EMACS_CHECK_MODULES([IMAGEMAGICK], [Wand >= 6.3.5 Wand != 6.8.2])
+ fi
if test $HAVE_IMAGEMAGICK = yes; then
OLD_CFLAGS=$CFLAGS
@@ -5404,7 +5407,7 @@ AC_DEFUN
Does Emacs use -lrsvg-2? ${HAVE_RSVG}
Does Emacs use cairo? ${HAVE_CAIRO}
Does Emacs use -llcms2? ${HAVE_LCMS2}
- Does Emacs use imagemagick (version 6)? ${HAVE_IMAGEMAGICK}
+ Does Emacs use imagemagick? ${HAVE_IMAGEMAGICK}
Does Emacs support sound? ${HAVE_SOUND}
Does Emacs use -lgpm? ${HAVE_GPM}
Does Emacs use -ldbus? ${HAVE_DBUS}
diff --git a/src/image.c b/src/image.c
index a6b2d9060b..cc99f33d5f 100644
--- a/src/image.c
+++ b/src/image.c
@@ -8272,11 +8272,20 @@ imagemagick_image_p (Lisp_Object object)
/* The GIF library also defines DrawRectangle, but its never used in Emacs.
Therefore rename the function so it doesn't collide with ImageMagick. */
#define DrawRectangle DrawRectangleGif
-#include <wand/MagickWand.h>
+
+#ifdef HAVE_IMAGEMAGICK7
+# include <MagickWand/MagickWand.h>
+# include <MagickCore/version.h>
+/* ImageMagick 7 compatibility definitions. */
+# define PixelSetMagickColor PixelSetPixelColor
+typedef PixelInfo MagickPixelPacket;
+#else
+# include <wand/MagickWand.h>
+# include <magick/version.h>
+#endif
/* ImageMagick 6.5.3 through 6.6.5 hid PixelGetMagickColor for some reason.
Emacs seems to work fine with the hidden version, so unhide it. */
-#include <magick/version.h>
#if 0x653 <= MagickLibVersion && MagickLibVersion <= 0x665
extern WandExport void PixelGetMagickColor (const PixelWand *,
MagickPixelPacket *);
--
2.19.1
next prev parent reply other threads:[~2018-11-27 1:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-25 8:26 No support for ImageMagick 7 in emacs-26 Ulrich Mueller
2018-11-25 16:26 ` Eli Zaretskii
2018-11-26 7:38 ` Ulrich Mueller
2018-11-26 17:38 ` Eli Zaretskii
2018-11-26 22:00 ` Ulrich Mueller
2018-11-26 22:07 ` Andreas Schwab
2018-11-27 5:48 ` Eli Zaretskii
2018-11-27 1:38 ` Paul Eggert [this message]
2018-11-27 6:14 ` Eli Zaretskii
2018-11-27 16:35 ` Paul Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=056e8aae-9a70-54e2-f3fd-19ede5bef749@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=ulm@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.