Improved installation. Updated for inclusion of YAZ header files.
[idzebra-moved-to-github.git] / configure.in
index fdd51c8..dbf056e 100644 (file)
-dnl YAZ/Zebra Toolkit
-dnl (c) Index Data 1994-1998
-dnl See the file LICENSE for details.
-dnl $Id: configure.in,v 1.1 1998-09-02 14:15:26 adam Exp $
+dnl Zebra, Index Data Aps, 1994-1999
+dnl $Id: configure.in,v 1.11 1999-11-30 13:48:03 adam Exp $
+dnl See the file LICENSE.2 for details.
+dnl
 AC_INIT(include/zebraver.h)
 dnl ------ Substitutions
 AC_SUBST(ODEFS)
+AC_SUBST(DEFS)
+AC_SUBST(TCL_INCLUDE)
+AC_SUBST(TCL_LIB)
+AC_SUBST(YAZLIB)
+AC_SUBST(YAZINC)
 dnl
 dnl ------ Checking programs
-AC_ARG_ENABLE(gcc, [  --enable-gcc            allow use of gcc if available],
-    [gcc_ok=$enableval], [gcc_ok=no])
-if test "$gcc_ok" = "yes"; then
-    AC_PROG_CC
-else
-    CC=${CC-cc}
-AC_SUBST(CC)
-fi
+AC_PROG_CC
 AC_PROG_CPP
 AC_PROG_INSTALL
 AC_PROG_RANLIB
 dnl
-dnl ----- Sockets
-checkBoth=0
-AC_CHECK_FUNC(connect)
-if test "$ac_cv_func_connect" = "no"; then
-       AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", checkBoth=1)
+dnl ------ Build root
+AC_SUBST(build_root)
+AC_ARG_WITH(build-root, [  --with-buildroot        RPM Build root],[build_root=$withval],[build_root=""])
+dnl
+dnl ------ Look for Yaz
+dnl See if user specified location of yaz-config; otherwise
+dnl use ../yaz if is a directory (internal development); otherwise
+dnl use yaz-config found in PATH.
+yazconfig=NONE
+yazpath=NONE
+AC_ARG_WITH(yazconfig, [  --with-yazconfig        Path for yaz-config], [yazpath=$withval])
+if test "x$yazpath" != "xNONE"; then
+       yazconfig=$yazpath/yaz-config
+else
+       for i in ../yaz* ../yaz; do
+               if test -d $i; then
+                       if test -r $i/include/yaz/yaz-version.h; then
+                               yazconfig=$i/yaz-config
+                       fi
+               fi
+       done
+       if test "x$yazconfig" = "xNONE"; then
+               AC_PATH_PROG(yazconfig, yaz-config, NONE)
+       fi
 fi
-if test "$checkBoth" = "1"; then
-       oldLibs=$LIBS
-       LIBS="$LIBS -lsocket -lnsl"
-       AC_CHECK_FUNC(accept, , [LIBS=$oldLibs])
+AC_MSG_CHECKING(for YAZ)
+if test -r $yazconfig; then
+       . $yazconfig
+       AC_MSG_RESULT($yazconfig)
+else
+       AC_MSG_RESULT(Not found)
 fi
-AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
-dnl
-dnl ------ Threads
-AC_ARG_ENABLE(threads, [  --enable-threads        enable threads if available],
-    [threads_ok=$enableval], [threads_ok=no])
-if test "$threads_ok" = "yes"; then
-       AC_CHECK_HEADERS(pthread.h threads.h)
-       AC_CHECK_FUNC(pthread_mutex_lock)
-       if test "$ac_cv_func_pthread_mutex_lock" = "no"; then
-               AC_CHECK_LIB(pthread, main)
+dnl
+dnl ------ Look for Tcl
+dnl See if user has specified location of tclConfig.sh; otherwise
+dnl see if tclConfig.sh exists in same prefix lcoation as tclsh; otherwise
+dnl disable Tcl.
+TCL_LIB=""
+TCL_INCLUDE=""
+tclconfig=NONE
+AC_ARG_WITH(tclconfig, [  --with-tclconfig        Path for tclConfig.sh], [tclconfig=$withval])
+if test "x$tclconfig" = xNONE; then
+       saveprefix=${prefix}
+       AC_PREFIX_PROGRAM(tclsh)
+       tclconfig=${prefix}/lib
+       prefix=${saveprefix}
+fi
+if test -r ${tclconfig}/tclConfig.sh; then
+       AC_MSG_CHECKING(for Tcl)
+       . ${tclconfig}/tclConfig.sh
+       if test -r ${tclconfig}/../generic/tcl.h; then
+               TCL_INCLUDE=-I${tclconfig}/../generic
+               TCL_LIB="$TCL_BUILD_LIB_SPEC $TCL_LIBS"
+       else
+               TCL_INCLUDE=-I${TCL_PREFIX}/include
+               TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
        fi
-       ODEFS="$ODEFS -D_REENTRANT"
+        SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
+        SHLIB_LD=$TCL_SHLIB_LD
+        SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
+        SHLIB_VERSION=$TCL_SHLIB_VERSION
+        AC_MSG_RESULT($TCL_VERSION)
+       ODEFS="-DHAVE_TCL_H=1"
+else
+       ODEFS="-DHAVE_TCL_H=0"
+fi
+dnl
+dnl ------ times
+AC_CHECK_HEADERS(sys/times.h)
+dnl
+dnl ------- BZIP2
+AC_CHECK_LIB(bz2,bzCompressInit)
+if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then
+       AC_CHECK_HEADERS(bzlib.h)
 fi
 dnl
-dnl ------ Headers
+dnl ------ ANSI C Header files
 AC_STDC_HEADERS
 if test "$ac_cv_header_stdc" = "no"; then
        AC_MSG_WARN(Your system doesn't seem to support ANSI C)
 fi
 dnl
-dnl ------ Makefiles
-AC_OUTPUT(Makefile util/Makefile bfile/Makefile dfa/Makefile dict/Makefile isam/Makefile isamc/Makefile recctrl/Makefile rset/Makefile index/Makefile)
+dnl ------ Create Makefiles
+AC_OUTPUT(Makefile util/Makefile bfile/Makefile dfa/Makefile dict/Makefile isams/Makefile isam/Makefile isamc/Makefile recctrl/Makefile rset/Makefile index/Makefile)