1dnl Process this file with autoconf to produce a configure script for dict.
2dnl
3dnl Created: Wed Apr 24 14:11:05 1996 by faith@dict.org
4dnl Copyright 1996-1999, 2001-2002 Rickard E. Faith (faith@dict.org)
5dnl Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net)
6dnl
7dnl This program is free software; you can redistribute it and/or modify it
8dnl under the terms of the GNU General Public License as published by the
9dnl Free Software Foundation; either version 1, or (at your option) any
10dnl later version.
11dnl
12dnl This program is distributed in the hope that it will be useful, but
13dnl WITHOUT ANY WARRANTY; without even the implied warranty of
14dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15dnl General Public License for more details.
16dnl
17dnl You should have received a copy of the GNU General Public License along
18dnl with this program; if not, write to the Free Software Foundation, Inc.,
19dnl 675 Mass Ave, Cambridge, MA 02139, USA.
20dnl
21dnl Flag conventions:
22dnl     CFLAGS and LDFLAGS should be settable on the make commandline
23dnl             for optimization and stripping.
24dnl     LIBOBJS is an automatically-generated list of extra objects we need
25
26
27define(VERSION, 1.13.1)
28
29
30AC_PREREQ(2.53)
31AC_REVISION($Revision: 1.144 $)
32
33AC_INIT([dict],[VERSION],[dict-beta@dict.org])
34
35AC_CONFIG_SRCDIR([dictd.c])
36AC_CONFIG_HEADER(config.h)
37
38echo Configuring for dict
39echo .
40
41DICT_VERSION=VERSION
42
43AC_CANONICAL_HOST
44
45AC_PROG_CC
46AC_PROG_CPP
47AC_PROG_CXX
48
49AC_ISC_POSIX
50
51REALCC="$CC"
52if test "$CC" = gcc; then
53    CFLAGS="$CFLAGS -Wall"
54    CFLAGS="$CFLAGS -Wwrite-strings -Wcast-align -Wmissing-prototypes"
55    CFLAGS="$CFLAGS -Wshadow -Wnested-externs -Waggregate-return"
56fi
57
58AC_ARG_ENABLE([plugin],[  --disable-plugin        without plugin support])
59if test "x${enableval}" != xno; then
60    AC_CHECK_LIB(c, dlopen,
61        [USE_PLUGIN=2],
62        AC_CHECK_LIB(dl, dlopen,
63            [LIBS="$LIBS -ldl"; USE_PLUGIN=2],
64            AC_CHECK_LIB(ltdl,lt_dlopen,
65                [LIBS="$LIBS -lltdl"; USE_PLUGIN=1])))
66fi
67
68dnl Checks for programs.
69echo Checking for programs
70
71AC_PROG_AWK
72AC_PROG_INSTALL
73AC_PROG_RANLIB
74AC_PROG_MAKE_SET
75AC_PROG_YACC
76AC_PROG_LEX
77
78AC_CHECK_PROG(LIBTOOL,libtool,libtool)
79
80AC_CHECK_PROGS(NROFF,gnroff nroff)
81AC_CHECK_PROGS(TROFF,groff troff)
82AC_CHECK_PROGS(COL,col cat)
83AC_CHECK_PROGS(EXPAND,expand cat)
84
85echo .
86echo Checking for libraries
87
88AC_CHECK_LIB(maa,maa_shutdown, [LIBMAA=-lmaa],
89	[AC_MSG_ERROR([Libmaa not found])])
90
91AC_ARG_WITH(plugin-dbi,
92[  --with-plugin-dbi       build libdbi plugin (plugin support should be enabled)],
93[
94if test "x${withval}" != xno; then
95       AC_CHECK_LIB(dbi,  dbi_shutdown,
96           [PLUGINS="$PLUGINS dictdplugin_dbi.la"],
97           [AC_MSG_ERROR([libdbi not found, cannot continue])])
98       AC_CHECK_HEADER([dbi/dbi.h],,
99           [AC_MSG_ERROR([dbi/dbi.h not found, cannot continue])])
100fi
101])
102
103AC_ARG_WITH(plugin-judy,
104[  --with-plugin-judy      build judy plugin (plugin support should be enabled)],
105[
106if test "x${withval}" != xno; then
107       AC_CHECK_LIB(Judy, JudySLNext,
108           [PLUGINS="$PLUGINS dictdplugin_judy.la"],
109           [AC_MSG_ERROR([libJudy not found, cannot continue])])
110       AC_CHECK_HEADER([Judy.h],,
111           [AC_MSG_ERROR([Judy.h not found, cannot continue])])
112fi
113])
114
115AC_CHECK_LIB(c,getnameinfo,
116	[true],
117	[AC_CHECK_LIB(socket,getnameinfo)])
118
119AC_CHECK_LIB(c,inet_ntop,
120	[true],
121	[AC_CHECK_LIB(nsl,inet_ntop)])
122
123echo .
124echo Checking for header files
125
126AC_HEADER_STDC
127AC_HEADER_TIME
128
129if test "x${USE_PLUGIN}" = "x2"; then
130   # We use native dlopen
131   AC_CHECK_HEADERS(dlfcn.h, [CFLAGS="$CFLAGS -DUSE_PLUGIN"], [USE_PLUGIN=])
132fi
133if test "x${USE_PLUGIN}" = "x1"; then
134   # We use libltdl
135   AC_CHECK_HEADERS(ltdl.h, [CFLAGS="$CFLAGS -DUSE_PLUGIN"], [USE_PLUGIN=])
136fi
137
138AC_CHECK_HEADER([zlib.h], ,
139    [AC_MSG_ERROR([zlib.h is required for dictd])])
140
141echo .
142echo Checking for system constants
143
144AC_C_CONST
145AC_C_INLINE
146
147echo .
148echo Checking for library functions
149
150AC_CHECK_FUNCS(dlopen)
151
152AC_CHECK_FUNC(daemon,, [AC_LIBOBJ([daemon3])])
153
154AC_FUNC_ALLOCA
155
156AC_REPLACE_FUNCS(setenv)
157AC_CHECK_FUNCS(putenv)
158
159AC_LIBOBJ([wcrtomb])
160AC_LIBOBJ([wctomb])
161AC_LIBOBJ([mbrlen])
162AC_LIBOBJ([mbrtowc])
163AC_LIBOBJ([mbstowcs])
164AC_LIBOBJ([mbtowc])
165AC_LIBOBJ([iswspace])
166AC_LIBOBJ([iswalnum])
167AC_LIBOBJ([towlower])
168#	AC_LIBOBJ([wcwidth])
169
170AC_REPLACE_FUNCS(strlcpy strlcat)
171
172echo .
173echo Making output files
174
175CC="$REALCC"
176
177test "_$exec_prefix" = _NONE && exec_prefix='${prefix}'
178
179eval3 () { eval echo $(eval echo $(eval echo $@)); }
180
181SYSCONFDIR=`eval3 $sysconfdir`
182BINDIR=`eval3 $bindir`
183SBINDIR=`eval3 $sbindir`
184LIBEXECDIR=`eval3 $libexecdir`
185DATADIR=`eval3 $datadir`
186
187AC_SUBST(DICT_VERSION)
188AC_SUBST(USE_PLUGIN)
189AC_SUBST(EXEEXT)
190AC_SUBST(allsubdirs)
191AC_SUBST(LIBTOOL)
192
193AC_SUBST(PLUGINS)
194
195AC_SUBST(SYSCONFDIR)
196AC_SUBST(BINDIR)
197AC_SUBST(SBINDIR)
198AC_SUBST(LIBEXECDIR)
199AC_SUBST(DATADIR)
200
201AC_SUBST(LIBMAA)
202AC_SUBST(srcdir)
203
204AC_CONFIG_FILES([Makefile doc/Makefile])
205AC_CONFIG_FILES([dictdplugin-config], [chmod +x dictdplugin-config])
206AC_CONFIG_FILES([dictl], [chmod +x dictl])
207AC_CONFIG_FILES([colorit], [chmod +x colorit])
208AC_CONFIG_FILES([dictunformat], [chmod +x dictunformat])
209AC_CONFIG_FILES([dictfmt_index2suffix], [chmod +x dictfmt_index2suffix])
210AC_CONFIG_FILES([dictfmt_index2word], [chmod +x dictfmt_index2word])
211AC_CONFIG_FILES([examples/dictd_popen.conf])
212
213AC_CONFIG_FILES(colorit.1)
214AC_CONFIG_FILES(dict.1)
215AC_CONFIG_FILES(dictfmt.1)
216AC_CONFIG_FILES(dictfmt_index2suffix.1)
217AC_CONFIG_FILES(dictfmt_index2word.1)
218AC_CONFIG_FILES(dictl.1)
219AC_CONFIG_FILES(dict_lookup.1)
220AC_CONFIG_FILES(dictunformat.1)
221AC_CONFIG_FILES(dictzip.1)
222AC_CONFIG_FILES(dictd.8)
223
224AC_CONFIG_FILES(test/dictd_test)
225AC_CONFIG_FILES(test/dictzip_test)
226
227AC_OUTPUT
228
229printf '\n\n'
230
231# PLUGIN SUPPORT
232printf "plugin support:  "
233if test "_$USE_PLUGIN" = "_"; then
234  echo disabled
235else
236  case "$USE_PLUGIN" in
237    1) echo libltdl;;
238    2) echo native
239  esac
240
241  printf " enabled plugins: %s\n" "$PLUGINS"
242fi
243
244printf '\n\n'
245
246touch stamp-h.in
247touch stamp-h
248#echo .
249#echo Done
250