Fixed Makefile.
[yaz-moved-to-github.git] / configure.in
1 dnl YAZ Toolkit
2 dnl (c) Index Data 1994-1998
3 dnl See the file LICENSE for details.
4 dnl $Id: configure.in,v 1.2 1998-09-02 12:41:50 adam Exp $
5 AC_INIT(include/yaz-version.h)
6 dnl ------ Substitutions
7 AC_SUBST(ODEFS)
8 dnl
9 dnl ------ Checking programs
10 AC_ARG_ENABLE(gcc, [  --enable-gcc            allow use of gcc if available],
11     [gcc_ok=$enableval], [gcc_ok=no])
12 if test "$gcc_ok" = "yes"; then
13     AC_PROG_CC
14 else
15     CC=${CC-cc}
16 AC_SUBST(CC)
17 fi
18 AC_PROG_CPP
19 AC_PROG_INSTALL
20 AC_PROG_RANLIB
21 dnl
22 dnl ----- Sockets
23 checkBoth=0
24 AC_CHECK_FUNC(connect)
25 if test "$ac_cv_func_connect" = "no"; then
26         AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", checkBoth=1)
27 fi
28 if test "$checkBoth" = "1"; then
29         oldLibs=$LIBS
30         LIBS="$LIBS -lsocket -lnsl"
31         AC_CHECK_FUNC(accept, , [LIBS=$oldLibs])
32 fi
33 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
34 dnl
35 dnl ------ Threads
36 AC_ARG_ENABLE(threads, [  --enable-threads        enable threads if available],
37     [threads_ok=$enableval], [threads_ok=no])
38 if test "$threads_ok" = "yes"; then
39         AC_CHECK_HEADERS(pthread.h threads.h)
40         AC_CHECK_FUNC(pthread_mutex_lock)
41         if test "$ac_cv_func_pthread_mutex_lock" = "no"; then
42                 AC_CHECK_LIB(pthread, main)
43         fi
44         ODEFS="$ODEFS -D_REENTRANT"
45 fi
46 dnl
47 dnl ------ Headers
48 AC_STDC_HEADERS
49 if test "$ac_cv_header_stdc" = "no"; then
50         AC_MSG_WARN(Your system doesn't seem to support ANSI C)
51 fi
52 dnl
53 dnl ------ Makefiles
54 AC_OUTPUT(Makefile util/Makefile asn/Makefile odr/Makefile comstack/Makefile client/Makefile server/Makefile ztest/Makefile retrieval/Makefile ccl/Makefile lib/Makefile rfc1006/Makefile)