summaryrefslogtreecommitdiff
path: root/legacy/eina/m4/common/efl_threads.m4
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2012-05-30 13:25:13 +0000
committerVincent Torri <vincent.torri@gmail.com>2012-05-30 13:25:13 +0000
commit353030141ddbbda627064a460fa933b8de9b99f4 (patch)
treed0b7d83f6b21c8def2686bd30e81d68471b49105 /legacy/eina/m4/common/efl_threads.m4
parentf328aabf7babb7f7bb33b02711b661f1866ee366 (diff)
Eina: move spin lock checks in the generic m4 threads macro
SVN revision: 71562
Diffstat (limited to '')
-rw-r--r--legacy/eina/m4/common/efl_threads.m487
1 files changed, 41 insertions, 46 deletions
diff --git a/legacy/eina/m4/common/efl_threads.m4 b/legacy/eina/m4/common/efl_threads.m4
index 9deb1d6..ae29606 100644
--- a/legacy/eina/m4/common/efl_threads.m4
+++ b/legacy/eina/m4/common/efl_threads.m4
@@ -12,6 +12,8 @@ dnl Defines EFL_HAVE_POSIX_THREADS or EFL_HAVE_WIN32_THREADS, and EFL_HAVE_THREA
12AC_DEFUN([EFL_CHECK_THREADS], 12AC_DEFUN([EFL_CHECK_THREADS],
13[ 13[
14 14
15dnl Generic thread detection
16
15EFL_PTHREAD_CFLAGS="" 17EFL_PTHREAD_CFLAGS=""
16EFL_PTHREAD_LIBS="" 18EFL_PTHREAD_LIBS=""
17 19
@@ -69,54 +71,22 @@ fi
69 71
70AC_MSG_CHECKING([which threads API is used]) 72AC_MSG_CHECKING([which threads API is used])
71if test "x${_efl_have_posix_threads}" = "xyes" ; then 73if test "x${_efl_have_posix_threads}" = "xyes" ; then
72 have_threads="POSIX" 74 efl_have_threads="POSIX"
73else 75else
74 if test "x${_efl_have_win32_threads}" = "xyes" ; then 76 if test "x${_efl_have_win32_threads}" = "xyes" ; then
75 have_threads="Windows" 77 efl_have_threads="Windows"
76 else 78 else
77 have_threads="none" 79 efl_have_threads="no"
78 fi 80 fi
79fi 81fi
80AC_MSG_RESULT([${have_threads}]) 82AC_MSG_RESULT([${efl_have_threads}])
81 83
82AC_SUBST(EFL_PTHREAD_CFLAGS) 84AC_SUBST(EFL_PTHREAD_CFLAGS)
83AC_SUBST(EFL_PTHREAD_LIBS) 85AC_SUBST(EFL_PTHREAD_LIBS)
84 86
85_efl_enable_on_off_threads="no"
86AC_ARG_ENABLE([on-off-threads],
87 [AC_HELP_STRING([--enable-on-off-threads], [only turn this on if you know what you are doing, and don't complain if the world freeze])],
88 [_efl_enable_on_off_threads="${enableval}"])
89
90have_on_off_threads="no"
91if test "x${_efl_enable_on_off_threads}" = "xyes"; then
92 have_on_off_threads="yes"
93 AC_DEFINE([EFL_ON_OFF_THREADS], [1], [make it possible to disable all locks])
94fi
95AC_MSG_CHECKING([whether to turn on/off threads lock on demand])
96AC_MSG_RESULT([${_efl_enable_on_off_threads}])
97
98_efl_enable_debug_threads="no"
99AC_ARG_ENABLE([debug-threads],
100 [AC_HELP_STRING([--enable-debug-threads], [disable assert when you forgot to call eina_threads_init])],
101 [_efl_enable_debug_threads="${enableval}"])
102
103have_debug_threads="no"
104if test "x${_efl_have_posix_threads}" = "xyes" && test "x${_efl_enable_debug_threads}" = "xyes"; then
105 have_debug_threads="yes"
106 AC_DEFINE([EFL_DEBUG_THREADS], [1], [Assert when forgot to call eina_threads_init])
107fi
108
109AS_IF([test "x$_efl_have_posix_threads" = "xyes" || test "x$_efl_have_win32_threads" = "xyes"], [$1], [$2])
110])
111
112dnl Usage: EFL_CHECK_SPINLOCK(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
113dnl Defines EFL_HAVE_POSIX_THREADS_SPINLOCK
114AC_DEFUN([EFL_CHECK_SPINLOCK],
115[
116
117dnl check if the compiler supports pthreads spinlock 87dnl check if the compiler supports pthreads spinlock
118 88
119_efl_have_posix_threads_spinlock="no" 89efl_have_posix_threads_spinlock="no"
120 90
121if test "x${_efl_have_posix_threads}" = "xyes" ; then 91if test "x${_efl_have_posix_threads}" = "xyes" ; then
122 92
@@ -133,22 +103,47 @@ pthread_spinlock_t lock;
133int res; 103int res;
134res = pthread_spin_init(&lock, PTHREAD_PROCESS_PRIVATE); 104res = pthread_spin_init(&lock, PTHREAD_PROCESS_PRIVATE);
135 ]])], 105 ]])],
136 [_efl_have_posix_threads_spinlock="yes"], 106 [efl_have_posix_threads_spinlock="yes"],
137 [_efl_have_posix_threads_spinlock="no"]) 107 [efl_have_posix_threads_spinlock="no"])
138 CFLAGS=${SAVE_CFLAGS} 108 CFLAGS=${SAVE_CFLAGS}
139 LIBS=${SAVE_LIBS} 109 LIBS=${SAVE_LIBS}
140 110
141fi 111fi
142 112
143AC_MSG_CHECKING([whether to build POSIX threads spinlock code]) 113AC_MSG_CHECKING([whether to build POSIX threads spinlock code])
144AC_MSG_RESULT([${_efl_have_posix_threads_spinlock}]) 114AC_MSG_RESULT([${efl_have_posix_threads_spinlock}])
145if test "x${_efl_enable_posix_threads}" = "xyes" && test "x${_efl_have_posix_threads_spinlock}" = "xno" ; then
146 AC_MSG_WARN([POSIX threads support requested but spinlocks are not supported])
147fi
148 115
149if test "x${_efl_have_posix_threads_spinlock}" = "xyes" ; then 116if test "x${efl_have_posix_threads_spinlock}" = "xyes" ; then
150 AC_DEFINE([EFL_HAVE_POSIX_THREADS_SPINLOCK], [1], [Define to mention that POSIX threads spinlocks are supported]) 117 AC_DEFINE([EFL_HAVE_POSIX_THREADS_SPINLOCK], [1], [Define to mention that POSIX threads spinlocks are supported])
151fi 118fi
152AS_IF([test "x$_efl_have_posix_threads_spinlock" = "xyes"], [$1], [$2])
153])
154 119
120dnl Check ON-OFF threads
121
122_efl_enable_on_off_threads="no"
123AC_ARG_ENABLE([on-off-threads],
124 [AC_HELP_STRING([--enable-on-off-threads], [only turn this on if you know what you are doing, and do not complain if the world freeze])],
125 [_efl_enable_on_off_threads="${enableval}"])
126
127efl_have_on_off_threads="no"
128if test "x${_efl_have_posix_threads}" = "xyes" && test "x${_efl_enable_on_off_threads}" = "xyes"; then
129 efl_have_on_off_threads="yes"
130 AC_DEFINE([EFL_ON_OFF_THREADS], [1], [make it possible to disable all locks])
131fi
132AC_MSG_CHECKING([whether to turn on/off threads lock on demand])
133AC_MSG_RESULT([${efl_have_on_off_threads}])
134
135dnl Check debug threads
136
137_efl_enable_debug_threads="no"
138AC_ARG_ENABLE([debug-threads],
139 [AC_HELP_STRING([--enable-debug-threads], [disable assert when you forgot to call eina_threads_init])],
140 [_efl_enable_debug_threads="${enableval}"])
141
142efl_have_debug_threads="no"
143if test "x${_efl_have_posix_threads}" = "xyes" && test "x${_efl_enable_debug_threads}" = "xyes"; then
144 efl_have_debug_threads="yes"
145 AC_DEFINE([EFL_DEBUG_THREADS], [1], [Assert when forgot to call eina_threads_init])
146fi
147
148AS_IF([test "x$_efl_have_posix_threads" = "xyes" || test "x$_efl_have_win32_threads" = "xyes"], [$1], [$2])
149])