]> git.lyx.org Git - lyx.git/blob - config/spell.m4
c1d881798923cf0935c168e733fb23097a44a970
[lyx.git] / config / spell.m4
1 # Macro to add for using aspell spellchecker libraries!     -*- sh -*-
2 # Only checks for "new" aspell, > 0.50
3 AC_DEFUN([CHECK_WITH_ASPELL],
4 [
5         lyx_use_aspell=true
6         AC_ARG_WITH(aspell, AC_HELP_STRING([--without-aspell],[do not check for ASpell library]))
7         test "$with_aspell" = "no" && lyx_use_aspell=false
8
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)
14
15         AC_MSG_CHECKING([whether to use aspell])
16         if $lyx_use_aspell ; then
17                 AC_MSG_RESULT(yes)
18                 AC_DEFINE(USE_ASPELL, 1, [Define as 1 to use the aspell library])
19                 lyx_flags="$lyx_flags use-aspell"
20                 ### Check for aspell framework name
21                 LYX_WITH_DIR([aspell-framework], [name of aspell framework],aspell_framework, [])
22                 AC_DEFINE_UNQUOTED([ASPELL_FRAMEWORK], "${lyx_cv_aspell_framework}", [Define as name of aspell framework])
23         else
24                 AC_MSG_RESULT(no)
25         fi
26         fi
27         ])
28
29 # Macro to add for using enchant spellchecker libraries!     -*- sh -*-
30 AC_DEFUN([CHECK_WITH_ENCHANT],
31 [
32         lyx_use_enchant=true
33         AC_ARG_WITH(enchant, AC_HELP_STRING([--without-enchant],[do not check for Enchant library]))
34         test "$with_enchant" = "no" && lyx_use_enchant=false
35
36         if $lyx_use_enchant; then
37         PKG_CHECK_MODULES([ENCHANT], [enchant], [], [lyx_use_enchant=false])
38         AC_MSG_CHECKING([whether to use enchant])
39         if $lyx_use_enchant ; then
40             AC_MSG_RESULT(yes)
41             AC_DEFINE(USE_ENCHANT, 1, [Define as 1 to use the enchant library])
42             lyx_flags="$lyx_flags use-enchant"
43         else
44             AC_MSG_RESULT(no)
45         fi
46     fi
47     ])
48
49 # Macro to add for using hunspell spellchecker libraries!     -*- sh -*-
50 AC_DEFUN([CHECK_WITH_HUNSPELL],
51 [
52         lyx_use_hunspell=true
53         AC_ARG_WITH(hunspell, AC_HELP_STRING([--without-hunspell],[do not check for Hunspell library]))
54         test "$with_hunspell" = "no" && lyx_use_hunspell=false
55
56         if $lyx_use_hunspell ; then
57         AC_CHECK_HEADERS(hunspell/hunspell.hxx,
58                 [lyx_use_hunspell=true; break;],
59                 [lyx_use_hunspell=false])
60         AC_CHECK_LIB(hunspell, main, LIBS="-lhunspell $LIBS", lyx_use_hunspell=false)
61
62         AC_MSG_CHECKING([whether to use hunspell])
63         if $lyx_use_hunspell ; then
64                 AC_MSG_RESULT(yes)
65                 AC_DEFINE(USE_HUNSPELL, 1, [Define as 1 to use the hunspell library])
66                 lyx_flags="$lyx_flags use-hunspell"
67         else
68                 AC_MSG_RESULT(no)
69         fi
70         fi
71         ])
72
73
74 ### Check if we want spell libraries, prefer new aspell or hunspell
75 AC_DEFUN([LYX_CHECK_SPELL_ENGINES],
76 [
77         CHECK_WITH_ASPELL
78         AM_CONDITIONAL(USE_ASPELL, $lyx_use_aspell)
79
80         CHECK_WITH_ENCHANT
81         AM_CONDITIONAL(USE_ENCHANT, $lyx_use_enchant)
82
83         CHECK_WITH_HUNSPELL
84         AM_CONDITIONAL(USE_HUNSPELL, $lyx_use_hunspell)
85         ])