1 # Check for MagickWand (ImageMagick)
3 # FC_CHECK_MAGICKWAND([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
5 AC_DEFUN([FC_CHECK_MAGICKWAND],
7 AC_ARG_WITH([magickwand],
8 AS_HELP_STRING([--with-magickwand[=DIR]], [Imagemagick installation directory (optional)]),
9 [magickwand_dir="$withval"], [magickwand_dir=""])
12 if test "x$magickwand_dir" = "x" ; then
13 PKG_CHECK_MODULES([WAND], [MagickWand], [wand=yes], [wand=no])
15 if test "x$wand" = "xno" ; then
16 AC_MSG_CHECKING([for MagickWand-config in default path])
18 for i in /usr/local /usr;
20 test -r $i/bin/${host}-MagicWand-config &&
21 WAND_CONFIG_PATH=$i/bin && WAND_CONFIG_NAME=${host}-MagickWand-config &&
25 if test x$WAND_CONFIG_PATH = x ; then
26 for i in /usr/local /usr;
28 test -r $i/bin/MagickWand-config &&
29 WAND_CONFIG_PATH=$i/bin && WAND_CONFIG_NAME=MagickWand-config && break
34 AC_MSG_CHECKING([for MagickWand-config])
36 if test -r $magickwand_dir/${host}-MagickWand-config &&
37 WAND_CONFIG_PATH=$magickwand_dir && WAND_CONFIG_NAME=${host}-MagickWand-config
41 test -r $magickwand_dir/MagickWand-config &&
42 WAND_CONFIG_PATH=$magickwand_dir && WAND_CONFIG_NAME=MagickWand-config
46 if test "x$wand" != "xyes" ; then
47 if test -z "$WAND_CONFIG_PATH" ; then
50 AC_MSG_RESULT([found in $WAND_CONFIG_PATH])
52 AC_MSG_CHECKING([for $WAND_CONFIG_NAME --cflags])
53 WAND_CFLAGS="`$WAND_CONFIG_PATH/$WAND_CONFIG_NAME --cflags`"
54 AC_MSG_RESULT([$WAND_CFLAGS])
56 AC_MSG_CHECKING([for $WAND_CONFIG_NAME --libs])
57 WAND_LIBS="`$WAND_CONFIG_PATH/$WAND_CONFIG_NAME --libs`"
58 AC_MSG_RESULT([$WAND_LIBS])
64 if test "x$wand" = "xyes" ; then
66 dnl MagickWand uses -lbz2 (at least on opensuse) - test it
68 ac_save_CFLAGS="$CFLAGS"
70 CFLAGS="$CFLAGS $WAND_CFLAGS"
71 LIBS="$WAND_LIBS $LIBS"
73 AC_MSG_CHECKING([for all development tools needed for MagickWand])
74 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <wand/magick_wand.h>]],
75 [MagickWand *mw = NewMagickWand();])], [AC_MSG_RESULT([yes])],
78 AC_MSG_WARN([MagickWand deactivated due to missing development packages.])])
81 dnl reset variables to old values
83 CFLAGS="$ac_save_CFLAGS"
87 AC_SUBST([WAND_CFLAGS])
90 if test "x$wand" = "xyes" ; then
91 ifelse([$1], , :, [$1])
93 ifelse([$2], , :, [$2])