aboutsummaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean.guyomarch@gmail.com>2014-08-21 11:23:24 +0200
committerCedric BAIL <cedric@osg.samsung.com>2014-08-21 12:04:53 +0200
commitf449f0ddb6c030e1763cc549caac5e162efbca74 (patch)
treeb108946ace8d71909c36ab0facbb2bcbbc6438be /m4
parentevas: add evas gl-drm engine (diff)
downloadefl-f449f0ddb6c030e1763cc549caac5e162efbca74.tar.gz
eina: port Eina_Spinlock for OSX
Summary: Support of Spinlocks in Eina (Eina_Spinlock) for OSX, which does not implement them in pthread. @feature Reviewers: raster, raoulh, naguirre, cedric, stefan_schmidt Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1151 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'm4')
-rw-r--r--m4/efl_threads.m429
1 files changed, 29 insertions, 0 deletions
diff --git a/m4/efl_threads.m4 b/m4/efl_threads.m4
index 04b3e64c3a..9596908c96 100644
--- a/m4/efl_threads.m4
+++ b/m4/efl_threads.m4
@@ -125,8 +125,37 @@ if test "x${efl_have_posix_threads_spinlock}" = "xyes" ; then
AC_DEFINE([EFL_HAVE_POSIX_THREADS_SPINLOCK], [1], [Define to mention that POSIX threads spinlocks are supported])
fi
+
+dnl checks if the compiler supports OSX spinlock
+
+efl_have_osx_spinlock="no"
+
+if test "x${_efl_have_posix_threads}" = "xyes" ; then
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[
+#include <libkern/OSAtomic.h>
+ ]],
+ [[
+OSSpinLock spin_lock = 0;
+OSSpinLockTry(&spin_lock);
+ ]])],
+ [efl_have_osx_spinlock="yes"],
+ [efl_have_osx_spinlock="no"])
+fi
+
+AC_MSG_CHECKING([whether to build OSX spinlock code])
+AC_MSG_RESULT([${efl_have_osx_spinlock}])
+
+if test "x${efl_have_osx_spinlock}" = "xyes" ; then
+ AC_DEFINE([EFL_HAVE_OSX_SPINLOCK], [1], [Define to mention that OSX spinlocks are supported])
+fi
+
+
+
AS_IF([test "x$_efl_have_posix_threads" = "xyes" || test "x$_efl_have_win32_threads" = "xyes"],
[$1],
[m4_if([$2], [$2], [AC_MSG_ERROR([Threads are required.])])])
+
])
+