emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] ImageMagick Support on Windows


From: Eli Zaretskii
Subject: Re: [Emacs-diffs] ImageMagick Support on Windows
Date: Tue, 14 Oct 2014 15:16:20 +0300

> Date: Tue, 14 Oct 2014 12:17:33 +0200
> From: Alexander Shukaev <address@hidden>
> Cc: address@hidden
> 
>     . 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 via email to

[Prev in Thread] Current Thread [Next in Thread]