-fi
-echo $ac_n "checking for YAZ""... $ac_c" 1>&6
-echo "configure:1376: checking for YAZ" >&5
-if test -r $yazconfig; then
- . $yazconfig
- echo "$ac_t""$yazconfig" 1>&6
-else
- echo "$ac_t""Not found" 1>&6
-fi
-# Check whether --enable-threads or --disable-threads was given.
-if test "${enable_threads+set}" = set; then
- enableval="$enable_threads"
- enable_threads=$enableval
-else
- enable_threads=yes
-fi
-
-if test "$enable_threads" = "yes"; then
- echo $ac_n "checking for main in -lpthread""... $ac_c" 1>&6
-echo "configure:1393: checking for main in -lpthread" >&5
-ac_lib_var=`echo pthread'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lpthread $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1401 "configure"
-#include "confdefs.h"
-
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:1408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo pthread | sed -e 's/[^a-zA-Z0-9_]/_/g' \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
- LIBS="-lpthread $LIBS"
-
-else
- echo "$ac_t""no" 1>&6
-fi
-
- echo $ac_n "checking for working POSIX Threads""... $ac_c" 1>&6
-echo "configure:1436: checking for working POSIX Threads" >&5
- cat > conftest.$ac_ext <<EOF
-#line 1438 "configure"
-#include "confdefs.h"
-#include <pthread.h>
- int func(void *p) { return 0; }
-
-int main() {
-
- pthread_t pthread_id;
- int r = pthread_create (&pthread_id, 0, func, 0);
-; return 0; }
-EOF
-if { (eval echo configure:1449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- thread_ok=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- thread_ok=no
-fi
-rm -f conftest*
- if test "$thread_ok" = "yes"; then
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<\EOF
-#define HAVE_PTHREAD_H 1
-EOF
-
- cat >> confdefs.h <<\EOF
-#define _REENTRANT 1
-EOF
-
+ echo $ac_n "checking for YAZ""... $ac_c" 1>&6
+echo "configure:1368: checking for YAZ" >&5
+ if $yazconfig --version >/dev/null 2>&1; then
+ YAZLIB=`$yazconfig --libs threads`
+ # if this is empty, it's a simple version YAZ 1.6 script
+ # so we have to source it instead...
+ if test "X$YAZLIB" = "X"; then
+ . $yazconfig
+ else
+ YAZLALIB=`$yazconfig --lalibs threads`
+ YAZINC=`$yazconfig --cflags threads`
+ YAZVERSION=`$yazconfig --version`
+ fi
+ echo "$ac_t""$yazconfig" 1>&6