Towards 2.1.52.
[yaz-moved-to-github.git] / configure.ac
index 1c5c06b..e3a1f57 100644 (file)
@@ -1,8 +1,8 @@
 dnl YAZ Toolkit, Index Data 1995-2007
 dnl See the file LICENSE for details.
-dnl $Id: configure.ac,v 1.64 2007-02-25 14:46:50 adam Exp $
+dnl $Id: configure.ac,v 1.66 2007-03-07 08:05:25 adam Exp $
 AC_PREREQ(2.59)
-AC_INIT([yaz],[2.1.51],[yaz-help@indexdata.dk])
+AC_INIT([yaz],[2.1.52],[yaz-help@indexdata.dk])
 AC_CONFIG_SRCDIR(configure.ac)
 AC_CONFIG_AUX_DIR([config])
 AM_INIT_AUTOMAKE([1.8])
@@ -339,6 +339,20 @@ if test "$enable_threads" = "yes" -a "$HAVETHREADS" = "0"; then
     ACX_PTHREAD([
            CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
            AC_DEFINE(YAZ_POSIX_THREADS)
+           dnl unfortunately empty thread lib spec is problematic because 
+            dnl 'yaz-config --cflags' is not always passed to linker in 
+            dnl applications using YAZ (such as Zebra).
+           if test "x$PTHREAD_LIBS" = "x"; then
+               OLIBS=$LIBS
+               for lib in -lpthread -lpthreads -lc_r; do
+                   LIBS="$lib $OLIBS"
+                   AC_TRY_LINK([ #include <pthread.h> ],
+                           [ pthread_t id; pthread_join(id, 0); ],
+                           [ PTHREAD_LIBS=$lib; break ]
+                       )
+               done
+               LIBS=$OLIBS
+           fi
            LIBS="$PTHREAD_LIBS $LIBS"
            YAZ_CONFIG_CFLAGS="$YAZ_CONFIG_CFLAGS $PTHREAD_CFLAGS -DYAZ_POSIX_THREADS=1"
            ])