summaryrefslogtreecommitdiff
path: root/configure.in
blob: c72a9c6a6bc5bbb8de0a769078d7e6405c8374b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
AC_INIT(src/enchant.h)

dnl Set release number
dnl This is derived from "Versioning" chapter of info libtool documentation.
PACKAGE=enchant
dnl     4a) Increment when removing or changing interfaces.
ENCHANT_MAJOR_VERSION=1
dnl     4a) 5) Increment when adding interfaces.
dnl     6) Set to zero when removing or changing interfaces.
ENCHANT_MINOR_VERSION=1
dnl     3) Increment when interfaces not changed at all,
dnl               only bug fixes or internal changes made.
dnl     4b) Set to zero when adding, removing or changing interfaces.
ENCHANT_MICRO_VERSION=3
dnl
dnl     Set this too
MAJOR_VERSION_PLUS_MINOR_VERSION=`expr $ENCHANT_MAJOR_VERSION + $ENCHANT_MINOR_VERSION`
dnl
VERSION=$ENCHANT_MAJOR_VERSION.$ENCHANT_MINOR_VERSION.$ENCHANT_MICRO_VERSION
dnl Version info for libraries = CURRENT:REVISION:AGE
VERSION_INFO=$MAJOR_VERSION_PLUS_MINOR_VERSION:$ENCHANT_MICRO_VERSION:$ENCHANT_MINOR_VERSION
AC_SUBST(VERSION_INFO)
AC_SUBST(ENCHANT_MAJOR_VERSION)
AC_SUBST(ENCHANT_MINOR_VERSION)
AC_SUBST(ENCHANT_MICRO_VERSION)

AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AM_MAINTAINER_MODE

dnl Checks for programs.
AC_ISC_POSIX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_STDC_HEADERS
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL

AC_C_CONST

AC_CHECK_FUNCS(flock lockf)

have_cxx=yes
AC_PROG_CXX(,have_cxx=no)
AM_CONDITIONAL(WITH_CXX, test "x$have_cxx" = "xyes")

AC_PATH_PROG(PKG_CONFIG, pkg-config, no)

PKG_CHECK_MODULES(ENCHANT, [glib-2.0 gmodule-2.0])

AC_SUBST(ENCHANT_CFLAGS)
AC_SUBST(ENCHANT_LIBS)

AC_MSG_CHECKING([for native Win32])
case "$host" in
  *-*-mingw*)
    native_win32=yes
    ;;
  *)
    native_win32=no
    ;;
esac
AC_MSG_RESULT([$native_win32])
AM_CONDITIONAL(OS_WIN32, test "x$native_win32" = "xyes")

build_ispell=yes

AC_ARG_ENABLE(ispell, [  --disable-ispell     enable the ispell backend [default=auto]], build_ispell="$enableval", build_ispell=yes)

if test "x$have_cxx" = "xno"; then
   build_ispell=no
fi
AM_CONDITIONAL(WITH_ISPELL, test "x$build_ispell" = "xyes")

ispell_dir=${datadir}/enchant/ispell
AC_ARG_WITH(ispell-dir, [  --with-ispell-dir=PATH    path to installed ispell dicts ])

if test "x$with_ispell_dir" != "x" ; then
   ispell_dir=$with_ispell_dir
fi

ISPELL_CFLAGS="-DENCHANT_ISPELL_DICT_DIR='\"$ispell_dir\"'"
AC_SUBST(ISPELL_CFLAGS)

build_myspell=yes

AC_ARG_ENABLE(myspell, [  --disable-myspell     enable the myspell backend [default=auto]], build_myspell="$enableval", build_myspell=yes)

if test "x$have_cxx" = "xno"; then
   build_myspell=no
fi
AM_CONDITIONAL(WITH_MYSPELL, test "x$build_myspell" = "xyes")

myspell_dir=${datadir}/enchant/myspell
AC_ARG_WITH(myspell-dir, [  --with-myspell-dir=PATH    path to installed myspell dicts ])

if test "x$with_myspell_dir" != "x" ; then
   myspell_dir=$with_myspell_dir
fi

MYSPELL_CFLAGS="-DENCHANT_MYSPELL_DICT_DIR='\"$myspell_dir\"'"
AC_SUBST(MYSPELL_CFLAGS)

check_aspell=yes
build_aspell=no

AC_ARG_ENABLE(aspell, [  --disable-aspell     enable the aspell backend [default=auto]], check_aspell="$enableval", check_aspell=yes)

AC_ARG_WITH(aspell-prefix, [  --with-aspell-prefix=DIR
                          specify under which prefix aspell is installed.], with_aspell_prefix="$withval", )

if test "x$check_aspell" != "xno"; then
   saved_LDFLAGS=$LDFLAGS

   if test "x$with_aspell_prefix" != "x"; then       
       LDFLAGS="-L$with_aspell_prefix/lib "$LDFLAGS
       ASPELL_INC="-I$with_aspell_prefix/include"
       ASPELL_LIBS="-L$with_aspell_prefix/lib -laspell"
       ASPELL_DICT_DIR="'\"$with_aspell_prefix/lib/aspell\"'"
   else
       aspell_prefix=${prefix}
       if test "x$prefix" = "xNONE"; then
	  aspell_prefix="/usr/local"
       fi

       AC_CHECK_PROG(HAVE_ASPELL, aspell, yes, no)
       if test "x$HAVE_ASPELL" = "xyes"; then
          #perl -e 'if (<STDIN> =~ /(.*) Aspell 0\.(.*)\.(.*)/) { print "$2\n"; } else { print "0\n"; }'`;
	  AC_MSG_CHECKING([For Aspell >= 0.50.0])
	  aspell_major=`aspell -v | awk -F. '{print $4;}'`
	  if test "$aspell_major" -ge "50"; then
              LDFLAGS="-L`aspell config prefix`/lib "$LDFLAGS
	      ASPELL_INC="-I`aspell config prefix`/include"
	      ASPELL_LIBS="-L`aspell config prefix`/lib -laspell"
	      ASPELL_DICT_DIR="'\"`aspell config dict-dir`\"'"

	      AC_MSG_RESULT([yes])
	  else
	      AC_MSG_RESULT([no])
	  fi
      fi

      if test "x$ASPELL_DICT_DIR" = "x"; then
	      AC_MSG_WARN([Didn't find aspell >= 0.50.0 and no explicit path aspell specified. Guessing at $aspell_prefix])
	      ASPELL_LIBS="-L$aspell_prefix/lib -laspell"
	      ASPELL_DICT_DIR="'\"$aspell_prefix/lib/aspell\"'"
      fi
   fi

   AC_CHECK_LIB(aspell,new_aspell_config,build_aspell=yes,
      [AC_CHECK_LIB(pspell, new_pspell_config, build_aspell=yes, AC_MSG_WARN([Enchant building without the aspell library]))]
      ,)
   LDFLAGS=$saved_LDFLAGS
   
   AC_SUBST(ASPELL_INC)
   AC_SUBST(ASPELL_LIBS)
   AC_SUBST(ASPELL_DICT_DIR)
fi

AM_CONDITIONAL(WITH_ASPELL, test "$build_aspell" = yes)

build_uspell=no

check_uspell=yes
AC_ARG_ENABLE(uspell, [  --disable-uspell     enable the uspell backend [default=auto]], check_uspell="$enableval", check_uspell=yes)

if test "x$have_cxx" = "xno"; then
   check_uspell=no
fi

if test "x$check_uspell" != "xno"; then
   PKG_CHECK_MODULES(USPELL, [libuspell >= 1.1.0], build_uspell=yes, build_uspell=no)
fi

uspell_dir=${datadir}/enchant/uspell
AC_ARG_WITH(uspell-dir, [  --with-uspell-dir=PATH    path to installed uspell dicts ])

if test "x$with_uspell_dir" != "x" ; then
   uspell_dir=$with_uspell_dir
fi

USPELL_CFLAGS="$USPELL_CFLAGS -DENCHANT_USPELL_DICT_DIR='\"$uspell_dict_dir\"'"
AC_SUBST(USPELL_CFLAGS)
AC_SUBST(USPELL_LIBS)

AM_CONDITIONAL(WITH_USPELL, test "$build_uspell" = yes)

build_hspell=no

check_hspell=yes
AC_ARG_ENABLE(hspell, [  --disable-hspell     enable the hspell backend [default=auto]], check_hspell="$enableval", check_hspell=yes)

dnl change to pkg-config when hspell will provide an hspell.pc file

if test "x$check_hspell" != "xno"; then
   AC_CHECK_LIB(hspell,hspell_check_word,build_hspell=yes, build_hspell=no)
fi

hspell_dir=${datadir}/enchant/hspell
AC_ARG_WITH(hspell-dir, [  --with-hspell-dir=PATH    path to installed hspell dicts ])

if test "x$with_hspell_dir" != "x" ; then
   hspell_dir=$with_hspell_dir
fi

HSPELL_LIBS=" -lhspell"
HSPELL_CFLAGS="$HSPELL_CFLAGS -DENCHANT_HSPELL_DICT_DIR='\"$hspell_dict_dir\"'"
AC_SUBST(HSPELL_CFLAGS)
AC_SUBST(HSPELL_LIBS)

AM_CONDITIONAL(WITH_HSPELL, test "$build_hspell" = yes)

dnl =======================================================================================

AC_OUTPUT([
Makefile
enchant.pc
enchant.spec
src/Makefile
src/aspell/Makefile
src/ispell/Makefile
src/uspell/Makefile
src/myspell/Makefile
src/hspell/Makefile
tests/Makefile
doc/Makefile
])

dnl ===========================================================================================
echo "
$PACKAGE-$VERSION

	prefix:                         ${prefix}
	compiler:                       ${CC}
	
	Build Aspell backend:           ${build_aspell}
	Build Ispell backend:           ${build_ispell}
	Build Uspell backend:           ${build_uspell}
	Build Myspell backend:          ${build_myspell}
	Build Hspell backend:           ${build_hspell}
"