+ ])
+
+AC_DEFUN([LYX_HAVE_ENCHANT2],
+[
+ AC_MSG_CHECKING([whether enchant is version 2.x at least])
+ save_CXXFLAGS=$CXXFLAGS
+ CXXFLAGS="$ENCHANT_CFLAGS $AM_CXXFLAGS $CXXFLAGS"
+
+ AC_TRY_COMPILE([#include <enchant++.h>],
+ [enchant::Broker broker;],
+ [AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_ENCHANT2, 1, [Define to 1 if enchant 2.x is detected])
+ ],
+ [AC_MSG_RESULT(no)])
+ CXXFLAGS=$save_CXXFLAGS
+])
+
+AC_DEFUN([CHECK_WITH_ENCHANT],
+[
+ lyx_use_enchant=true
+ AC_ARG_WITH(enchant, AC_HELP_STRING([--without-enchant],[do not check for Enchant library]))
+ test "$with_enchant" = "no" && lyx_use_enchant=false
+
+ if $lyx_use_enchant; then
+ PKG_CHECK_MODULES([ENCHANT], [enchant-2], [],
+ [PKG_CHECK_MODULES([ENCHANT], [enchant], [],
+ [lyx_use_enchant=false])])
+ AC_MSG_CHECKING([whether to use enchant])
+ if $lyx_use_enchant ; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(USE_ENCHANT, 1, [Define as 1 to use the enchant library])
+ LYX_HAVE_ENCHANT2
+ lyx_flags="$lyx_flags use-enchant"
+ else
+ AC_MSG_RESULT(no)
+ fi
+ fi