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