Updated makefiles (again).
[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.19 2000-03-01 11:06:09 adam Exp $
5 AC_INIT(include/yaz/yaz-version.h)
6 AM_INIT_AUTOMAKE(yaz, 1.6)
7 dnl
8 dnl ------ Checking programs
9 AC_PROG_CC
10 AC_PROG_CPP
11 AC_PROG_INSTALL
12 AC_PROG_RANLIB
13 AC_CHECK_PROGS(have_sgml2txt,sgml2txt)
14 AC_CHECK_PROGS(have_sgml2latex,sgml2latex)
15 AC_CHECK_PROGS(have_sgml2html,sgml2html)
16 if test "$have_sgml2txt" = "no" -o "$have_sgml2latex" = "no" - "$have_sgml2html" = "no"; then
17         DOCMODULE=""
18 else
19         DOCMODULE="doc"
20 fi
21 dnl 
22 dnl ----- YC: The Yaz Compiler
23 AC_SUBST(ASNMODULE)
24 AC_SUBST(ILLMODULE)
25 AC_SUBST(ILLLIB)
26 AC_ARG_ENABLE(yc,[  --disable-yc            use old encoders, i.e. disable YAZ ASN.1 Compiler], , enable_yc=yes)
27 if test "$enable_yc" = "yes"; then
28         ASNMODULE="z39.50"
29         ILLMODULE="ill"
30         ILLLIB=../ill/libill.a
31         ASN_MAKEFILES="z39.50/Makefile ill/Makefile"
32         cp -f include/yaz/z-proto.h include/yaz/proto.h
33 else
34         ILLMODULE=""
35         ASNMODULE=asn
36         ILLLIB=""
37         ASN_MAKEFILES="asn/Makefile"
38         cp -f include/yaz/prt-proto.h include/yaz/proto.h
39 fi
40 dnl
41 dnl ----- Sockets
42 checkBoth=0
43 AC_CHECK_FUNC(connect)
44 if test "$ac_cv_func_connect" = "no"; then
45         AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", checkBoth=1)
46 fi
47 if test "$checkBoth" = "1"; then
48         oldLibs=$LIBS
49         LIBS="$LIBS -lsocket -lnsl"
50         AC_CHECK_FUNC(accept, , [LIBS=$oldLibs])
51 fi
52 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
53 dnl
54 dnl ------ GNU Readline
55 AC_CHECK_LIB(readline, readline, [LIBS="$LIBS -lreadline"])
56 if test "$ac_cv_lib_readline_readline" = "no"; then
57         AC_CHECK_LIB(readline, readline, [LIBS="$LIBS -lreadline -ltermcap"])
58 fi
59 AC_CHECK_LIB(history, add_history, [LIBS="$LIBS -lhistory"])
60 if test "$ac_cv_lib_readline_readline" = "yes"; then
61         AC_CHECK_HEADERS(readline/readline.h readline/history.h)
62 fi
63 dnl
64 dnl ------ tcpd
65 AC_ARG_ENABLE(tcpd,[  --enable-tcpd           enable TCP wrapper for server if available])
66 if test "$enable_tcpd" = "yes"; then
67         AC_MSG_CHECKING(for working tcpd.h)
68         oldLibs=$LIBS
69         LIBS="$LIBS -lwrap -lnsl"
70         AC_TRY_LINK([#include <syslog.h>
71         #include <tcpd.h>
72         int allow_severity = LOG_INFO;
73         int deny_severity = LOG_WARNING;],
74         [struct request_info request_info; int i;
75         i = hosts_access(&request_info);],tcpd_ok=1, tcpd_ok=0)
76         if test "$tcpd_ok" = "0"; then
77                 AC_MSG_RESULT(no)
78                 LIBS=$oldLibs
79         else
80                 AC_MSG_RESULT(yes)
81                 AC_DEFINE(HAVE_TCPD_H)
82         fi
83 fi
84 dnl
85 dnl ------ Headers
86 AC_STDC_HEADERS
87 if test "$ac_cv_header_stdc" = "no"; then
88         AC_MSG_WARN(Your system doesn't seem to support ANSI C)
89 fi
90 dnl
91 dnl ------ Threads
92 AC_ARG_ENABLE(threads, [  --enable-threads        enable threads if available])
93 if test "$enable_threads" = "yes"; then
94         AC_CHECK_HEADERS(pthread.h threads.h)
95         AC_CHECK_FUNC(pthread_mutex_lock)
96         if test "$ac_cv_func_pthread_mutex_lock" = "no"; then
97                 AC_CHECK_LIB(pthread, main)
98         fi
99         AC_DEFINE(_REENTRANT)
100 fi
101 dnl
102 SUBDIRS_VAR="util odr $ASNMODULE $ILLMODULE zutil comstack ccl tab retrieval server include lib client ztest $DOCMODULE"
103 AC_SUBST(SUBDIRS_VAR)
104 dnl
105 dnl ------ Makefiles
106 dnl
107 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)