First work on threaded version.
[idzebra-moved-to-github.git] / configure.in
index a5aa931..e08d6b1 100644 (file)
@@ -1,5 +1,5 @@
 dnl Zebra, Index Data Aps, 1994-1999
-dnl $Id: configure.in,v 1.15 2000-02-04 08:49:26 adam Exp $
+dnl $Id: configure.in,v 1.17 2000-03-15 15:00:30 adam Exp $
 dnl See the file LICENSE.2 for details.
 dnl
 AC_INIT(include/zebraver.h)
@@ -43,7 +43,7 @@ if test "x$yazpath" != "xNONE"; then
 else
        for i in ../yaz* ../yaz; do
                if test -d $i; then
-                       if test -r $i/include/yaz/yaz-version.h; then
+                       if test -r $i/yaz-config; then
                                yazconfig=$i/yaz-config
                        fi
                fi
@@ -60,6 +60,26 @@ 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
@@ -115,29 +135,19 @@ if test -r LICENSE.zmbol; then
        AC_DEFINE(ZMBOL,1)
        PROGPREFIX=zmbol
        SUBDIR="util bfile dfa dict isams isamc isam rset recctrl index"
+       SUBMAKE="Makefile util/Makefile bfile/Makefile dfa/Makefile dict/Makefile isams/Makefile isamc/Makefile isam/Makefile rset/Makefile recctrl/Makefile index/Makefile"
        SUBLIBS="../lib/rset.a ../lib/dict.a ../lib/isams.a ../lib/isam.a\
  ../lib/recctrl.a ../lib/isamc.a ../lib/bfile.a ../lib/dfa.a\
  ../lib/zebrautl.a"
 else
        PROGPREFIX=zebra
        SUBDIR="util bfile dfa dict isams rset recctrl index"
+       SUBMAKE="Makefile util/Makefile bfile/Makefile dfa/Makefile dict/Makefile isams/Makefile rset/Makefile recctrl/Makefile index/Makefile"
        SUBLIBS="../lib/rset.a ../lib/dict.a ../lib/isams.a\
  ../lib/recctrl.a ../lib/bfile.a ../lib/dfa.a\
  ../lib/zebrautl.a"
        AC_DEFINE(ZMBOL,0)
-       if test ! -d isamc; then
-               mkdir isamc
-       fi
-       if test ! -r isamc/Makefile.in; then
-               touch isamc/Makefile.in
-       fi
-       if test ! -d isam; then
-               mkdir isam
-       fi
-       if test ! -r isam/Makefile.in; then
-               touch isam/Makefile.in
-       fi
 fi
 dnl
 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)
+AC_OUTPUT($SUBMAKE)