1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-28 09:22:27 +01:00

wrlib: Compile with either ImageMagick 6 and 7

We dropped ImageMagick 6 support in 0.95.9.  However, ImageMagick 6 is
still widespread (e.g., ImageMagick 7 has not been packaged in Debian
yet), and upstream plans on maintaining it until at least 2028 [1].

In this patch, we detect the version of the MagickWand library installed
on the user's system and include the appropriate header file when
building wrlib.

Note: I've only tested this with ImageMagick 6, so I'd appreciate
confirmation that it works with ImageMagick 7.

[1] https://github.com/ImageMagick/ImageMagick6/blob/master/NEWS.txt
This commit is contained in:
Doug Torrance
2020-04-18 14:28:40 -04:00
committed by Carlos R. Mafra
parent 27dc5efd2e
commit dfa92906c0
2 changed files with 11 additions and 3 deletions

View File

@@ -313,8 +313,12 @@ AS_IF([test "x$enable_magick" = "xno"],
dnl The library was found, check if header is available and compiles dnl The library was found, check if header is available and compiles
wm_save_CFLAGS="$CFLAGS" wm_save_CFLAGS="$CFLAGS"
AS_IF([wm_fn_lib_try_compile "MagickWand/MagickWand.h" "MagickWand *wand;" "wand = NewMagickWand()" "$wm_cv_libchk_magick_cflags"], AS_IF([wm_fn_lib_try_compile "MagickWand/MagickWand.h" "MagickWand *wand;" "wand = NewMagickWand()" "$wm_cv_libchk_magick_cflags"],
[wm_cv_libchk_magick="$wm_cv_libchk_magick_cflags % $wm_cv_libchk_magick_libs"], [wm_cv_libchk_magick="$wm_cv_libchk_magick_cflags % $wm_cv_libchk_magick_libs"
[AC_MSG_ERROR([found MagickWand library but could not compile its header])]) wm_cv_libchk_mgick_version=7],
[wm_fn_lib_try_compile "wand/magick_wand.h" "MagickWand *wand;" "wand = NewMagickWand()" "$wm_cv_libchk_magick_cflags"],
[wm_cv_libchk_magick="$wm_cv_libchk_magick_cflags % $wm_cv_libchk_magick_libs"
wm_cv_libchk_magick_version=6],
[AC_MSG_ERROR([found MagickWand library but could not compile its header])])
CFLAGS="$wm_save_CFLAGS"])dnl CFLAGS="$wm_save_CFLAGS"])dnl
]) ])
AS_IF([test "x$wm_cv_libchk_magick" = "xno"], AS_IF([test "x$wm_cv_libchk_magick" = "xno"],
@@ -323,7 +327,7 @@ AS_IF([test "x$enable_magick" = "xno"],
[supported_gfx="$supported_gfx Magick" [supported_gfx="$supported_gfx Magick"
MAGICKFLAGS=`echo "$wm_cv_libchk_magick" | sed -e 's, *%.*$,,' ` MAGICKFLAGS=`echo "$wm_cv_libchk_magick" | sed -e 's, *%.*$,,' `
MAGICKLIBS=`echo "$wm_cv_libchk_magick" | sed -e 's,^.*% *,,' ` MAGICKLIBS=`echo "$wm_cv_libchk_magick" | sed -e 's,^.*% *,,' `
AC_DEFINE([USE_MAGICK], [1], AC_DEFINE_UNQUOTED([USE_MAGICK], [$wm_cv_libchk_magick_version],
[defined when MagickWand library with header was found])]) [defined when MagickWand library with header was found])])
]) ])
AM_CONDITIONAL([USE_MAGICK], [test "x$enable_magick" != "xno"])dnl AM_CONDITIONAL([USE_MAGICK], [test "x$enable_magick" != "xno"])dnl

View File

@@ -22,7 +22,11 @@
#include "config.h" #include "config.h"
#if USE_MAGIC < 7
#include <wand/magick_wand.h>
#else
#include <MagickWand/MagickWand.h> #include <MagickWand/MagickWand.h>
#endif
#include "wraster.h" #include "wraster.h"
#include "imgformat.h" #include "imgformat.h"