summaryrefslogtreecommitdiff
path: root/legacy/eet/m4/efl_pthread.m4
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2009-12-30 00:02:48 +0000
committerVincent Torri <vincent.torri@gmail.com>2009-12-30 00:02:48 +0000
commit7ccfc62c02ae3e7821d7ba96f9376580cefdab9a (patch)
treebad8ec24318ae6ae8213af75e2263757cf005f47 /legacy/eet/m4/efl_pthread.m4
parent8e455fa1e69003aea7cd2cdef568c882356f8d56 (diff)
* better m4 code
* use latest efl_pthread.m4 code and update configure.ac accordingly SVN revision: 44771
Diffstat (limited to 'legacy/eet/m4/efl_pthread.m4')
-rw-r--r--legacy/eet/m4/efl_pthread.m446
1 files changed, 40 insertions, 6 deletions
diff --git a/legacy/eet/m4/efl_pthread.m4 b/legacy/eet/m4/efl_pthread.m4
index 7bd341c709..384b7ae230 100644
--- a/legacy/eet/m4/efl_pthread.m4
+++ b/legacy/eet/m4/efl_pthread.m4
@@ -3,7 +3,7 @@ dnl That code is public domain and can be freely used or copied.
3 3
4dnl Macro that check if several ASM instruction sets are available or not. 4dnl Macro that check if several ASM instruction sets are available or not.
5 5
6dnl Usage: EFL_CHECK_EFL_CHECK_PTHREAD([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) 6dnl Usage: EFL_CHECK_EFL_CHECK_PTHREAD(want_pthread_spin[, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
7dnl Call AC_SUBST(EFL_PTHREAD_FLAGS) 7dnl Call AC_SUBST(EFL_PTHREAD_FLAGS)
8dnl Define EFL_HAVE_PTHREAD 8dnl Define EFL_HAVE_PTHREAD
9 9
@@ -31,9 +31,18 @@ dnl check if the compiler supports pthreads
31_efl_have_pthread="no" 31_efl_have_pthread="no"
32 32
33if test "x${_efl_enable_pthread}" = "xyes" ; then 33if test "x${_efl_enable_pthread}" = "xyes" ; then
34 AC_CHECK_HEADER(pthread.h, 34
35 AC_COMPILE_IFELSE(
36 [AC_LANG_PROGRAM([[
37#include <pthread.h>
38 ]],
39 [[
40pthread_t id;
41id = pthread_self();
42 ]])],
35 [_efl_have_pthread="yes"], 43 [_efl_have_pthread="yes"],
36 [_efl_have_pthread="no"]) 44 [_efl_have_pthread="no"])
45
37fi 46fi
38 47
39AC_MSG_CHECKING([whether system support POSIX threads]) 48AC_MSG_CHECKING([whether system support POSIX threads])
@@ -63,9 +72,34 @@ if test "x${_efl_have_pthread}" = "xyes" ; then
63 AC_DEFINE(EFL_HAVE_PTHREAD, 1, [Define to mention that POSIX threads are supported]) 72 AC_DEFINE(EFL_HAVE_PTHREAD, 1, [Define to mention that POSIX threads are supported])
64fi 73fi
65 74
66if test "x${_efl_have_pthread}" = "xyes" ; then 75dnl check if the compiler supports pthreads spinlock
67 ifelse([$1], , :, [$1]) 76
68else 77_efl_have_pthread_spinlock="no"
69 ifelse([$2], , :, [$2]) 78
79if test "x${_efl_have_pthread}" = "xyes" && test "x$1" = "xyes" ; then
80
81 AC_COMPILE_IFELSE(
82 [AC_LANG_PROGRAM([[
83#include <pthread.h>
84 ]],
85 [[
86pthread_spinlock_t lock;
87int res;
88res = pthread_spin_init(&lock, PTHREAD_PROCESS_PRIVATE);
89 ]])],
90 [_efl_have_pthread_spinlock="yes"],
91 [_efl_have_pthread_spinlock="no"])
92
93fi
94
95AC_MSG_CHECKING([whether to build POSIX threads spinlock code])
96AC_MSG_RESULT([${_efl_have_pthread_spinlock}])
97
98if test "x${_efl_have_pthread_spinlock}" = "xyes" ; then
99 AC_DEFINE(EFL_HAVE_PTHREAD_SPINLOCK, 1, [Define to mention that POSIX threads spinlocks are supported])
70fi 100fi
101
102AS_IF([test "x$_efl_have_pthread" = "xyes"], [$2], [$3])
103AS_IF([test "x$_efl_have_pthread_spinlock" = "xyes"], [$4], [$5])
104
71]) 105])