]> git.lyx.org Git - lyx.git/blob - config/spell.m4
8185939c4250ad2a904c54d5ff43c9bfaaee83c0
[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                 else
21                         AC_MSG_RESULT(no)
22                 fi
23         fi
24         ])
25
26 # Macro to add for using enchant spellchecker libraries!     -*- sh -*-
27 AC_DEFUN([CHECK_WITH_ENCHANT],
28 [
29         lyx_use_enchant=true
30         AC_ARG_WITH(enchant, AC_HELP_STRING([--without-enchant],[do not check for Enchant library]))
31         test "$with_enchant" = "no" && lyx_use_enchant=false
32
33         if $lyx_use_enchant; then
34                 PKG_CHECK_MODULES([ENCHANT], [enchant], [], [lyx_use_enchant=false])
35                 AC_MSG_CHECKING([whether to use enchant])
36                 if $lyx_use_enchant ; then
37                     AC_MSG_RESULT(yes)
38                     AC_DEFINE(USE_ENCHANT, 1, [Define as 1 to use the enchant library])
39                     lyx_flags="$lyx_flags use-enchant"
40                 else
41                     AC_MSG_RESULT(no)
42                 fi
43         fi
44     ])
45
46 # Macro to add for using hunspell spellchecker libraries!     -*- sh -*-
47 AC_DEFUN([CHECK_WITH_HUNSPELL],
48 [
49         lyx_use_hunspell=true
50         AC_ARG_WITH(hunspell, AC_HELP_STRING([--without-hunspell],[do not check for Hunspell library]))
51         test "$with_hunspell" = "no" && lyx_use_hunspell=false
52
53         if $lyx_use_hunspell ; then
54         PKG_CHECK_MODULES([HUNSPELL], [hunspell], [], [
55                   AC_CHECK_HEADERS(hunspell/hunspell.hxx,
56                     [lyx_use_hunspell=true; break;],
57                          [lyx_use_hunspell=false])
58                          AC_CHECK_LIB(hunspell, main, LIBS="-lhunspell $LIBS", lyx_use_hunspell=false)
59                 ])
60         AC_MSG_CHECKING([whether to use hunspell])
61         if $lyx_use_hunspell ; then
62                 AC_MSG_RESULT(yes)
63                 AC_DEFINE(USE_HUNSPELL, 1, [Define as 1 to use the hunspell library])
64                 lyx_flags="$lyx_flags use-hunspell"
65         else
66                 AC_MSG_RESULT(no)
67         fi
68     fi
69     ])
70
71 dnl Usage: LYX_USE_INCLUDED_HUNSPELL : select if the included hunspell should
72 dnl        be used.
73 AC_DEFUN([LYX_USE_INCLUDED_HUNSPELL],[
74         AC_MSG_CHECKING([whether to use included hunspell library])
75         AC_ARG_WITH(included-hunspell,
76                 [AC_HELP_STRING([--with-included-hunspell], [use the hunspell lib supplied with LyX instead of the system one])],
77                 [lyx_cv_with_included_hunspell=$withval],
78                 [lyx_cv_with_included_hunspell=no])
79         AM_CONDITIONAL(USE_INCLUDED_HUNSPELL, test x$lyx_cv_with_included_hunspell = xyes)
80         AC_MSG_RESULT([$lyx_cv_with_included_hunspell])
81         if test x$lyx_cv_with_included_hunspell = xyes ; then
82                 lyx_included_libs="$lyx_included_libs hunspell"
83                 HUNSPELL_CFLAGS='-I$(top_srcdir)/3rdparty/hunspell/1.6.2/src'
84                 HUNSPELL_LIBS='$(top_builddir)/3rdparty/hunspell/liblyxhunspell.a'
85                 AC_SUBST(HUNSPELL_CFLAGS)
86                 AC_SUBST(HUNSPELL_LIBS)
87         fi
88         ])
89
90
91 ### Check if we want spell libraries, prefer new aspell or hunspell
92 AC_DEFUN([LYX_CHECK_SPELL_ENGINES],
93 [
94         LYX_USE_INCLUDED_HUNSPELL
95         if test x$lyx_cv_with_included_hunspell = xyes ; then
96 dnl the user wanted to use the included hunspell, so do not check for external hunspell
97                 lyx_use_hunspell=true
98                 AC_DEFINE(USE_HUNSPELL, 1, [Define as 1 to use the hunspell library])
99                 lyx_flags="$lyx_flags use-hunspell"
100         else
101                 CHECK_WITH_HUNSPELL
102         fi
103         CHECK_WITH_ASPELL
104         CHECK_WITH_ENCHANT
105
106         AM_CONDITIONAL(USE_ASPELL, $lyx_use_aspell)
107         AM_CONDITIONAL(USE_ENCHANT, $lyx_use_enchant)
108         AM_CONDITIONAL(USE_HUNSPELL, $lyx_use_hunspell)
109         ])
110