1 # Macro to add for using aspell spellchecker libraries! -*- sh -*-
2 # Only checks for "new" aspell, > 0.50
3 AC_DEFUN([CHECK_WITH_ASPELL],
6 AC_ARG_WITH(aspell, AS_HELP_STRING([--without-aspell],[do not check for ASpell library]))
7 test "$with_aspell" = "no" && lyx_use_aspell=false
9 if $lyx_use_aspell ; then
10 AC_CHECK_HEADERS(aspell.h,
11 [lyx_use_aspell=true; break;],
12 [lyx_use_aspell=false])
13 AC_CHECK_LIB(aspell, new_aspell_config, LIBS="-laspell $LIBS", lyx_use_aspell=false)
15 AC_MSG_CHECKING([whether to use aspell])
16 if $lyx_use_aspell ; then
18 AC_DEFINE(USE_ASPELL, 1, [Define as 1 to use the aspell library])
19 lyx_flags="$lyx_flags use-aspell"
26 AC_DEFUN([LYX_HAVE_ENCHANT2],
28 AC_MSG_CHECKING([whether enchant is version 2.x at least])
29 save_CXXFLAGS=$CXXFLAGS
30 CXXFLAGS="$ENCHANT_CFLAGS $AM_CXXFLAGS $CXXFLAGS"
32 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <enchant++.h>]], [[enchant::Broker broker;]])],[AC_MSG_RESULT(yes)
33 AC_DEFINE(HAVE_ENCHANT2, 1, [Define to 1 if enchant 2.x is detected])
34 ],[AC_MSG_RESULT(no)])
35 CXXFLAGS=$save_CXXFLAGS
38 AC_DEFUN([CHECK_WITH_ENCHANT],
41 AC_ARG_WITH(enchant, AS_HELP_STRING([--without-enchant],[do not check for Enchant library]))
42 test "$with_enchant" = "no" && lyx_use_enchant=false
44 if $lyx_use_enchant; then
45 PKG_CHECK_MODULES([ENCHANT], [enchant-2], [],
46 [PKG_CHECK_MODULES([ENCHANT], [enchant], [],
47 [lyx_use_enchant=false])])
48 AC_MSG_CHECKING([whether to use enchant])
49 if $lyx_use_enchant ; then
51 AC_DEFINE(USE_ENCHANT, 1, [Define as 1 to use the enchant library])
53 lyx_flags="$lyx_flags use-enchant"
60 AC_DEFUN([LYX_HAVE_HUNSPELL_CXXABI],
62 AC_MSG_CHECKING([whether hunspell C++ (rather than C) ABI is provided])
63 save_CXXFLAGS=$CXXFLAGS
64 CXXFLAGS="$ENCHANT_CFLAGS $AM_CXXFLAGS $CXXFLAGS"
66 # in the C++ ABI, stem() returns a vector, in the C ABI, it returns an int
67 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <hunspell/hunspell.hxx>]], [[Hunspell sp("foo", "bar");
68 int i = sp.stem("test").size();]])],[AC_MSG_RESULT(yes)
69 AC_DEFINE(HAVE_HUNSPELL_CXXABI, 1, [Define to 1 if hunspell C++ (rather than C) ABI is detected])
70 have_hunspell_cxx_abi=yes
71 ],[AC_MSG_RESULT(no)])
72 CXXFLAGS=$save_CXXFLAGS
75 # Macro to add for using hunspell spellchecker libraries! -*- sh -*-
76 AC_DEFUN([CHECK_WITH_HUNSPELL],
79 AC_ARG_WITH(hunspell, AS_HELP_STRING([--without-hunspell],[do not check for Hunspell library]))
80 test "$with_hunspell" = "no" && lyx_use_hunspell=false
82 if $lyx_use_hunspell ; then
83 PKG_CHECK_MODULES([HUNSPELL], [hunspell], [], [
84 AC_CHECK_HEADERS(hunspell/hunspell.hxx,
85 [lyx_use_hunspell=true; break;],
86 [lyx_use_hunspell=false])
87 AC_CHECK_LIB(hunspell, main, LIBS="-lhunspell $LIBS", lyx_use_hunspell=false)
89 AC_MSG_CHECKING([whether to use hunspell])
90 if $lyx_use_hunspell ; then
92 AC_DEFINE(USE_HUNSPELL, 1, [Define as 1 to use the hunspell library])
93 lyx_flags="$lyx_flags use-hunspell"
98 LYX_HAVE_HUNSPELL_CXXABI
99 if test $enable_stdlib_debug = "yes" -a -n "$have_hunspell_cxx_abi" ; then
100 LYX_WARNING([Compiling LyX with stdlib-debug and system hunspell libraries may lead to
101 crashes. Consider using --disable-stdlib-debug or --with-included-hunspell.])
106 dnl Usage: LYX_USE_INCLUDED_HUNSPELL : select if the included hunspell should
108 AC_DEFUN([LYX_USE_INCLUDED_HUNSPELL],[
109 AC_MSG_CHECKING([whether to use included hunspell library])
110 AC_ARG_WITH(included-hunspell,
111 [AS_HELP_STRING([--with-included-hunspell], [use the hunspell lib supplied with LyX instead of the system one])],
112 [lyx_cv_with_included_hunspell=$withval],
113 [lyx_cv_with_included_hunspell=no])
114 AM_CONDITIONAL(USE_INCLUDED_HUNSPELL, test x$lyx_cv_with_included_hunspell = xyes)
115 AC_MSG_RESULT([$lyx_cv_with_included_hunspell])
116 if test x$lyx_cv_with_included_hunspell = xyes ; then
117 lyx_included_libs="$lyx_included_libs hunspell"
118 HUNSPELL_CFLAGS='-I$(top_srcdir)/3rdparty/hunspell/1.7.0/src'
119 HUNSPELL_LIBS='$(top_builddir)/3rdparty/hunspell/liblyxhunspell.a'
120 AC_SUBST(HUNSPELL_CFLAGS)
121 AC_SUBST(HUNSPELL_LIBS)
126 ### Check if we want spell libraries, prefer new aspell or hunspell
127 AC_DEFUN([LYX_CHECK_SPELL_ENGINES],
129 LYX_USE_INCLUDED_HUNSPELL
130 if test x$lyx_cv_with_included_hunspell = xyes ; then
131 dnl the user wanted to use the included hunspell, so do not check for external hunspell
132 lyx_use_hunspell=true
133 AC_DEFINE(USE_HUNSPELL, 1, [Define as 1 to use the hunspell library])
134 AC_DEFINE(HAVE_HUNSPELL_CXXABI, 1, [Define to 1 if hunspell C++ (rather than C) ABI is detected])
135 lyx_flags="$lyx_flags use-hunspell"
142 AM_CONDITIONAL(USE_ASPELL, $lyx_use_aspell)
143 AM_CONDITIONAL(USE_ENCHANT, $lyx_use_enchant)
144 AM_CONDITIONAL(USE_HUNSPELL, $lyx_use_hunspell)