5 dnl This is derived from "Versioning" chapter of info libtool documentation.
7 dnl 4a) Increment when removing or changing interfaces.
8 ENCHANT_MAJOR_VERSION=1
9 dnl 4a) 5) Increment when adding interfaces.
10 dnl 6) Set to zero when removing or changing interfaces.
11 ENCHANT_MINOR_VERSION=6
12 dnl 3) Increment when interfaces not changed at all,
13 dnl only bug fixes or internal changes made.
14 dnl 4b) Set to zero when adding, removing or changing interfaces.
15 ENCHANT_MICRO_VERSION=1
18 MAJOR_VERSION_PLUS_MINOR_VERSION=`expr $ENCHANT_MAJOR_VERSION + $ENCHANT_MINOR_VERSION`
20 VERSION=$ENCHANT_MAJOR_VERSION.$ENCHANT_MINOR_VERSION.$ENCHANT_MICRO_VERSION
21 dnl Version info for libraries = CURRENT:REVISION:AGE
22 VERSION_INFO=$MAJOR_VERSION_PLUS_MINOR_VERSION:$ENCHANT_MICRO_VERSION:$ENCHANT_MINOR_VERSION
23 AC_SUBST(VERSION_INFO)
24 AC_SUBST(ENCHANT_MAJOR_VERSION)
25 AC_SUBST(ENCHANT_MINOR_VERSION)
26 AC_SUBST(ENCHANT_MICRO_VERSION)
28 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
31 dnl Checks for programs.
46 AC_CHECK_FUNCS(flock lockf)
49 AC_PROG_CXX(,have_cxx=no)
50 AM_CONDITIONAL(WITH_CXX, test "x$have_cxx" = "xyes")
52 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
54 PKG_CHECK_MODULES(ENCHANT, [glib-2.0 >= 2.6 gmodule-2.0])
56 dnl ===========================================================================
57 dnl check compiler flags
58 AC_DEFUN([ENCHANT_CC_TRY_FLAG], [
59 AC_MSG_CHECKING([whether $CC supports $1])
61 enchant_save_CFLAGS="$CFLAGS"
64 AC_COMPILE_IFELSE([ ], [enchant_cc_flag=yes], [enchant_cc_flag=no])
65 CFLAGS="$enchant_save_CFLAGS"
67 if test "x$enchant_cc_flag" = "xyes"; then
68 ifelse([$2], , :, [$2])
70 ifelse([$3], , :, [$3])
72 AC_MSG_RESULT([$enchant_cc_flag])
75 dnl check compiler flags
76 AC_DEFUN([ENCHANT_CXX_TRY_FLAG], [
77 AC_MSG_CHECKING([whether $CXX supports $1])
80 enchant_save_CXXFLAGS="$CXXFLAGS"
81 CXXFLAGS="$CXXFLAGS $1"
83 AC_COMPILE_IFELSE([ ], [enchant_cxx_flag=yes], [enchant_cxx_flag=no])
84 CXXFLAGS="$enchant_save_CXXFLAGS"
86 if test "x$enchant_cxx_flag" = "xyes"; then
87 ifelse([$2], , :, [$2])
89 ifelse([$3], , :, [$3])
91 AC_MSG_RESULT([$enchant_cxx_flag])
95 dnl Use lots of warning flags with gcc and compatible compilers
97 dnl Note: if you change the following variable, the cache is automatically
98 dnl skipped and all flags rechecked. So there's no need to do anything
99 dnl else. If for any reason you need to force a recheck, just change
100 dnl MAYBE_WARN in an ignorable way (like adding whitespace)
102 CC_MAYBE_WARN="-Wall -Wextra \
103 -Wsign-compare -Werror-implicit-function-declaration \
104 -Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
105 -Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
106 -Wpacked -Wswitch-enum -Wmissing-format-attribute \
107 -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
108 -Wdeclaration-after-statement -Wold-style-definition \
109 -Wno-missing-field-initializers -Wno-unused-parameter \
110 -Wno-attributes -Wno-long-long -Winline -fno-strict-aliasing"
112 # invalidate cached value if MAYBE_WARN has changed
113 if test "x$enchant_cv_warn_maybe" != "x$CC_MAYBE_WARN"; then
114 unset enchant_cv_warn_cflags
116 AC_CACHE_CHECK([for supported C warning flags], enchant_cv_warn_cflags, [
120 # Some warning options are not supported by all versions of
121 # gcc, so test all desired options against the current
124 # Note that there are some order dependencies
125 # here. Specifically, an option that disables a warning will
126 # have no net effect if a later option then enables that
127 # warnings, (perhaps implicitly). So we put some grouped
128 # options (-Wall and -Wextra) up front and the -Wno options
131 for W in $CC_MAYBE_WARN; do
132 ENCHANT_CC_TRY_FLAG([$W], [CC_WARN_CFLAGS="$CC_WARN_CFLAGS $W"])
135 enchant_cv_warn_cflags=$CC_WARN_CFLAGS
136 enchant_cv_warn_maybe=$CC_MAYBE_WARN
138 AC_MSG_CHECKING([which C warning flags were supported])])
139 CC_WARN_CFLAGS="$enchant_cv_warn_cflags"
140 AC_SUBST(CC_WARN_CFLAGS)
142 CXX_MAYBE_WARN="-Wall -Wextra \
144 -Wpointer-arith -Wwrite-strings \
145 -Wpacked -Wswitch-enum -Wmissing-format-attribute \
146 -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
147 -Wno-missing-field-initializers -Wno-unused-parameter \
148 -Wno-attributes -Wno-long-long -Winline -fno-strict-aliasing"
150 # invalidate cached value if MAYBE_WARN has changed
151 if test "x$enchant_cxx_cv_warn_maybe" != "x$CXX_MAYBE_WARN"; then
152 unset enchant_cxx_cv_warn_cflags
154 AC_CACHE_CHECK([for supported C++ warning flags], enchant_cxx_cv_warn_cflags, [
158 # Some warning options are not supported by all versions of
159 # gcc, so test all desired options against the current
162 # Note that there are some order dependencies
163 # here. Specifically, an option that disables a warning will
164 # have no net effect if a later option then enables that
165 # warnings, (perhaps implicitly). So we put some grouped
166 # options (-Wall and -Wextra) up front and the -Wno options
169 for W in $CXX_MAYBE_WARN; do
170 ENCHANT_CXX_TRY_FLAG([$W], [CXX_WARN_CFLAGS="$CXX_WARN_CFLAGS $W"])
173 enchant_cxx_cv_warn_cflags=$CXX_WARN_CFLAGS
174 enchant_cxx_cv_warn_maybe=$CXX_MAYBE_WARN
176 AC_MSG_CHECKING([which C++ warning flags were supported])])
177 CXX_WARN_CFLAGS="$enchant_cxx_cv_warn_cflags"
178 AC_SUBST(CXX_WARN_CFLAGS)
180 ENCHANT_CFLAGS="$ENCHANT_CFLAGS -DENCHANT_PREFIX_DIR='\"$prefix\"'"
182 AC_SUBST(ENCHANT_CFLAGS)
183 AC_SUBST(ENCHANT_LIBS)
185 AC_MSG_CHECKING([for native Win32])
189 SOCKET_LIBS='-lws2_32 -ldnsapi'
190 ENCHANT_WIN32_RESOURCE=enchant-win32res.lo
195 ENCHANT_WIN32_RESOURCE=
198 AC_MSG_RESULT([$native_win32])
199 AM_CONDITIONAL(OS_WIN32, test "x$native_win32" = "xyes")
200 AC_SUBST([ENCHANT_WIN32_RESOURCE])
202 AC_MSG_CHECKING([for OS X])
211 AC_MSG_RESULT([$check_applespell])
213 AC_SUBST(SOCKET_LIBS)
215 # Courtesy of Glib: Ensure MSVC-compatible struct packing convention
216 # is used when compiling for Win32 with gcc.
217 # What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
218 # gcc2 uses "-fnative-struct".
219 if test x"$native_win32" = xyes; then
220 if test x"$GCC" = xyes; then
222 AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
223 if test -z "$ac_cv_prog_CC"; then
226 our_gcc="$ac_cv_prog_CC"
228 case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
230 if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
231 msnative_struct='-fnative-struct'
235 if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
236 msnative_struct='-mms-bitfields'
240 if test x"$msnative_struct" = x ; then
241 AC_MSG_RESULT([no way])
242 AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
244 CFLAGS="$CFLAGS $msnative_struct"
245 CXXFLAGS="$CXXFLAGS $msnative_struct"
246 AC_MSG_RESULT([${msnative_struct}])
251 dnl ===========================================================================
253 m4_copy([AC_DEFUN],[glib_DEFUN])
254 glib_DEFUN([GLIB_LC_MESSAGES],
255 [AC_CHECK_HEADERS([locale.h])
256 if test $ac_cv_header_locale_h = yes; then
257 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
258 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
259 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
260 if test $am_cv_val_LC_MESSAGES = yes; then
261 AC_DEFINE(HAVE_LC_MESSAGES, 1,
262 [Define if your <locale.h> file defines LC_MESSAGES.])
268 dnl ===========================================================================
272 AM_CONDITIONAL(WITH_BINRELOC, test "x$br_cv_binreloc" = "xyes")
276 AC_ARG_ENABLE(ispell, AS_HELP_STRING([--disable-ispell],[enable the ispell backend @<:@default=auto@:>@]), build_ispell="$enableval", build_ispell=yes)
278 if test "x$have_cxx" = "xno"; then
281 AM_CONDITIONAL(WITH_ISPELL, test "x$build_ispell" = "xyes")
283 ispell_dir=${datadir}/enchant/ispell
284 AC_ARG_WITH(ispell-dir, AS_HELP_STRING([--with-ispell-dir=PATH],[path to installed ispell dicts]))
286 if test "x$with_ispell_dir" != "x" ; then
287 ispell_dir=$with_ispell_dir
290 ISPELL_CFLAGS="-DENCHANT_ISPELL_DICT_DIR='\"$ispell_dir\"'"
291 AC_SUBST(ISPELL_CFLAGS)
295 AC_ARG_ENABLE(myspell, AS_HELP_STRING([--disable-myspell],[enable the myspell backend @<:@default=auto@:>@]), build_myspell="$enableval", build_myspell=yes)
297 if test "x$have_cxx" = "xno"; then
300 AM_CONDITIONAL(WITH_MYSPELL, test "x$build_myspell" = "xyes")
302 myspell_dir=${datadir}/myspell/dicts
303 AC_ARG_WITH(myspell-dir, AS_HELP_STRING([--with-myspell-dir=PATH],[path to installed myspell dicts]))
305 if test "x$with_myspell_dir" != "x" ; then
306 myspell_dir=$with_myspell_dir
309 MYSPELL_CFLAGS="$MYSPELL_CFLAGS -DENCHANT_MYSPELL_DICT_DIR='\"$myspell_dir\"'"
311 AC_ARG_WITH(system-myspell, AS_HELP_STRING([--with-system-myspell=yes/no],[use the system myspell/hunspell @<:@default=auto@:>@]))
312 if test "x$with_system_myspell" != "xno"; then
313 PKG_CHECK_MODULES(MYSPELL, [hunspell], have_system_myspell=true, have_system_myspell=false)
314 AC_SUBST(MYSPELL_CFLAGS)
315 AC_SUBST(MYSPELL_LIBS)
317 have_system_myspell=false;
319 AM_CONDITIONAL(WITH_SYSTEM_MYSPELL, test "x$have_system_myspell" = "xtrue")
324 AC_ARG_ENABLE(aspell, AS_HELP_STRING([--disable-aspell],[enable the aspell backend @<:@default=auto@:>@]), check_aspell="$enableval", check_aspell=yes)
326 AC_ARG_WITH(aspell-prefix, AS_HELP_STRING([--with-aspell-prefix=DIR],[specify under which prefix aspell is installed]), aspell_prefix="$withval", )
328 if test "x$check_aspell" != "xno"; then
329 saved_LDFLAGS=$LDFLAGS
332 if test "x$aspell_prefix" != "x"; then
333 LDFLAGS="-L$aspell_prefix/lib "$LDFLAGS
334 ASPELL_INC="-I$aspell_prefix/include"
335 ASPELL_LIBS="-L$aspell_prefix/lib -laspell"
337 aspell_prefix=${prefix}
338 if test "x$prefix" = "xNONE"; then
339 aspell_prefix="/usr/local"
342 AC_CHECK_PROG(HAVE_ASPELL, aspell, yes, no)
343 if test "x$HAVE_ASPELL" = "xyes"; then
344 AC_MSG_CHECKING([For Aspell >= 0.50.0])
345 aspell_major=`aspell -v | awk -F. '{print $4;}' | awk -F")" '{print $1;}'`
346 if test "$aspell_major" -ge "50"; then
347 aspell_prefix=`aspell config prefix`
348 LDFLAGS="-L${aspell_prefix}/lib "$LDFLAGS
349 ASPELL_INC="-I${aspell_prefix}/include"
350 ASPELL_LIBS="-L${aspell_prefix}/lib -laspell"
353 AC_MSG_RESULT([unknown])
357 if test "x$HAVE_ASPELL" != "xyes"; then
358 AC_MSG_WARN([Didn't find aspell >= 0.50.0 and no explicit path aspell specified. Guessing at $aspell_prefix])
359 ASPELL_LIBS="-L$aspell_prefix/lib -laspell"
363 AC_MSG_CHECKING([For aspell headers in $aspell_prefix/include])
364 if test -f "$aspell_prefix/include/pspell/pspell.h"; then
365 AC_MSG_RESULT([yes (pspell)])
367 AC_CHECK_LIB(aspell,new_aspell_config,build_aspell=yes,
368 [AC_CHECK_LIB(pspell, new_pspell_config, build_aspell=yes, AC_MSG_WARN([Enchant building without the aspell library]))]
370 AC_CHECK_LIB(aspell,get_aspell_dict_info_list,ASPELL_CFLAGS="-DASPELL_0_50_0=1",)
372 ASPELL_CFLAGS+=" -DHAVE_PSPELL_H"
373 elif test -f "$aspell_prefix/include/aspell.h"; then
374 AC_MSG_RESULT([yes (aspell)])
376 AC_CHECK_LIB(aspell,new_aspell_config,build_aspell=yes,
377 [AC_CHECK_LIB(pspell, new_pspell_config, build_aspell=yes, AC_MSG_WARN([Enchant building without the aspell library]))]
379 AC_CHECK_LIB(aspell,get_aspell_dict_info_list,ASPELL_CFLAGS="-DASPELL_0_50_0=1",)
382 if test "x$HAVE_ASPELL" = "xyes"; then
383 AC_MSG_WARN([Didn't find pspell (aspell) headers])
386 LDFLAGS=$saved_LDFLAGS
389 AC_SUBST(ASPELL_LIBS)
390 AC_SUBST(ASPELL_CFLAGS)
393 AM_CONDITIONAL(WITH_ASPELL, test "$build_aspell" = yes)
398 AC_ARG_ENABLE(voikko, AS_HELP_STRING([--disable-voikko],[enable the voikko backend @<:@default=auto@:>@]), check_voikko="$enableval", check_voikko=yes)
400 AC_ARG_WITH(voikko-prefix, AS_HELP_STRING([--with-voikko-prefix=DIR],[specify under which prefix voikko is installed]), voikko_prefix="$withval", )
402 if test "x$check_voikko" != "xno"; then
403 saved_LDFLAGS=$LDFLAGS
406 VOIKKO_LIBS="-lvoikko"
407 if test "x$voikko_prefix" != "x"; then
408 LDFLAGS="-L$voikko_prefix/lib "$LDFLAGS
409 VOIKKO_INC="-I$voikko_prefix/include"
410 VOIKKO_LIBS="-L$voikko_prefix/lib "$VOIKKO_LIBS
413 AC_CHECK_LIB(voikko,voikko_init,build_voikko=yes)
415 LDFLAGS=$saved_LDFLAGS
418 AC_SUBST(VOIKKO_LIBS)
421 AM_CONDITIONAL(WITH_VOIKKO, test "$build_voikko" = yes)
426 AC_ARG_ENABLE(uspell, AS_HELP_STRING([--disable-uspell],[enable the uspell backend @<:@default=auto@:>@]), check_uspell="$enableval", check_uspell=yes)
428 if test "x$have_cxx" = "xno"; then
432 if test "x$check_uspell" != "xno"; then
433 PKG_CHECK_MODULES(USPELL, [libuspell >= 1.1.0], build_uspell=yes, build_uspell=no)
436 uspell_dir=${datadir}/uspell
437 AC_ARG_WITH(uspell-dir, AS_HELP_STRING([--with-uspell-dir=PATH],[path to installed uspell dicts]))
439 if test "x$with_uspell_dir" != "x" ; then
440 uspell_dir=$with_uspell_dir
443 USPELL_CFLAGS="$USPELL_CFLAGS -DENCHANT_USPELL_DICT_DIR='\"$uspell_dir\"'"
444 AC_SUBST(USPELL_CFLAGS)
445 AC_SUBST(USPELL_LIBS)
447 AM_CONDITIONAL(WITH_USPELL, test "$build_uspell" = yes)
451 AC_ARG_ENABLE(hspell, AS_HELP_STRING([--disable-hspell],[enable the hspell backend @<:@default=auto@:>@]), check_hspell="$enableval", check_hspell=yes)
453 AC_ARG_WITH(hspell-prefix, AS_HELP_STRING([--with-hspell-prefix=DIR],[specify under which prefix hspell is installed]), hspell_prefix="$withval", )
455 dnl change to pkg-config when hspell provides a hspell.pc file
457 if test "x$check_hspell" != "xno"; then
458 saved_LDFLAGS=$LDFLAGS
461 HSPELL_LIBS=" -lhspell -lz"
463 if test "x$hspell_prefix" != "x"; then
464 LDFLAGS="-L$hspell_prefix/lib "$LDFLAGS
465 HSPELL_CFLAGS="-I$hspell_prefix/include"
466 HSPELL_LIBS="-L$hspell_prefix/lib "$HSPELL_LIBS
469 AC_CHECK_LIB(hspell, hspell_get_dictionary_path, build_hspell=yes, build_hspell=no, -lz)
470 LDFLAGS=$saved_LDFLAGS
472 AC_SUBST(HSPELL_CFLAGS)
473 AC_SUBST(HSPELL_LIBS)
476 AM_CONDITIONAL(WITH_HSPELL, test "$build_hspell" = yes)
480 AC_ARG_ENABLE(zemberek, AS_HELP_STRING([--disable-zemberek],[enable the experimental zemberek (turkish) backend @<:@default=auto@:>@]), build_zemberek="$enableval", build_zemberek=no)
482 if test "x$have_cxx" = "xno"; then
485 AC_MSG_CHECKING([For DBus-Glib >= 0.62])
486 if pkg-config --atleast-version=0.62 dbus-glib-1; then
487 ZEMBEREK_CFLAGS=`pkg-config --cflags dbus-glib-1`
488 ZEMBEREK_LIBS=`pkg-config --libs dbus-glib-1`
493 AC_SUBST(ZEMBEREK_CFLAGS)
494 AC_SUBST(ZEMBEREK_LIBS)
496 AM_CONDITIONAL(WITH_ZEMBEREK, test "x$build_zemberek" = "xyes")
498 zemberek_dir=${datadir}/enchant/zemberek
502 APPLESPELL_LDFLAGS=""
505 if test "x$check_applespell" = "xyes"; then
507 AC_ARG_ENABLE(applespell, AS_HELP_STRING([--disable-applespell],[enable the applespell backend @<:@default=no@:>@]), build_applespell="$enableval", build_applespell=no)
509 if test "x$build_applespell" != "xno"; then
510 APPLESPELL_CFLAGS+=" -DXP_TARGET_COCOA -xobjective-c"
511 APPLESPELL_LIBS+=" -lobjc"
512 APPLESPELL_LDFLAGS+=" -framework Cocoa"
517 AC_SUBST(APPLESPELL_CFLAGS)
518 AC_SUBST(APPLESPELL_LIBS)
519 AC_SUBST(APPLESPELL_LDFLAGS)
521 AM_CONDITIONAL(WITH_APPLESPELL, test "x$build_applespell" = "xyes")
523 dnl =======================================================================================
528 enchant-uninstalled.pc
537 src/applespell/Makefile
539 src/zemberek/Makefile
544 autopackage/default.apspec
547 dnl ===========================================================================================
549 relocatable_library="no"
550 if test "x$native_win32" = "xyes" || test "x$br_cv_binreloc" = "xyes"; then
551 relocatable_library="yes"
560 Build Aspell backend: ${build_aspell}
561 Build Ispell backend: ${build_ispell}
562 Build Uspell backend: ${build_uspell}
563 Build Hspell backend: ${build_hspell}
564 Build Myspell/Hunspell backend: ${build_myspell}
565 Build Voikko backend (Linux only): ${build_voikko}
566 Build Zemberek backend: ${build_zemberek}
567 Build Apple Spell backend (OS X only): ${build_applespell}
568 Build a relocatable library: ${relocatable_library}"
570 if test "x$build_zemberek" = "xyes"; then
572 The Zemberek Turkish spell-checking plugin is enabled. It is known
573 to cause crashes with WebKit. Use at your own discretion."