fi
-# Checks for header files.
+# Checks for C header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([ \
endian.h \
sys/types.h \
])
+# Checks for C++ header files.
AC_LANG(C++)
AC_CHECK_HEADERS([ \
QtCore/QMutex \
AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
+# Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
+# See also http://doc.trolltech.com/4.3/qmutex.html.
+if test x$ac_have_qtcore = xyes; then
+ AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
+ AC_LANG(C++)
+ AC_TRY_COMPILE([
+ #include <QtCore/QMutex>
+ ],
+ [
+ QMutex M;
+ M.tryLock(1);
+ M.unlock();
+ return 0;
+ ],
+ [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
+ ],
+ [
+ AC_MSG_RESULT([no])
+ ])
+ AC_LANG(C)
+fi
+
+
# -------------------- ok. We're done. --------------------
AC_OUTPUT(
#define _GNU_SOURCE
#endif
+#include "config.h"
#include <QtCore/QMutex> // class QMutex
#include <QtCore/QThread> // class QThread
#include <cassert>
M.unlock();
M.unlock();
}
+#if defined(HAVE_QTCORE_QMUTEX_TRYLOCK_INT)
{
QMutex M(QMutex::NonRecursive);
assert(M.tryLock(1));
assert(! M.tryLock(1));
M.unlock();
}
+#endif
pthread_barrier_init(&s_barrier, 0, n_threads);
s_pMutex = new QMutex();