1 dnl YAZ Toolkit, Index Data 1994-2001
2 dnl See the file LICENSE for details.
3 dnl $Id: configure.in,v 1.76 2002-06-02 21:34:45 adam Exp $
4 AC_INIT(include/yaz/yaz-version.h)
5 AM_INIT_AUTOMAKE(yaz, 1.8.8dev)
7 AC_SUBST(READLINE_LIBS)
8 AC_SUBST(YAZ_CONF_CFLAGS)
9 dnl ------ Checking programs
18 AC_ARG_WITH(dtd, [ --with-dtd[=DIR] Use docbookx.dtd in DIR],
20 if test -f "$withval/docbookx.dtd"; then
24 AC_MSG_CHECKING(for docbookx.dtd)
25 for d in /usr/share/sgml/docbook/dtd/xml/4.1.2 \
26 /usr/share/sgml/docbook/xml-dtd-4.1.2 \
27 /usr/share/sgml/docbook/dtd/xml/4.0 \
28 /usr/lib/sgml/dtd/docbook-xml
30 if test -f $d/docbookx.dtd; then
36 if test -z "$DTD_DIR"; then
37 AC_MSG_RESULT(Not found)
41 AC_ARG_WITH(dsssl,[ --with-dsssl[=DIR] Use DSSSL in DIR/{html,print}/docbook.dsl],
43 if test -f "$withval/html/docbook.dsl"; then
47 AC_MSG_CHECKING(for docbook.dsl)
48 for d in /usr/share/sgml/docbook/stylesheet/dsssl/modular \
49 /usr/share/sgml/docbook/dsssl-stylesheets-1.64 \
50 /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh
52 if test -f $d/html/docbook.dsl; then
58 if test -z "$DSSSL_DIR"; then
59 AC_MSG_RESULT(Not found)
65 AC_CHECK_FUNC(connect)
66 if test "$ac_cv_func_connect" = "no"; then
67 AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", checkBoth=1)
69 if test "$checkBoth" = "1"; then
71 LIBS="$LIBS -lsocket -lnsl"
72 AC_CHECK_FUNC(accept, , [LIBS=$oldLibs])
74 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
78 AC_ARG_WITH(expat, [ --with-expat[=DIR] EXPAT library in DIR],[expat=$withval])
79 if test "$expat" != "no"; then
82 if test "$expat" != "yes"; then
83 EXPAT_CFLAGS="-I$expat/include"
84 EXPAT_LIBS="-L$expat/lib"
85 CFLAGS="$EXPAT_CFLAGS $CFLAGS"
86 LIBS="$EXPAT_LIBS $LIBS"
88 AC_CHECK_LIB(expat,XML_ParserCreate,[LIBS="$LIBS -lexpat"])
89 if test "$ac_cv_lib_expat_XML_ParserCreate" = "yes"; then
90 AC_CHECK_HEADERS(expat.h)
91 if test "$ac_cv_header_expat_h" = "yes"; then
92 YAZ_CONF_CFLAGS="$YAZ_CONF_CFLAGS -DYAZ_HAVE_EXPAT=1"
102 AC_ARG_WITH(openssl, [ --with-openssl[=DIR] OpenSSL library in DIR], [openssl=$withval])
110 if test "$openssl" != "no"; then
113 if test "$openssl" != "yes"; then
114 SSL_CFLAGS="-I$openssl/include -I$openssl/include/openssl"
115 SSL_LIBS="-L$openssl/lib"
116 CFLAGS="$SSL_CFLAGS $CFLAGS"
117 LIBS="$SSL_LIBS $LIBS"
119 AC_CHECK_LIB(crypto, main,[SSL_LIBS="$SSL_LIBS -lcrypto"])
120 LIBS="$LIBS $SSL_LIBS"
121 AC_CHECK_LIB(ssl, SSL_new)
122 if test "$ac_cv_lib_ssl_SSL_new" = "yes"; then
123 SSL_LIBS="$SSL_LIBS -lssl"
124 AC_CHECK_HEADER(openssl/ssl.h,[SSL_DEFS="-DHAVE_OPENSSL_SSL_H=1"; USE_SSL=1])
131 AM_CONDITIONAL(ISSSL, test $USE_SSL = "1")
133 dnl ------ GNU Readline
134 READLINE_SHARED_LIBADD=""
135 AC_CHECK_LIB(ncurses, tgetent, [READLINE_SHARED_LIBADD="-lncurses"],
136 AC_CHECK_LIB(termcap, tgetent, [READLINE_SHARED_LIBADD="-ltermcap"])
139 AC_CHECK_LIB(readline, readline, [READLINE_LIBS="$READLINE_LIBS -lreadline $READLINE_SHARED_LIBADD"],,$READLINE_SHARED_LIBADD)
140 AC_CHECK_LIB(history, add_history, [READLINE_LIBS="$READLINE_LIBS -lhistory"])
141 if test "$ac_cv_lib_readline_readline" = "yes"; then
142 AC_CHECK_HEADERS(readline/readline.h readline/history.h)
144 LIBS="$LIBS $READLINE_LIBS"
147 #include <readline/readline.h>
151 rl_attempted_completion_over = 0;
153 ],AC_DEFINE(HAVE_READLINE_COMPLETION_OVER))
156 #include <readline/readline.h>
160 rl_completion_matches (0, 0);
162 ],AC_DEFINE(HAVE_READLINE_RL_COMPLETION_MATCHES))
165 dnl ------ various functions
166 AC_CHECK_FUNCS(vsnprintf gettimeofday poll)
167 if test "$ac_cv_func_poll" = "yes"; then
168 AC_CHECK_HEADERS(sys/poll.h)
172 AC_ARG_ENABLE(tcpd,[ --enable-tcpd[=PREFIX] enable TCP wrapper for server if available])
173 if test "$enable_tcpd" != ""; then
175 oldCPPFLAGS=$CPPFLAGS
176 if test "$enable_tcpd" != "yes"; then
177 LIBS="$LIBS -L$enable_tcpd/lib"
178 CPPFLAGS="$CPPFLAGS -I$enable_tcpd/include"
180 AC_MSG_CHECKING(for working tcpd.h)
181 LIBS="$LIBS -lwrap -lnsl"
182 AC_TRY_LINK([#include <syslog.h>
184 int allow_severity = LOG_INFO;
185 int deny_severity = LOG_WARNING;],
186 [struct request_info request_info; int i;
187 i = hosts_access(&request_info);],
188 tcpd_ok=1, tcpd_ok=0)
189 if test "$tcpd_ok" = "0"; then
192 CPPFLAGS=$oldCPPFLAGS
195 AC_DEFINE(HAVE_TCPD_H)
200 AC_CHECK_HEADERS(fnmatch.h)
202 if test "$ac_cv_header_stdc" = "no"; then
203 AC_MSG_WARN(Your system doesn't seem to support ANSI C)
207 AC_SUBST(CFLAGSTHREADS)
212 dnl ------ GNU threads
213 AC_ARG_ENABLE(pth, [ --enable-pth enable GNU threads],[enable_pth=$enableval],[enable_pth=no])
215 if test "$enable_pth" = "yes"; then
217 AC_CHECK_LIB(pth,main)
218 if test "$ac_cv_lib_pth_main" = "yes"; then
219 AC_CHECK_HEADERS(pth.h)
220 if test "$ac_cv_header_pth_h" = "yes"; then
222 CFLAGSTHREADS="-DYAZ_GNU_THREADS=1"
229 dnl ------ POSIX Threads
230 AC_ARG_ENABLE(threads, [ --disable-threads disable POSIX threads],[enable_threads=$enableval],[enable_threads=yes])
231 if test "$enable_threads" = "yes" -a "$HAVETHREADS" = "0"; then
234 AC_CHECK_LIB(pthread,main)
235 AC_MSG_CHECKING(for working POSIX Threads)
236 AC_TRY_LINK([#include <pthread.h>
237 void *func(void *p) { return 0; }
239 pthread_t pthread_id;
240 pthread_create (&pthread_id, 0, func, 0);],
241 thread_ok=yes,thread_ok=no)
242 if test "$thread_ok" = "yes"; then
244 LIBTHREAD="-lpthread"
245 CFLAGSTHREADS="-DYAZ_POSIX_THREADS=1 -D_REENTRANT"
249 AC_TRY_LINK([#include <pthread.h>
250 void *func(void *p) { return 0; }
252 pthread_t pthread_id;
253 pthread_create (&pthread_id, 0, func, 0);],
254 thread_ok=yes,thread_ok=no)
255 if test "$thread_ok" = "yes"; then
256 AC_MSG_RESULT([yes,BSD])
257 CFLAGSTHREADS="-pthread -DYAZ_POSIX_THREADS=1 -D_REENTRANT"
262 if test "$thread_ok" = "no"; then
268 AM_CONDITIONAL(ISTHR, test $HAVETHREADS = "1")
270 dnl ------ Memory debugging
271 AC_ARG_ENABLE(memdebug, [ --enable-memdebug enable memory debugging],[enable_memdebug=$enableval],[enable_memdebug=none])
272 if test "$enable_memdebug" = "yes"; then
273 AC_DEFINE(TRACE_XMALLOC,2)
274 elif test "$enable_memdebug" = "no"; then
275 AC_DEFINE(TRACE_XMALLOC,0)
278 dnl ------ Using this for "in-source" yaz-config
279 AC_SUBST(YAZ_SRC_ROOT)
280 AC_SUBST(YAZ_BUILD_ROOT)
281 YAZ_SRC_ROOT=`cd ${srcdir}; pwd`
284 if test -f ${srcdir}/lib/yaz-config.in; then
285 rm ${srcdir}/lib/yaz-config.in
287 sed s%yaz_echo_source=yes%yaz_echo_source=no%g < ${srcdir}/yaz-config.in >${srcdir}/lib/yaz-config.in
317 ],[chmod +x yaz-config lib/yaz-config])