all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Alexander Shukaev <haroogan@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] ImageMagick Support on Windows
Date: Tue, 14 Oct 2014 15:16:20 +0300	[thread overview]
Message-ID: <83siiq6e3v.fsf@gnu.org> (raw)
In-Reply-To: <CAKu-7Wwbsyn01RPciQtiK9FwS7ohD_gJV3oqhs_WeO8AT=LOnw@mail.gmail.com>

> Date: Tue, 14 Oct 2014 12:17:33 +0200
> From: Alexander Shukaev <haroogan@gmail.com>
> Cc: emacs-devel@gnu.org
> 
>     . configure.ac needs changes to revert IMAGEMAGICK_LIBS to empty
>     value, because otherwise src/Makefile will cause Emacs binary to be
>     linked against the ImageMagick libraries, and the resulting binary
>     will then refuse to start if the corresponding DLL is not available
>     at run time. You can see the example of how we do that with
>     librsvg.
> 
> I'm not good at GNU Autotools stuff, sorry. Could you elaborate on
> this?

Sure, see below.

> I don't see that "IMAGEMAGICK_LIBS" would be assigned any value in
> "configure.ac".

Here:

  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.
      IMAGEMAGICK_MODULE="Wand >= 6.3.5 Wand != 6.8.2"
      EMACS_CHECK_MODULES([IMAGEMAGICK], [$IMAGEMAGICK_MODULE])
      AC_SUBST(IMAGEMAGICK_CFLAGS)
      AC_SUBST(IMAGEMAGICK_LIBS)  <<<<<<<<<<<<<<<<<<<<<<<<

For librsvg, we then empty the value, like this:

  ### Use -lrsvg-2 if available, unless `--with-rsvg=no' is specified.
  HAVE_RSVG=no
  if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${opsys}" = "mingw32"; then
    if test "${with_rsvg}" != "no"; then
      RSVG_REQUIRED=2.11.0
      RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"

      EMACS_CHECK_MODULES([RSVG], [$RSVG_MODULE])
      AC_SUBST(RSVG_CFLAGS)
      AC_SUBST(RSVG_LIBS)

      if test $HAVE_RSVG = yes; then
	AC_DEFINE(HAVE_RSVG, 1, [Define to 1 if using librsvg.])
	CFLAGS="$CFLAGS $RSVG_CFLAGS"
	# Windows loads librsvg dynamically   <<<<<<<<<<<<<<<<<<<<<<<<<<
	if test "${opsys}" = "mingw32"; then  <<<<<<<<<<<<<<<<<<<<<<<<<<
	  RSVG_LIBS=  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
	fi
      fi
    fi
  fi

> Nevertheless, on the linking stage I see:
> 
> -lMagickWand-6.Q16HDRI -lMagickCore-6.Q16HDRI
> 
> Is this what you meant?

Yes.  This is what causes Emacs to be linked against the ImageMagick
libraries, so it will then require them to be present when it starts.
Try starting your Emacs with the ImageMagick DLLs renamed or moved out
of PATH, and you will see what I mean.

By contrast, if you do the same with librsvg DLLs, Emacs will start
allright, it will just refuse to show RSVG images, if and when the
user requests that.  We want the same to happen for ImageMagick.

> Can I just safely assign it to empty value then?

Yes, in configure.ac, as shown above.

>     . dynamic-library-alist in w32-win.el should acquire an element
>     required for Emacs to know which DLL(s) to look for when
>     ImageMagick support is first required.
> 
> I assume adding something like:
> 
> '(imagemagick "libMagick++-6.Q16HDRI-5")
> 
> Is this correct?

Assuming the main ImageMagick DLL is named
'libMagick++-6.Q16HDRI-5.dll', yes.  But do include the .dll extension
explicitly, like we do for other image libraries.

>     . If there are several ImageMagick versions out there whose DLLs are
>     not binary compatible, you will need to add version checking, both
>     on init_imagemagick_functions and in dynamic-library-alist,
>     similarly to what we already do with some other image libraries,
>     like libgif, libjpeg, etc.
> 
> Well, I have no idea about that yet.

Then I guess we don't need to worry about that, until someone comes
with a problem and describes it.

Thanks.



  reply	other threads:[~2014-10-14 12:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.170157.1413191181.1146.emacs-diffs@gnu.org>
2014-10-13  9:29 ` [Emacs-diffs] ImageMagick Support on Windows Eli Zaretskii
2014-10-14 10:17   ` Alexander Shukaev
2014-10-14 12:16     ` Eli Zaretskii [this message]
2014-10-14 14:00       ` Alexander Shukaev
2014-10-14 15:15         ` Eli Zaretskii
2014-10-14 16:17           ` Alexander Shukaev
2014-10-14 18:32             ` Alexander Shukaev
2014-10-14 21:33               ` Alexander Shukaev
2014-10-15  5:49                 ` Eli Zaretskii
2014-10-15  9:27                   ` Alexander Shukaev
2014-10-15  9:38                     ` rzl24ozi
2014-10-15 10:35                       ` Eli Zaretskii
2014-10-15 12:02                         ` Alexander Shukaev
2014-10-15 12:36                           ` Eli Zaretskii
2014-10-15 10:30                     ` Eli Zaretskii

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=83siiq6e3v.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=haroogan@gmail.com \
    /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.