From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: No support for ImageMagick 7 in emacs-26 Date: Mon, 26 Nov 2018 17:38:28 -0800 Organization: UCLA Computer Science Department Message-ID: <056e8aae-9a70-54e2-f3fd-19ede5bef749@cs.ucla.edu> References: <83efb9jf7x.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------8E597122C2408780656EFE35" X-Trace: blaine.gmane.org 1543282688 9664 195.159.176.226 (27 Nov 2018 01:38:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 27 Nov 2018 01:38:08 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 Cc: emacs-devel@gnu.org To: Ulrich Mueller , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 27 02:38:04 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gRSKC-0002PV-5F for ged-emacs-devel@m.gmane.org; Tue, 27 Nov 2018 02:38:04 +0100 Original-Received: from localhost ([::1]:39633 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRSMI-00084I-P7 for ged-emacs-devel@m.gmane.org; Mon, 26 Nov 2018 20:40:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRSKp-0007Ro-32 for emacs-devel@gnu.org; Mon, 26 Nov 2018 20:38:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRSKo-0002FL-4H for emacs-devel@gnu.org; Mon, 26 Nov 2018 20:38:43 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:55430) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRSKg-0002EX-R4; Mon, 26 Nov 2018 20:38:35 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id D8FB4160165; Mon, 26 Nov 2018 17:38:32 -0800 (PST) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id mJs_bGK8Aa6G; Mon, 26 Nov 2018 17:38:29 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 1DF6F16022A; Mon, 26 Nov 2018 17:38:29 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Xe0USzi0SXSQ; Mon, 26 Nov 2018 17:38:29 -0800 (PST) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 0012A1600A1; Mon, 26 Nov 2018 17:38:28 -0800 (PST) Openpgp: preference=signencrypt Autocrypt: addr=eggert@cs.ucla.edu; prefer-encrypt=mutual; keydata= xsFNBEyAcmQBEADAAyH2xoTu7ppG5D3a8FMZEon74dCvc4+q1XA2J2tBy2pwaTqfhpxxdGA9 Jj50UJ3PD4bSUEgN8tLZ0san47l5XTAFLi2456ciSl5m8sKaHlGdt9XmAAtmXqeZVIYX/UFS 96fDzf4xhEmm/y7LbYEPQdUdxu47xA5KhTYp5bltF3WYDz1Ygd7gx07Auwp7iw7eNvnoDTAl KAl8KYDZzbDNCQGEbpY3efZIvPdeI+FWQN4W+kghy+P6au6PrIIhYraeua7XDdb2LS1en3Ss mE3QjqfRqI/A2ue8JMwsvXe/WK38Ezs6x74iTaqI3AFH6ilAhDqpMnd/msSESNFt76DiO1ZK QMr9amVPknjfPmJISqdhgB1DlEdw34sROf6V8mZw0xfqT6PKE46LcFefzs0kbg4GORf8vjG2 Sf1tk5eU8MBiyN/bZ03bKNjNYMpODDQQwuP84kYLkX2wBxxMAhBxwbDVZudzxDZJ1C2VXujC OJVxq2kljBM9ETYuUGqd75AW2LXrLw6+MuIsHFAYAgRr7+KcwDgBAfwhPBYX34nSSiHlmLC+ KaHLeCLF5ZI2vKm3HEeCTtlOg7xZEONgwzL+fdKo+D6SoC8RRxJKs8a3sVfI4t6CnrQzvJbB n6gxdgCu5i29J1QCYrCYvql2UyFPAK+do99/1jOXT4m2836j1wARAQABzSBQYXVsIEVnZ2Vy dCA8ZWdnZXJ0QGNzLnVjbGEuZWR1PsLBfgQTAQIAKAUCTIByZAIbAwUJEswDAAYLCQgHAwIG FQgCCQoLBBYCAwECH In-Reply-To: Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:231426 Archived-At: This is a multi-part message in MIME format. --------------8E597122C2408780656EFE35 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable 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_a= ll_imagemagick-7.patch) > Effectively, the only code change in the consolidated patch is the > following in image.c: > > - MagickRealType color_scale =3D 65535.0 / QuantumRange; > + double quantum_range =3D QuantumRange; > + MagickRealType color_scale =3D 65535.0 / quantum_range; We don't need to apply this to the emacs-26 branch, as it does not=20 affect behavior and is used only to pacify a GCC warning. I suppose=20 Gentoo enables warnings somehow, and doesn't want that warning. But in=20 general we no longer worry about --enable-gcc-warnings diagnostics in=20 the emacs-26 branch. Anyway, the business part of the Gentoo patch is everything else in that=20 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.=C2=A0 (Yes, I'm being > paranoid This is OK since exactly the same include files are included, in exactly=20 the same order, when HAVE_IMAGEMAGICK7 is not defined. So how about the attached patch for the emacs-26 branch? --------------8E597122C2408780656EFE35 Content-Type: text/x-patch; name="0001-Support-ImageMagick-version-7.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Support-ImageMagick-version-7.patch" >From 9648f9e622471b36111847c0ed352303c8c09504 Mon Sep 17 00:00:00 2001 From: Paul Eggert 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 and instead of and . (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 + +#ifdef HAVE_IMAGEMAGICK7 +# include +# include +/* ImageMagick 7 compatibility definitions. */ +# define PixelSetMagickColor PixelSetPixelColor +typedef PixelInfo MagickPixelPacket; +#else +# include +# include +#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 #if 0x653 <= MagickLibVersion && MagickLibVersion <= 0x665 extern WandExport void PixelGetMagickColor (const PixelWand *, MagickPixelPacket *); -- 2.19.1 --------------8E597122C2408780656EFE35--