Rework trade route removal messages in the case a city is lost.
[freeciv.git] / m4 / magickwand.m4
blob3e9b1fadfc39c101f16f5c3cc4ea52299256ecd9
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               [  --with-magickwand[=DIR]   Imagemagick installation directory (optional)],
9               magickwand_dir="$withval", magickwand_dir="")
11   WAND_CONFIG_PATH=""
12   if test "x$magickwand_dir" = "x" ; then
13     AC_MSG_CHECKING([for MagickWand-config in default path])
15     for i in /usr/local /usr;
16     do
17       test -r $i/bin/${host}-MagicWand-config &&
18       WAND_CONFIG_PATH=$i/bin && WAND_CONFIG_NAME=${host}-MagickWand-config &&
19       break
20     done
22     if test x$WAND_CONFIG_PATH = x ; then
23       for i in /usr/local /usr;
24       do
25         test -r $i/bin/MagickWand-config &&
26         WAND_CONFIG_PATH=$i/bin && WAND_CONFIG_NAME=MagickWand-config && break
27       done
28     fi
29   else
30     AC_MSG_CHECKING([for MagickWand-config])
32     if test -r $magickwand_dir/${host}-MagickWand-config &&
33     WAND_CONFIG_PATH=$magickwand_dir && WAND_CONFIG_NAME=${host}-MagickWand-config
34     then
35       :
36     else
37       test -r $magickwand_dir/MagickWand-config &&
38       WAND_CONFIG_PATH=$magickwand_dir && WAND_CONFIG_NAME=MagickWand-config
39     fi
40   fi
42   if test -z "$WAND_CONFIG_PATH"; then
43     AC_MSG_RESULT(no)
45     WAND_CFLAGS=""
46     WAND_LIBS=""
48     wand=no
49   else
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])
60     wand=yes
62     dnl
63     dnl MagickWand uses -lbz2 (at least on opensuse) - test it
64     dnl
65     ac_save_CFLAGS="$CFLAGS"
66     ac_save_LIBS="$LIBS"
67     CFLAGS="$CFLAGS $WAND_CFLAGS"
68     LIBS="$WAND_LIBS $LIBS"
70     AC_MSG_CHECKING([for all development tools needed for MagickWand])
71     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <wand/magick_wand.h>]],
72 [MagickWand *mw = NewMagickWand();])], [AC_MSG_RESULT([yes])],
73 [AC_MSG_RESULT([no])
74 wand=no
75 AC_MSG_WARN([MagickWand deactivated due to missing development packages.])])
77     dnl
78     dnl reset variables to old values
79     dnl
80     CFLAGS="$ac_save_CFLAGS"
81     LIBS="$ac_save_LIBS"
82   fi
84   AC_SUBST(WAND_CFLAGS)
85   AC_SUBST(WAND_LIBS)
87   if test "x$wand" = "xyes" ; then
88     ifelse([$1], , :, [$1])
89   else
90     ifelse([$2], , :, [$2])
91   fi