1 dnl YAZ Toolkit, Index Data 1994-2001
2 dnl See the file LICENSE for details.
3 dnl $Id: configure.in,v 1.77 2002-07-05 12:42:52 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"]))
79 AC_ARG_WITH(expat, [ --with-expat[=DIR] EXPAT library in DIR],[expat=$withval])
80 if test "$expat" != "no"; then
83 if test "$expat" != "yes"; then
84 EXPAT_CFLAGS="-I$expat/include"
85 EXPAT_LIBS="-L$expat/lib"
86 CFLAGS="$EXPAT_CFLAGS $CFLAGS"
87 LIBS="$EXPAT_LIBS $LIBS"
89 AC_CHECK_LIB(expat,XML_ParserCreate,[LIBS="$LIBS -lexpat"])
90 if test "$ac_cv_lib_expat_XML_ParserCreate" = "yes"; then
91 AC_CHECK_HEADERS(expat.h)
92 if test "$ac_cv_header_expat_h" = "yes"; then
93 YAZ_CONF_CFLAGS="$YAZ_CONF_CFLAGS -DYAZ_HAVE_EXPAT=1"
103 AC_ARG_WITH(openssl, [ --with-openssl[=DIR] OpenSSL library in DIR], [openssl=$withval])
111 if test "$openssl" != "no"; then
114 if test "$openssl" != "yes"; then
115 SSL_CFLAGS="-I$openssl/include -I$openssl/include/openssl"
116 SSL_LIBS="-L$openssl/lib"
117 CFLAGS="$SSL_CFLAGS $CFLAGS"
118 LIBS="$SSL_LIBS $LIBS"
120 AC_CHECK_LIB(crypto, main,[SSL_LIBS="$SSL_LIBS -lcrypto"])
121 LIBS="$LIBS $SSL_LIBS"
122 AC_CHECK_LIB(ssl, SSL_new)
123 if test "$ac_cv_lib_ssl_SSL_new" = "yes"; then
124 SSL_LIBS="$SSL_LIBS -lssl"
125 AC_CHECK_HEADER(openssl/ssl.h,[SSL_DEFS="-DHAVE_OPENSSL_SSL_H=1"; USE_SSL=1])
132 AM_CONDITIONAL(ISSSL, test $USE_SSL = "1")
134 dnl ------ GNU Readline
135 READLINE_SHARED_LIBADD=""
136 AC_CHECK_LIB(ncurses, tgetent, [READLINE_SHARED_LIBADD="-lncurses"],
137 AC_CHECK_LIB(termcap, tgetent, [READLINE_SHARED_LIBADD="-ltermcap"])
140 AC_CHECK_LIB(readline, readline, [READLINE_LIBS="$READLINE_LIBS -lreadline $READLINE_SHARED_LIBADD"],,$READLINE_SHARED_LIBADD)
141 AC_CHECK_LIB(history, add_history, [READLINE_LIBS="$READLINE_LIBS -lhistory"])
142 if test "$ac_cv_lib_readline_readline" = "yes"; then
143 AC_CHECK_HEADERS(readline/readline.h readline/history.h)
145 LIBS="$LIBS $READLINE_LIBS"
148 #include <readline/readline.h>
152 rl_attempted_completion_over = 0;
154 ],AC_DEFINE(HAVE_READLINE_COMPLETION_OVER))
157 #include <readline/readline.h>
161 rl_completion_matches (0, 0);
163 ],AC_DEFINE(HAVE_READLINE_RL_COMPLETION_MATCHES))
166 dnl ------ various functions
167 AC_CHECK_FUNCS(vsnprintf gettimeofday poll)
168 if test "$ac_cv_func_poll" = "yes"; then
169 AC_CHECK_HEADERS(sys/poll.h)
173 AC_ARG_ENABLE(tcpd,[ --enable-tcpd[=PREFIX] enable TCP wrapper for server if available])
174 if test "$enable_tcpd" != ""; then
176 oldCPPFLAGS=$CPPFLAGS
177 if test "$enable_tcpd" != "yes"; then
178 LIBS="$LIBS -L$enable_tcpd/lib"
179 CPPFLAGS="$CPPFLAGS -I$enable_tcpd/include"
181 AC_MSG_CHECKING(for working tcpd.h)
182 LIBS="$LIBS -lwrap -lnsl"
183 AC_TRY_LINK([#include <syslog.h>
185 int allow_severity = LOG_INFO;
186 int deny_severity = LOG_WARNING;],
187 [struct request_info request_info; int i;
188 i = hosts_access(&request_info);],
189 tcpd_ok=1, tcpd_ok=0)
190 if test "$tcpd_ok" = "0"; then
193 CPPFLAGS=$oldCPPFLAGS
196 AC_DEFINE(HAVE_TCPD_H)
201 AC_CHECK_HEADERS(fnmatch.h iconv.h)
203 if test "$ac_cv_header_stdc" = "no"; then
204 AC_MSG_WARN(Your system doesn't seem to support ANSI C)
208 AC_SUBST(CFLAGSTHREADS)
213 dnl ------ GNU threads
214 AC_ARG_ENABLE(pth, [ --enable-pth enable GNU threads],[enable_pth=$enableval],[enable_pth=no])
216 if test "$enable_pth" = "yes"; then
218 AC_CHECK_LIB(pth,main)
219 if test "$ac_cv_lib_pth_main" = "yes"; then
220 AC_CHECK_HEADERS(pth.h)
221 if test "$ac_cv_header_pth_h" = "yes"; then
223 CFLAGSTHREADS="-DYAZ_GNU_THREADS=1"
230 dnl ------ POSIX Threads
231 AC_ARG_ENABLE(threads, [ --disable-threads disable POSIX threads],[enable_threads=$enableval],[enable_threads=yes])
232 if test "$enable_threads" = "yes" -a "$HAVETHREADS" = "0"; then
235 AC_CHECK_LIB(pthread,main)
236 AC_MSG_CHECKING(for working POSIX Threads)
237 AC_TRY_LINK([#include <pthread.h>
238 void *func(void *p) { return 0; }
240 pthread_t pthread_id;
241 pthread_create (&pthread_id, 0, func, 0);],
242 thread_ok=yes,thread_ok=no)
243 if test "$thread_ok" = "yes"; then
245 LIBTHREAD="-lpthread"
246 CFLAGSTHREADS="-DYAZ_POSIX_THREADS=1 -D_REENTRANT"
250 AC_TRY_LINK([#include <pthread.h>
251 void *func(void *p) { return 0; }
253 pthread_t pthread_id;
254 pthread_create (&pthread_id, 0, func, 0);],
255 thread_ok=yes,thread_ok=no)
256 if test "$thread_ok" = "yes"; then
257 AC_MSG_RESULT([yes,BSD])
258 CFLAGSTHREADS="-pthread -DYAZ_POSIX_THREADS=1 -D_REENTRANT"
263 if test "$thread_ok" = "no"; then
269 AM_CONDITIONAL(ISTHR, test $HAVETHREADS = "1")
271 dnl ------ Memory debugging
272 AC_ARG_ENABLE(memdebug, [ --enable-memdebug enable memory debugging],[enable_memdebug=$enableval],[enable_memdebug=none])
273 if test "$enable_memdebug" = "yes"; then
274 AC_DEFINE(TRACE_XMALLOC,2)
275 elif test "$enable_memdebug" = "no"; then
276 AC_DEFINE(TRACE_XMALLOC,0)
279 dnl ------ Using this for "in-source" yaz-config
280 AC_SUBST(YAZ_SRC_ROOT)
281 AC_SUBST(YAZ_BUILD_ROOT)
282 YAZ_SRC_ROOT=`cd ${srcdir}; pwd`
285 if test -f ${srcdir}/lib/yaz-config.in; then
286 rm ${srcdir}/lib/yaz-config.in
288 sed s%yaz_echo_source=yes%yaz_echo_source=no%g < ${srcdir}/yaz-config.in >${srcdir}/lib/yaz-config.in
318 ],[chmod +x yaz-config lib/yaz-config])