1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4m4_pattern_allow
5
6AC_PREREQ(2.59)
7AC_INIT([hunspell],[1.3.3],[nemeth@numbertext.org])
8
9AC_CANONICAL_SYSTEM
10AC_SUBST(XFAILED)
11
12AM_INIT_AUTOMAKE(hunspell, 1.3.3)
13HUNSPELL_VERSION_MAJOR=`echo $VERSION | cut -d"." -f1`
14HUNSPELL_VERSION_MINOR=`echo $VERSION | cut -d"." -f2`
15AC_SUBST(HUNSPELL_VERSION_MAJOR)
16AC_SUBST(HUNSPELL_VERSION_MINOR)
17
18AC_CONFIG_SRCDIR([config.h.in])
19AC_CONFIG_HEADER([config.h])
20
21# Checks for programs.
22AC_PROG_CXX
23AC_PROG_CC
24AC_PROG_LIBTOOL
25AC_LIBTOOL_WIN32_DLL
26
27# Checks for libraries.
28
29# Checks for header files.
30
31AC_CHECK_HEADERS([fcntl.h libintl.h locale.h unistd.h error.h])
32
33# Checks for typedefs, structures, and compiler characteristics.
34AC_C_CONST
35AC_C_INLINE
36
37# Checks for library functions.
38AC_FUNC_ERROR_AT_LINE
39AC_HEADER_STDC
40AC_CHECK_FUNCS([memchr setlocale strchr strstr])
41
42dnl internationalization macros
43AM_GNU_GETTEXT
44AM_GNU_GETTEXT_VERSION(0.17)
45
46AC_ARG_WITH(warnings,[  --with-warnings         compile with warning messages], [
47     AC_DEFINE(HUNSPELL_WARNING_ON,1,"Define if you need warning messages")
48])
49
50AC_ARG_WITH(experimental,[  --with-experimental     compile with some extra functions], [
51     AC_DEFINE(HUNSPELL_EXPERIMENTAL,1,"Define if you use exterimental functions")
52])
53
54CURSESLIB=""
55AC_ARG_WITH(
56   [ui],
57   [AS_HELP_STRING([--with-ui],[support Curses user interface])],
58   [],
59   [with_ui=no]
60)
61AS_IF(
62   [test "x$with_ui" != xno],
63   [AC_CHECK_LIB(ncursesw,tparm,CURSESLIB=-lncursesw,
64     AC_CHECK_LIB(curses,tparm,CURSESLIB=-lcurses,
65       AC_CHECK_LIB(ncurses,tparm,CURSESLIB=-lncurses)))
66   if test "$CURSESLIB" != "" ; then
67     echo Compiling with curses user interface.
68     AC_DEFINE(HAVE_CURSES_H,1,"Define if you have the <curses.h> header")
69     if test "$CURSESLIB" != "-lncursesw" ; then
70       echo "No Unicode support on interactive console. (Install Ncursesw library.)"
71     else
72       AC_DEFINE(HAVE_NCURSESW_H,1,"Define if you have the <ncursesw/curses.h> header")
73     fi
74     AC_DEFINE(HUNSPELL_WARNING_ON,1,"Define if you need warning messages")
75   fi]
76)
77AC_SUBST(CURSESLIB)
78
79AC_ARG_WITH(
80   [readline],
81   [AS_HELP_STRING([--with-readline],[support fancy command input editing])],
82   [],
83   [with_readline=no]
84)
85rl=n
86AS_IF([test "x$with_readline" != xno],
87   [AC_CHECK_LIB(curses,tparm,TERMLIB=-lncurses,
88     AC_CHECK_LIB(termcap,tgetent,TERMLIB=-ltermcap))
89   LDSAVE=$LDFLAGS
90   LDFLAGS="$LDFLAGS $TERMLIB"
91   AC_CHECK_LIB(readline,readline,
92      [AC_CHECK_HEADER(readline/readline.h,
93      READLINELIB="-lreadline $TERMLIB";rl=y)],
94      READLINELIB="")
95   if test "$rl" = "y" ; then
96     echo Using the readline library.
97     AC_DEFINE(HAVE_READLINE,1,"Define if you have fancy command input editing with Readline")
98   fi
99   LDFLAGS=$LDSAVE]
100)
101AC_SUBST(READLINELIB)
102
103AC_CONFIG_FILES([Makefile
104		 hunspell.pc
105                 man/Makefile
106                 man/hu/Makefile
107                 intl/Makefile
108                 po/Makefile.in
109                 m4/Makefile
110		 src/Makefile
111		 src/hunspell/Makefile
112		 src/hunspell/hunvisapi.h
113		 src/parsers/Makefile
114		 src/tools/Makefile
115		 src/win_api/Makefile
116                 tests/Makefile
117                 tests/suggestiontest/Makefile])
118AC_OUTPUT
119