Implemented ILL protocol. Minor updates ASN.1 compiler.
[yaz-moved-to-github.git] / configure.in
1 dnl YAZ Toolkit
2 dnl (c) Index Data 1994-1999
3 dnl See the file LICENSE for details.
4 dnl $Id: configure.in,v 1.14 1999-12-16 23:36:19 adam Exp $
5 AC_INIT(include/yaz/yaz-version.h)
6 dnl
7 dnl ------ Checking programs
8 AC_PROG_CC
9 AC_PROG_CPP
10 AC_PROG_INSTALL
11 AC_PROG_RANLIB
12 dnl 
13 dnl ----- Build root
14 AC_SUBST(build_root)
15 AC_ARG_WITH(build-root, [  --with-buildroot        RPM Build root],[build_root=$withval],[build_root=""])
16 dnl
17 dnl ----- YC: The Yaz Compiler
18 AC_SUBST(ASNMODULE)
19 AC_SUBST(ILLMODULE)
20 AC_SUBST(ILLLIB)
21 AC_ARG_ENABLE(yc,[  --enable-yc             compile using YAZ' ASN.1 Compiler], , enable_yc=yes)
22 if test "$enable_yc" = "yes"; then
23         ASNMODULE="z39.50"
24         ILLMODULE="ill"
25         ILLLIB=libill.a
26         cp -f include/yaz/z-proto.h include/yaz/proto.h
27 else
28         ILLMODULE=""
29         ASNMODULE=asn
30         ILLLIB=""
31         cp -f include/yaz/prt-proto.h include/yaz/proto.h
32 fi
33 dnl
34 dnl ----- Sockets
35 checkBoth=0
36 AC_CHECK_FUNC(connect)
37 if test "$ac_cv_func_connect" = "no"; then
38         AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", checkBoth=1)
39 fi
40 if test "$checkBoth" = "1"; then
41         oldLibs=$LIBS
42         LIBS="$LIBS -lsocket -lnsl"
43         AC_CHECK_FUNC(accept, , [LIBS=$oldLibs])
44 fi
45 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
46 dnl
47 dnl ------ GNU Readline
48 AC_CHECK_LIB(readline, readline, [LIBS="$LIBS -lreadline"])
49 AC_CHECK_LIB(history, add_history, [LIBS="$LIBS -lhistory"])
50 if test "$ac_cv_lib_readline_readline" = "yes"; then
51         AC_CHECK_HEADERS(readline/readline.h readline/history.h)
52 fi
53 dnl
54 dnl ------ tcpd
55 AC_ARG_ENABLE(tcpd,[  --enable-tcpd           enable TCP wrapper for server if available])
56 if test "$enable_tcpd" = "yes"; then
57         AC_MSG_CHECKING(for working tcpd.h)
58         oldLibs=$LIBS
59         LIBS="$LIBS -lwrap -lnsl"
60         AC_TRY_LINK([#include <syslog.h>
61         #include <tcpd.h>
62         int allow_severity = LOG_INFO;
63         int deny_severity = LOG_WARNING;],
64         [struct request_info request_info; int i;
65         i = hosts_access(&request_info);],tcpd_ok=1, tcpd_ok=0)
66         if test "$tcpd_ok" = "0"; then
67                 AC_MSG_RESULT(no)
68                 LIBS=$oldLibs
69         else
70                 AC_MSG_RESULT(yes)
71                 AC_DEFINE(HAVE_TCPD_H)
72         fi
73 fi
74 dnl
75 dnl ------ Headers
76 AC_STDC_HEADERS
77 if test "$ac_cv_header_stdc" = "no"; then
78         AC_MSG_WARN(Your system doesn't seem to support ANSI C)
79 fi
80 dnl
81 dnl ------ Threads
82 AC_ARG_ENABLE(threads, [  --enable-threads        enable threads if available])
83 if test "$enable_threads" = "yes"; then
84         AC_CHECK_HEADERS(pthread.h threads.h)
85         AC_CHECK_FUNC(pthread_mutex_lock)
86         if test "$ac_cv_func_pthread_mutex_lock" = "no"; then
87                 AC_CHECK_LIB(pthread, main)
88         fi
89         AC_DEFINE(_REENTRANT)
90 fi
91 dnl
92 dnl ------ Makefiles
93 AC_OUTPUT(Makefile util/Makefile odr/Makefile z39.50/Makefile asn/Makefile zutil/Makefile comstack/Makefile client/Makefile server/Makefile ztest/Makefile retrieval/Makefile ccl/Makefile lib/Makefile rfc1006/Makefile ill/Makefile)