Client display time elapsed.
[yaz-moved-to-github.git] / configure.in
1 dnl YAZ Toolkit
2 dnl (c) Index Data 1994-2000
3 dnl See the file LICENSE for details.
4 dnl $Id: configure.in,v 1.28 2000-05-18 11:57:04 adam Exp $
5 AC_INIT(include/yaz/yaz-version.h)
6 AM_INIT_AUTOMAKE(yaz, 1.7)
7 dnl
8 AC_SUBST(READLINE_LIBS)
9 dnl ------ Checking programs
10 AC_PROG_CC
11 AC_PROG_CPP
12 AC_PROG_INSTALL
13 AM_DISABLE_SHARED
14 AM_PROG_LIBTOOL
15 dnl 
16 dnl ----- yaz-comp: The Yaz Compiler
17 AC_SUBST(ASNMODULE)
18 AC_SUBST(ILLMODULE)
19 AC_SUBST(ILLLIB)
20 AC_ARG_ENABLE(comp,[  --disable-comp          use old encoders, i.e. disable the YAZ ASN.1 Compiler], , enable_comp=yes)
21 if test "$enable_comp" = "yes"; then
22         ASNMODULE="z39.50"
23         ILLMODULE="ill"
24         ILLLIB=../ill/libill.la
25         ASN_MAKEFILES="z39.50/Makefile ill/Makefile"
26         HFILE=z-proto.h
27 else
28         ILLMODULE=""
29         ASNMODULE=asn
30         ILLLIB=""
31         ASN_MAKEFILES="asn/Makefile"
32         HFILE=prt-proto.h
33 fi
34 AC_MSG_CHECKING(whether proto.h needs to be generated)
35 yaz_include=${srcdir}/include/yaz
36 if test -r ${yaz_include}/proto.h && cmp -s ${yaz_include}/$HFILE ${yaz_include}/proto.h; then
37         AC_MSG_RESULT(no)
38 else
39         AC_MSG_RESULT(yes)
40         cp -f ${yaz_include}/$HFILE ${yaz_include}/proto.h
41 fi
42 dnl
43 dnl ----- Sockets
44 checkBoth=0
45 AC_CHECK_FUNC(connect)
46 if test "$ac_cv_func_connect" = "no"; then
47         AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", checkBoth=1)
48 fi
49 if test "$checkBoth" = "1"; then
50         oldLibs=$LIBS
51         LIBS="$LIBS -lsocket -lnsl"
52         AC_CHECK_FUNC(accept, , [LIBS=$oldLibs])
53 fi
54 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
55 dnl
56 dnl ------ GNU Readline
57 READLINE_LIBS=""
58 AC_CHECK_LIB(readline, readline, [READLINE_LIBS="$READLINE_LIBS -lreadline"])
59 if test "$ac_cv_lib_readline_readline" = "no"; then
60         AC_CHECK_LIB(readline, readline, [READLINE_LIBS="$READLINE_LIBS -lreadline -ltermcap"])
61 fi
62 AC_CHECK_LIB(history, add_history, [READLINE_LIBS="$READLINE_LIBS -lhistory"])
63 if test "$ac_cv_lib_readline_readline" = "yes"; then
64         AC_CHECK_HEADERS(readline/readline.h readline/history.h)
65 fi
66 dnl ------ snprintf
67 AC_CHECK_FUNCS(vsnprintf gettimeofday)
68 dnl
69 dnl ------ tcpd
70 AC_ARG_ENABLE(tcpd,[  --enable-tcpd           enable TCP wrapper for server if available])
71 if test "$enable_tcpd" = "yes"; then
72         AC_MSG_CHECKING(for working tcpd.h)
73         oldLibs=$LIBS
74         LIBS="$LIBS -lwrap -lnsl"
75         AC_TRY_LINK([#include <syslog.h>
76         #include <tcpd.h>
77         int allow_severity = LOG_INFO;
78         int deny_severity = LOG_WARNING;],
79         [struct request_info request_info; int i;
80         i = hosts_access(&request_info);],tcpd_ok=1, tcpd_ok=0)
81         if test "$tcpd_ok" = "0"; then
82                 AC_MSG_RESULT(no)
83                 LIBS=$oldLibs
84         else
85                 AC_MSG_RESULT(yes)
86                 AC_DEFINE(HAVE_TCPD_H)
87         fi
88 fi
89 dnl
90 dnl ------ Headers
91 AC_STDC_HEADERS
92 if test "$ac_cv_header_stdc" = "no"; then
93         AC_MSG_WARN(Your system doesn't seem to support ANSI C)
94 fi
95 dnl
96 dnl ------ Threads
97 AC_ARG_ENABLE(threads, [  --disable-threads       disable threads],[enable_threads=$enableval],[enable_threads=yes])
98 if test "$enable_threads" = "yes"; then
99         AC_CHECK_LIB(pthread,main)
100         AC_MSG_CHECKING(for working POSIX Threads)
101         AC_TRY_LINK([#include <pthread.h>
102         int func(void *p) { return 0; }
103         ],[
104         pthread_t pthread_id;
105         int r = pthread_create (&pthread_id, 0, func, 0);],
106                 thread_ok=yes,thread_ok=no)
107         if test "$thread_ok" = "yes"; then
108                 AC_MSG_RESULT(yes)
109                 AC_DEFINE(HAVE_PTHREAD_H)
110                 AC_DEFINE(_REENTRANT)
111         else
112                 AC_MSG_RESULT(no)
113         fi
114 fi
115 dnl
116 SUBDIRS_VAR="util odr $ASNMODULE $ILLMODULE zutil comstack ccl tab retrieval server include lib client ztest"
117 AC_SUBST(SUBDIRS_VAR)
118 dnl
119 dnl ------ Makefiles
120 dnl
121 AC_OUTPUT(Makefile util/Makefile odr/Makefile z39.50/Makefile asn/Makefile ill/Makefile zutil/Makefile comstack/Makefile ccl/Makefile tab/Makefile retrieval/Makefile server/Makefile include/Makefile include/yaz/Makefile lib/Makefile client/Makefile ztest/Makefile doc/Makefile)