aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2011-04-19 09:20:44 +0300
committerLasse Collin <lasse.collin@tukaani.org>2011-04-19 09:20:44 +0300
commit9c1b05828a88eff54409760b92162c7cc2c7cff6 (patch)
treea7369efecb6402b18289d7ea51a6b47f370cdfcd /configure.ac
parentUpdate THANKS. (diff)
downloadxz-9c1b05828a88eff54409760b92162c7cc2c7cff6.tar.xz
Fix portability problems in mythread.h.
Use gettimeofday() if clock_gettime() isn't available (e.g. Darwin). The test for availability of pthread_condattr_setclock() and CLOCK_MONOTONIC was incorrect. Instead of fixing the #ifdefs, use an Autoconf test. That way if there exists a system that supports them but doesn't specify the matching POSIX #defines, the features will still get detected. Don't try to use pthread_sigmask() on OpenVMS. It doesn't have that function. Guard mythread.h against being #included multiple times.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac7
1 files changed, 7 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 8cba630c..73dc358c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -435,7 +435,14 @@ if test "x$enable_threads" = xyes; then
LIBS="$LIBS $PTHREAD_LIBS"
AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
+
+ # These are nice to have but not mandatory.
+ OLD_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
AC_SEARCH_LIBS([clock_gettime], [rt])
+ AC_CHECK_FUNCS([clock_gettime pthread_condattr_setclock])
+ AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[#include <time.h>]])
+ CFLAGS=$OLD_CFLAGS
fi
AM_CONDITIONAL([COND_THREADS], [test "x$ax_pthread_ok" = xyes])