diff --git a/configure.ac b/configure.ac index cbee6fa7..b7725e34 100644 --- a/configure.ac +++ b/configure.ac @@ -951,6 +951,10 @@ if [ test -n "$DOXYGEN" ] fi +#---- check for pthreads library +AC_SEARCH_LIBS([pthread_mutex_init],[pthread],[AC_DEFINE([HAVE_PTHREADS], [1], [Have pthreads library])], [AC_MSG_WARN([pthreads not available])]) + + dnl ----- dnl ----- Start of "Things needed for gldns" section dnl ----- diff --git a/src/compat/arc4_lock.c b/src/compat/arc4_lock.c index 44662841..facf9575 100644 --- a/src/compat/arc4_lock.c +++ b/src/compat/arc4_lock.c @@ -34,6 +34,23 @@ #include "config.h" #define LOCKRET(func) func +#ifdef HAVE_PTHREADS +#include "pthread.h" + +static pthread_mutex_t arc_lock = PTHREAD_MUTEX_INITIALIZER; + +void _ARC4_LOCK(void) +{ + pthread_mutex_lock(&arc_lock); +} + +void _ARC4_UNLOCK(void) +{ + pthread_mutex_unlock(&arc_lock); +} + +#else +/* XXX - add windows-(or at least non pthread) specific lock routines here */ void _ARC4_LOCK(void) { } @@ -41,4 +58,4 @@ void _ARC4_LOCK(void) void _ARC4_UNLOCK(void) { } - +#endif diff --git a/src/test/tpkg/setup-env.sh b/src/test/tpkg/setup-env.sh index ad43c879..18cdfbeb 100755 --- a/src/test/tpkg/setup-env.sh +++ b/src/test/tpkg/setup-env.sh @@ -13,7 +13,7 @@ then fi if [ ! -f "${SRCROOT}/libtool" ] then - (cd "${SRCROOT}"; libtoolize -fic) + (cd "${SRCROOT}"; (glibtoolize -fic || libtoolize -fic)) fi if [ ! -f "${SRCROOT}/configure" ] then