]> git.lyx.org Git - lyx.git/blob - config/spell.m4
Renamed Changelog.txt to ChangeLog.txt
[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([--with-aspell],[use ASpell libraries]))
7     test "$with_aspell" = "no" && lyx_use_aspell=false
8
9     if $lyx_use_aspell ; then
10         AC_CHECK_HEADERS(aspell.h aspell/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
27 # Macro to add for using pspell spellchecker libraries!     -*- sh -*-
28 # @author@: Jürgen Vigna
29 AC_DEFUN([CHECK_WITH_PSPELL],
30 [
31     lyx_use_pspell=true
32     AC_ARG_WITH(pspell, AC_HELP_STRING([--with-pspell],[use PSpell libraries]))
33     test "$with_pspell" = "no" && lyx_use_pspell=false
34
35     if $lyx_use_pspell ; then
36         AC_CHECK_HEADERS(pspell/pspell.h,, lyx_use_pspell=false)
37         AC_CHECK_LIB(pspell, main, LIBS="-lpspell $LIBS", lyx_use_pspell=false)
38
39         AC_MSG_CHECKING([whether to use pspell])
40         if $lyx_use_pspell ; then
41             AC_MSG_RESULT(yes)
42             AC_DEFINE(USE_PSPELL, 1, [Define as 1 to use the pspell library])
43             lyx_flags="$lyx_flags use-pspell"
44         else
45             AC_MSG_RESULT(no)
46         fi
47     fi
48     ])
49
50 ### Check if we want spell libraries, prefer new aspell
51 AC_DEFUN([LYX_CHECK_SPELL_ENGINES],
52 [
53     lyx_use_aspell=false
54     lyx_use_pspell=false
55     lyx_use_ispell=false
56
57     dnl Prefer use of the aspell library over pspell.
58     CHECK_WITH_ASPELL
59     if $lyx_use_aspell ; then : ; else
60         CHECK_WITH_PSPELL
61     fi
62
63     dnl check for the ability to communicate through unix pipes
64     dnl with an external ispell process.
65     dnl Do this independent of the existence of the aspell, pspell libraries.
66     lyx_use_ispell=true
67     AC_LANG_PUSH(C)
68     AC_CHECK_FUNCS(fork,, [lyx_use_ispell=false])
69     AC_LANG_POP(C)
70     AC_MSG_CHECKING([whether to use ispell])
71     if $lyx_use_ispell ; then
72       AC_MSG_RESULT(yes)
73       AC_DEFINE(USE_ISPELL, 1, [Define as 1 to use an external ispell process to check spelling])
74       lyx_flags="$lyx_flags use-ispell"
75     else
76       AC_MSG_RESULT(no)
77     fi
78
79     AM_CONDITIONAL(USE_ASPELL, $lyx_use_aspell)
80     AM_CONDITIONAL(USE_PSPELL, $lyx_use_pspell)
81     AM_CONDITIONAL(USE_ISPELL, $lyx_use_ispell)
82     ])