1 dnl YAZ Toolkit, Index Data 1994-2001
2 dnl See the file LICENSE for details.
3 dnl $Id: configure.in,v 1.55 2001-11-18 21:14:22 adam Exp $
4 AC_INIT(include/yaz/yaz-version.h)
5 AM_INIT_AUTOMAKE(yaz, 1.8.3)
7 AC_SUBST(READLINE_LIBS)
8 dnl ------ Checking programs
15 dnl ----- yaz-comp: The Yaz Compiler
19 EXTRAMODULE="z39.50 zutil"
21 AC_ARG_ENABLE(modules,[ --enable-modules=\"mod ..\" ill],[
22 if test "$enable_modules" != "no"; then
23 EXTRAMODULE="$EXTRAMODULE $enable_modules"
26 EXTRAMODULE="$EXTRAMODULE ill ccl zoom"
29 for module in $EXTRAMODULE; do
30 EXTRALIB="$EXTRALIB ../$module/lib${module}.la"
31 if test $module = "z39.50"; then
34 AC_DEFINE_UNQUOTED(YAZ_MODULE_${module})
38 AC_CHECK_FUNC(connect)
39 if test "$ac_cv_func_connect" = "no"; then
40 AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", checkBoth=1)
42 if test "$checkBoth" = "1"; then
44 LIBS="$LIBS -lsocket -lnsl"
45 AC_CHECK_FUNC(accept, , [LIBS=$oldLibs])
47 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
51 AC_ARG_WITH(openssl, [ --with-openssl[=DIR] OpenSSL library in DIR], [openssl=$withval])
52 if test "$openssl" = "yes"; then
53 AC_CHECK_LIB(crypto, main)
54 AC_CHECK_LIB(ssl, SSL_new)
55 if test "$ac_cv_lib_ssl_SSL_new" = "yes"; then
56 AC_CHECK_HEADERS(openssl/ssl.h)
59 dnl ------ GNU Readline
60 READLINE_SHARED_LIBADD=""
61 AC_CHECK_LIB(ncurses, tgetent, [READLINE_SHARED_LIBADD="-lncurses"],
62 AC_CHECK_LIB(termcap, tgetent, [READLINE_SHARED_LIBADD="-ltermcap"])
65 AC_CHECK_LIB(readline, readline, [READLINE_LIBS="$READLINE_LIBS -lreadline $READLINE_SHARED_LIBADD"],,$READLINE_SHARED_LIBADD)
66 AC_CHECK_LIB(history, add_history, [READLINE_LIBS="$READLINE_LIBS -lhistory"])
67 if test "$ac_cv_lib_readline_readline" = "yes"; then
68 AC_CHECK_HEADERS(readline/readline.h readline/history.h)
70 dnl ------ various functions
71 AC_CHECK_FUNCS(vsnprintf gettimeofday poll)
72 if test "$ac_cv_func_poll" = "yes"; then
73 AC_CHECK_HEADERS(sys/poll.h)
77 AC_ARG_ENABLE(tcpd,[ --enable-tcpd[=PREFIX] enable TCP wrapper for server if available])
78 if test "$enable_tcpd" != ""; then
81 if test "$enable_tcpd" != "yes"; then
82 LIBS="$LIBS -L$enable_tcpd/lib"
83 CPPFLAGS="$CPPFLAGS -I$enable_tcpd/include"
85 AC_MSG_CHECKING(for working tcpd.h)
86 LIBS="$LIBS -lwrap -lnsl"
87 AC_TRY_LINK([#include <syslog.h>
89 int allow_severity = LOG_INFO;
90 int deny_severity = LOG_WARNING;],
91 [struct request_info request_info; int i;
92 i = hosts_access(&request_info);],
94 if test "$tcpd_ok" = "0"; then
100 AC_DEFINE(HAVE_TCPD_H)
106 if test "$ac_cv_header_stdc" = "no"; then
107 AC_MSG_WARN(Your system doesn't seem to support ANSI C)
111 AC_SUBST(CFLAGSTHREADS)
116 AC_ARG_ENABLE(pth, [ --enable-pth enable GNU threads],[enable_pth=$enableval],[enable_pth=no])
118 if test "$enable_pth" = "yes"; then
120 AC_CHECK_LIB(pth,main)
121 if test "$ac_cv_lib_pth_main" = "yes"; then
122 AC_CHECK_HEADERS(pth.h)
123 if test "$ac_cv_header_pth_h" = "yes"; then
125 CFLAGSTHREADS="-DYAZ_GNU_THREADS=1"
132 dnl ------ POSIX Threads
133 AC_ARG_ENABLE(threads, [ --disable-threads disable POSIX threads],[enable_threads=$enableval],[enable_threads=yes])
134 if test "$enable_threads" = "yes" -a "$HAVETHREADS" = "0"; then
137 AC_CHECK_LIB(pthread,main)
138 AC_MSG_CHECKING(for working POSIX Threads)
139 AC_TRY_LINK([#include <pthread.h>
140 void *func(void *p) { return 0; }
142 pthread_t pthread_id;
143 pthread_create (&pthread_id, 0, func, 0);],
144 thread_ok=yes,thread_ok=no)
145 if test "$thread_ok" = "yes"; then
148 CFLAGSTHREADS="-DYAZ_POSIX_THREADS=1 -D_REENTRANT"
152 AC_TRY_LINK([#include <pthread.h>
153 void *func(void *p) { return 0; }
155 pthread_t pthread_id;
156 pthread_create (&pthread_id, 0, func, 0);],
157 thread_ok=yes,thread_ok=no)
158 if test "$thread_ok" = "yes"; then
159 AC_MSG_RESULT([yes,BSD])
160 CFLAGSTHREADS="-pthread -DYAZ_POSIX_THREADS=1 -D_REENTRANT"
164 if test "$thread_ok" = "no"; then
170 AM_CONDITIONAL(ISTHR, test $HAVETHREADS = "1")
171 dnl ------ Using this for "in-source" yaz-config
172 AC_SUBST(YAZ_SRC_ROOT)
173 AC_SUBST(YAZ_BUILD_ROOT)
174 YAZ_SRC_ROOT=`cd ${srcdir}; pwd`
177 if test -f ${srcdir}/lib/yaz-config.in; then
178 rm ${srcdir}/lib/yaz-config.in
180 sed s%yaz_echo_source=yes%yaz_echo_source=no%g < ${srcdir}/yaz-config.in >${srcdir}/lib/yaz-config.in
182 SUBDIRS_VAR="util odr comstack $EXTRAMODULE tab retrieval server include lib include client ztest"
183 AC_SUBST(SUBDIRS_VAR)
207 ],[chmod +x yaz-config lib/yaz-config])