]> git.lyx.org Git - lyx.git/blobdiff - config/spell.m4
Make branch compilable in C++98 mode again.
[lyx.git] / config / spell.m4
index 152e485ad77c597ba56398a831130b209d371d2e..d686a82951fe8035bb54eac4787afa16df61c057 100644 (file)
@@ -23,7 +23,21 @@ AC_DEFUN([CHECK_WITH_ASPELL],
        fi
        ])
 
-# Macro to add for using enchant spellchecker libraries!     -*- sh -*-
+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
@@ -31,16 +45,19 @@ AC_DEFUN([CHECK_WITH_ENCHANT],
        test "$with_enchant" = "no" && lyx_use_enchant=false
 
        if $lyx_use_enchant; then
-       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_flags="$lyx_flags use-enchant"
-       else
-           AC_MSG_RESULT(no)
-       fi
-    fi
+               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
     ])
 
 AC_DEFUN([LYX_HAVE_HUNSPELL_CXXABI],