--- configure.orig	2008-05-28 08:01:28.000000000 -0700
+++ configure	2008-05-28 08:04:09.000000000 -0700
@@ -802,7 +802,7 @@
 LIBWPG_LIBS
 WITH_LIBWPG_TRUE
 WITH_LIBWPG_FALSE
-MAGICKPP_CONFIG
+IMAGEMAGICK_CFLAGS
 IMAGEMAGICK_LIBS
 USE_IMAGE_MAGICK_TRUE
 USE_IMAGE_MAGICK_FALSE
@@ -857,6 +857,8 @@
 INKBOARD_LIBS
 LIBWPG_CFLAGS
 LIBWPG_LIBS
+IMAGEMAGICK_CFLAGS
+IMAGEMAGICK_LIBS
 INKSCAPE_CFLAGS
 INKSCAPE_LIBS
 CAIRO_PDF_CFLAGS
@@ -1509,6 +1511,10 @@
   LIBWPG_CFLAGS
               C compiler flags for LIBWPG, overriding pkg-config
   LIBWPG_LIBS linker flags for LIBWPG, overriding pkg-config
+  IMAGEMAGICK_CFLAGS
+              C compiler flags for IMAGEMAGICK, overriding pkg-config
+  IMAGEMAGICK_LIBS
+              linker flags for IMAGEMAGICK, overriding pkg-config
   INKSCAPE_CFLAGS
               C compiler flags for INKSCAPE, overriding pkg-config
   INKSCAPE_LIBS
@@ -12715,11 +12721,11 @@
 
 
 if test "x$with_python" = "xyes"; then
-    checkPYTHON_CFLAGS=`python -c "import distutils.sysconfig ; print '-I%s' % distutils.sysconfig.get_config_var('INCLUDEPY')" 2>/dev/null`
+    checkPYTHON_CFLAGS=`${prefix}/bin/python2.5 -c "import distutils.sysconfig ; print '-I%s' % distutils.sysconfig.get_config_var('INCLUDEPY')" 2>/dev/null`
     if test "$?" -gt "0"; then
         with_python="no"
     else
-        checkPYTHON_LIBS=`python -c "import distutils.sysconfig ; print '%s/%s %s' % (distutils.sysconfig.get_config_var('LIBPL'),distutils.sysconfig.get_config_var('LDLIBRARY'),distutils.sysconfig.get_config_var('LIBS'))" 2>/dev/null`
+        checkPYTHON_LIBS=-lpython2.5
         if test "$?" -gt "0"; then
             with_python="no"
         else
@@ -13631,259 +13637,79 @@
 fi
 
 
+pkg_failed=no
+{ echo "$as_me:$LINENO: checking for IMAGEMAGICK" >&5
+echo $ECHO_N "checking for IMAGEMAGICK... " >&6; }
 
-
-
-
-{ echo "$as_me:$LINENO: checking for InitializeMagick in -lMagick++" >&5
-echo $ECHO_N "checking for InitializeMagick in -lMagick++... $ECHO_C" >&6; }
-if test "${ac_cv_lib_Magickpp_InitializeMagick+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lMagick++ -llcms -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lz -lpthread -lm -lpthread $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char InitializeMagick ();
-int
-main ()
-{
-return InitializeMagick ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if test -n "$IMAGEMAGICK_CFLAGS"; then
+    pkg_cv_IMAGEMAGICK_CFLAGS="$IMAGEMAGICK_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"ImageMagick++\"") >&5
+  ($PKG_CONFIG --exists --print-errors "ImageMagick++") 2>&5
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_Magickpp_InitializeMagick=yes
+  (exit $ac_status); }; then
+  pkg_cv_IMAGEMAGICK_CFLAGS=`$PKG_CONFIG --cflags "ImageMagick++" 2>/dev/null`
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_Magickpp_InitializeMagick=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  pkg_failed=yes
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_Magickpp_InitializeMagick" >&5
-echo "${ECHO_T}$ac_cv_lib_Magickpp_InitializeMagick" >&6; }
-if test $ac_cv_lib_Magickpp_InitializeMagick = yes; then
-  if test "${ac_cv_header_Magickpp_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for Magick++.h" >&5
-echo $ECHO_N "checking for Magick++.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_Magickpp_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+    pkg_failed=untried
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_Magickpp_h" >&5
-echo "${ECHO_T}$ac_cv_header_Magickpp_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking Magick++.h usability" >&5
-echo $ECHO_N "checking Magick++.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <Magick++.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if test -n "$IMAGEMAGICK_LIBS"; then
+    pkg_cv_IMAGEMAGICK_LIBS="$IMAGEMAGICK_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"ImageMagick++\"") >&5
+  ($PKG_CONFIG --exists --print-errors "ImageMagick++") 2>&5
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+  (exit $ac_status); }; then
+  pkg_cv_IMAGEMAGICK_LIBS=`$PKG_CONFIG --libs "ImageMagick++" 2>/dev/null`
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
+  pkg_failed=yes
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking Magick++.h presence" >&5
-echo $ECHO_N "checking Magick++.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <Magick++.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+ else
+    pkg_failed=untried
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: Magick++.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: Magick++.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: Magick++.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: Magick++.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: Magick++.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: Magick++.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: Magick++.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: Magick++.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: Magick++.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: Magick++.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: Magick++.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: Magick++.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: Magick++.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: Magick++.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: Magick++.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: Magick++.h: in the future, the compiler will take precedence" >&2;}
 
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for Magick++.h" >&5
-echo $ECHO_N "checking for Magick++.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_Magickpp_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_header_Magickpp_h=$ac_header_preproc
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_Magickpp_h" >&5
-echo "${ECHO_T}$ac_cv_header_Magickpp_h" >&6; }
+if test $pkg_failed = yes; then
 
-fi
-if test $ac_cv_header_Magickpp_h = yes; then
-  magick_ok=yes
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
 else
-  magick_ok=no
+        _pkg_short_errors_supported=no
 fi
+        if test $_pkg_short_errors_supported = yes; then
+                IMAGEMAGICK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "ImageMagick++" 2>&1`
+        else
+                IMAGEMAGICK_PKG_ERRORS=`$PKG_CONFIG --print-errors "ImageMagick++" 2>&1`
+        fi
+        # Put the nasty error message in config.log where it belongs
+        echo "$IMAGEMAGICK_PKG_ERRORS" >&5
 
-
+        { echo "$as_me:$LINENO: result: no" >&5
+echo "no" >&6; }
+                magick_ok=no
+elif test $pkg_failed = untried; then
+        magick_ok=no
 else
-  magick_ok=no
+        IMAGEMAGICK_CFLAGS=$pkg_cv_IMAGEMAGICK_CFLAGS
+        IMAGEMAGICK_LIBS=$pkg_cv_IMAGEMAGICK_LIBS
+        { echo "$as_me:$LINENO: result: yes" >&5
+echo "yes" >&6; }
+        magick_ok=yes
 fi
-
-
 if test "x$magick_ok" = "xyes"; then
-	# Extract the first word of "Magick++-config", so it can be a program name with args.
-set dummy Magick++-config; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_MAGICKPP_CONFIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$MAGICKPP_CONFIG"; then
-  ac_cv_prog_MAGICKPP_CONFIG="$MAGICKPP_CONFIG" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_MAGICKPP_CONFIG="yes"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_prog_MAGICKPP_CONFIG" && ac_cv_prog_MAGICKPP_CONFIG="no"
-fi
-fi
-MAGICKPP_CONFIG=$ac_cv_prog_MAGICKPP_CONFIG
-if test -n "$MAGICKPP_CONFIG"; then
-  { echo "$as_me:$LINENO: result: $MAGICKPP_CONFIG" >&5
-echo "${ECHO_T}$MAGICKPP_CONFIG" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-	if test "x$MAGICKPP_CONFIG" = "xyes"; then
-		IMAGEMAGICK_LIBS=`Magick++-config --libs`
-
 
 cat >>confdefs.h <<\_ACEOF
 #define WITH_IMAGE_MAGICK 1
 _ACEOF
 
-	fi
 fi
-
  if test "x$magick_ok" = "xyes"; then
   USE_IMAGE_MAGICK_TRUE=
   USE_IMAGE_MAGICK_FALSE='#'
@@ -13894,6 +13720,9 @@
 
 
 
+
+
+
 if test $cc_vers_major -gt 3; then
   min_sigc_version=2.0.12
 else
@@ -19146,7 +18975,7 @@
 LIBWPG_LIBS!$LIBWPG_LIBS$ac_delim
 WITH_LIBWPG_TRUE!$WITH_LIBWPG_TRUE$ac_delim
 WITH_LIBWPG_FALSE!$WITH_LIBWPG_FALSE$ac_delim
-MAGICKPP_CONFIG!$MAGICKPP_CONFIG$ac_delim
+IMAGEMAGICK_CFLAGS!$IMAGEMAGICK_CFLAGS$ac_delim
 IMAGEMAGICK_LIBS!$IMAGEMAGICK_LIBS$ac_delim
 USE_IMAGE_MAGICK_TRUE!$USE_IMAGE_MAGICK_TRUE$ac_delim
 USE_IMAGE_MAGICK_FALSE!$USE_IMAGE_MAGICK_FALSE$ac_delim
