+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=DIR yaz-config in DIR (example /home/yaz-1.5)], [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/yaz-config; then
+ yazconfig=$i/yaz-config
+ fi
+ fi
+ done
+ if test "x$yazconfig" = "xNONE"; then
+ AC_PATH_PROG(yazconfig, yaz-config, NONE)
+ fi
+fi
+AC_MSG_CHECKING(for YAZ)
+if test -r $yazconfig; then
+ . $yazconfig
+ AC_MSG_RESULT($yazconfig)
+else
+ AC_MSG_RESULT(Not found)
+fi
+dnl
+dnl ------ Threads
+AC_ARG_ENABLE(threads, [ --disable-threads disable threads],[enable_threads=$enableval],[enable_threads=yes])
+if test "$enable_threads" = "yes"; then
+ AC_CHECK_LIB(pthread,main)
+ AC_MSG_CHECKING(for working POSIX Threads)
+ AC_TRY_LINK([#include <pthread.h>
+ int func(void *p) { return 0; }
+ ],[
+ pthread_t pthread_id;
+ int r = pthread_create (&pthread_id, 0, func, 0);],
+ thread_ok=yes,thread_ok=no)
+ if test "$thread_ok" = "yes"; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_PTHREAD_H)
+ AC_DEFINE(_REENTRANT)
+ else
+ AC_MSG_RESULT(no)
+ fi
+fi
+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=DIR tclConfig.sh in DIR], [tclconfig=$withval])
+if test "x$tclconfig" = xNONE; then
+ saveprefix=${prefix}
+ AC_PREFIX_PROGRAM(tclsh)
+ tclconfig=${prefix}/lib
+ prefix=${saveprefix}
+fi
+AC_MSG_CHECKING(for Tcl)
+if test -r ${tclconfig}/tclConfig.sh; then
+ . ${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
+ 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)
+ AC_DEFINE(HAVE_TCL_H,1)
+else
+ AC_MSG_RESULT(Not found)
+ AC_DEFINE(HAVE_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)