From: Adam Dickmeiss Date: Sun, 25 Feb 2007 21:04:04 +0000 (+0000) Subject: Deal with empty thread spec if that is what ACX_PTHREAD returns. X-Git-Tag: YAZ.2.1.52~3 X-Git-Url: http://lists.indexdata.com/cgi-bin?a=commitdiff_plain;h=3f7c21d3bf85a142671d97bd4183bc3fe9b61e9e;p=yaz-moved-to-github.git Deal with empty thread spec if that is what ACX_PTHREAD returns. Unfortunately empty thread lib spec is problematic because 'yaz-config --cflags' is not always passed to linker in applications using YAZ (such as Zebra). --- diff --git a/configure.ac b/configure.ac index 1c5c06b..eab19cc 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ 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.65 2007-02-25 21:04:04 adam Exp $ AC_PREREQ(2.59) AC_INIT([yaz],[2.1.51],[yaz-help@indexdata.dk]) AC_CONFIG_SRCDIR(configure.ac) @@ -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_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" ])