Added enable-yc (removed with-yc) and enable-tcpd.
[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.11 1999-06-09 14:23:58 adam Exp $
5 AC_INIT(include/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 ----- YC: The Yaz Compiler
14 AC_SUBST(ASNMODULE)
15 AC_ARG_ENABLE(yc,[  --enable-yc             compile using YAZ' ASN.1 Compiler (YC)])
16 if test "$enable_yc" = "yes"; then
17         ASNMODULE="z39.50"
18         cp -f include/z-proto.h include/proto.h
19 else
20         ASNMODULE=asn
21         cp -f include/prt-proto.h include/proto.h
22 fi
23 dnl
24 dnl ----- Sockets
25 checkBoth=0
26 AC_CHECK_FUNC(connect)
27 if test "$ac_cv_func_connect" = "no"; then
28         AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", checkBoth=1)
29 fi
30 if test "$checkBoth" = "1"; then
31         oldLibs=$LIBS
32         LIBS="$LIBS -lsocket -lnsl"
33         AC_CHECK_FUNC(accept, , [LIBS=$oldLibs])
34 fi
35 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
36 dnl
37 dnl ------ GNU Readline
38 AC_CHECK_LIB(readline, readline, [LIBS="$LIBS -lreadline"])
39 AC_CHECK_LIB(history, add_history, [LIBS="$LIBS -lhistory"])
40 if test "$ac_cv_lib_readline_readline" = "yes"; then
41         AC_CHECK_HEADERS(readline/readline.h readline/history.h)
42 fi
43 dnl
44 dnl ------ tcpd
45 AC_ARG_ENABLE(tcpd,[  --enable-tcpd           enable TCP wrapper for server if available])
46 if test "$enable_tcpd" = "yes"; then
47         AC_MSG_CHECKING(for working tcpd.h)
48         oldLibs=$LIBS
49         LIBS="$LIBS -lwrap"
50         AC_TRY_LINK([#include <syslog.h>
51         #include <tcpd.h>
52         int allow_severity = LOG_INFO;
53         int deny_severity = LOG_WARNING;],
54         [struct request_info request_info; int i;
55         i = hosts_access(&request_info);],tcpd_ok=1, tcpd_ok=0)
56         if test "$tcpd_ok" = "0"; then
57                 AC_MSG_RESULT(no)
58                 LIBS=$oldLibs
59         else
60                 AC_MSG_RESULT(yes)
61                 AC_DEFINE(HAVE_TCPD_H)
62         fi
63 fi
64 dnl
65 dnl ------ Headers
66 AC_STDC_HEADERS
67 if test "$ac_cv_header_stdc" = "no"; then
68         AC_MSG_WARN(Your system doesn't seem to support ANSI C)
69 fi
70 dnl
71 dnl ------ Threads
72 AC_ARG_ENABLE(threads, [  --enable-threads        enable threads if available])
73 if test "$enable_threads" = "yes"; then
74         AC_CHECK_HEADERS(pthread.h threads.h)
75         AC_CHECK_FUNC(pthread_mutex_lock)
76         if test "$ac_cv_func_pthread_mutex_lock" = "no"; then
77                 AC_CHECK_LIB(pthread, main)
78         fi
79         AC_DEFINE(_REENTRANT)
80 fi
81 dnl
82 dnl ------ Makefiles
83 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)