summaryrefslogtreecommitdiff
path: root/m4/efl_threads.m4
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-05-26 18:30:54 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-06-18 08:56:34 +0200
commit639869703f3e8b0ce34d83b523ff611e85cfd93b (patch)
treedc72c59b87a83d02758ae81f979a25e21b226a8b /m4/efl_threads.m4
parent4f8e15c16c4f68b6fae8708b177ce672daefc59c (diff)
autotools: REMOVAL!
Get your seatbelt fastend! It is happening! AUTOTOOLS IS GONE NOW! All praise to meson! This time the final version, ci has been adjusted, and now does not try anymore to build a removed buildsystem. However, the scripts in there need cleaning up. Differential Revision: https://phab.enlightenment.org/D9027
Diffstat (limited to 'm4/efl_threads.m4')
-rw-r--r--m4/efl_threads.m4163
1 files changed, 0 insertions, 163 deletions
diff --git a/m4/efl_threads.m4 b/m4/efl_threads.m4
deleted file mode 100644
index 54a5fc6..0000000
--- a/m4/efl_threads.m4
+++ /dev/null
@@ -1,163 +0,0 @@
1dnl Copyright (C) 2010 Vincent Torri <vtorri at univ-evry dot fr>
2dnl rwlock code added by Mike Blumenkrantz <mike at zentific dot com>
3dnl This code is public domain and can be freely used or copied.
4
5dnl Macro that check if POSIX or Win32 threads library is available or not.
6
7dnl Usage: EFL_CHECK_THREADS(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
8dnl Call AC_SUBST(EFL_PTHREAD_CFLAGS)
9dnl Call AC_SUBST(EFL_PTHREAD_LIBS)
10dnl Defines EFL_HAVE_THREADS
11
12AC_DEFUN([EFL_CHECK_THREADS],
13[
14
15dnl Generic thread detection
16
17EFL_PTHREAD_CFLAGS="-D_REENTRANT"
18EFL_PTHREAD_LIBS=""
19
20_efl_have_posix_threads="no"
21
22dnl Use generic infrastructure for pthread detection (What a hell of a mess !)
23gl_LOCK
24
25AC_DEFINE([EFL_HAVE_THREADS], [1], [Define to mention that POSIX or Win32 threads are supported])
26
27_efl_have_posix_threads="${gl_use_threads}"
28
29dnl System specific CFLAGS
30if test "x${_efl_have_posix_threads}" = "xyes"; then
31 case "$host_os" in
32 osf*) EFL_PTHREAD_CFLAGS="-D_REENTRANT" ;;
33 aix* | freebsd*) EFL_PTHREAD_CFLAGS="-D_THREAD_SAFE" ;;
34 solaris*) EFL_PTHREAD_CFLAGS="-D_REENTRANT" ;;
35 esac
36fi
37
38dnl check if the compiler supports POSIX threads
39if test "x${_efl_have_posix_threads}" = "xyes" ; then
40
41 SAVE_LIBS=${LIBS}
42 LIBS="${LIBS} ${LIBMULTITHREAD}"
43 AC_LINK_IFELSE(
44 [AC_LANG_PROGRAM([[
45#include <pthread.h>
46 ]],
47 [[
48pthread_barrier_t barrier;
49pthread_barrier_init(&barrier, NULL, 1);
50 ]])],
51 [efl_have_pthread_barrier="yes"],
52 [efl_have_pthread_barrier="no"])
53 AC_LINK_IFELSE(
54 [AC_LANG_PROGRAM([[
55#include <stdlib.h>
56#include <pthread.h>
57#include <sched.h>
58#ifndef __linux__
59#include <pthread_np.h>
60#endif
61 ]],
62 [[
63pthread_attr_setaffinity_np(NULL, 0, NULL);
64 ]])],
65 [efl_have_setaffinity="yes"],
66 [efl_have_setaffinity="no"])
67 AC_LINK_IFELSE(
68 [AC_LANG_PROGRAM([[
69#define _GNU_SOURCE
70#include <stdlib.h>
71#include <pthread.h>
72#ifndef __linux__
73#include <pthread_np.h>
74#endif
75 ]],
76 [[
77#ifndef __linux__
78pthread_set_name_np(NULL, NULL);
79#else
80pthread_setname_np(NULL, NULL);
81#endif
82 ]])],
83 [efl_have_setname="yes"],
84 [efl_have_setname="no"])
85 LIBS=${SAVE_LIBS}
86fi
87
88AC_MSG_CHECKING([which threads API is used])
89if test "x${_efl_have_posix_threads}" = "xyes" ; then
90 efl_have_threads="POSIX"
91fi
92AC_MSG_RESULT([${efl_have_threads}])
93
94EFL_PTHREAD_LIBS="${LTLIBMULTITHREAD}"
95
96AC_SUBST(EFL_PTHREAD_CFLAGS)
97AC_SUBST(EFL_PTHREAD_LIBS)
98
99dnl check if the compiler supports pthreads spinlock
100
101efl_have_posix_threads_spinlock="no"
102
103if test "x${_efl_have_posix_threads}" = "xyes" ; then
104 SAVE_LIBS=${LIBS}
105 LIBS="${LIBS} ${LIBMULTITHREAD}"
106 AC_LINK_IFELSE(
107 [AC_LANG_PROGRAM([[
108#include <pthread.h>
109#include <sched.h>
110 ]],
111 [[
112pthread_spinlock_t lock;
113int res;
114res = pthread_spin_init(&lock, PTHREAD_PROCESS_PRIVATE);
115sched_yield();
116 ]])],
117 [efl_have_posix_threads_spinlock="yes"],
118 [efl_have_posix_threads_spinlock="no"])
119 LIBS=${SAVE_LIBS}
120
121fi
122
123AC_MSG_CHECKING([whether to build POSIX threads spinlock code])
124AC_MSG_RESULT([${efl_have_posix_threads_spinlock}])
125
126if test "x${efl_have_posix_threads_spinlock}" = "xyes" ; then
127 AC_DEFINE([EFL_HAVE_POSIX_THREADS_SPINLOCK], [1], [Define to mention that POSIX threads spinlocks are supported])
128fi
129
130
131dnl checks if the compiler supports OSX spinlock
132
133efl_have_osx_spinlock="no"
134
135if test "x${_efl_have_posix_threads}" = "xyes" ; then
136 AC_LINK_IFELSE(
137 [AC_LANG_PROGRAM([[
138#include <libkern/OSAtomic.h>
139 ]],
140 [[
141OSSpinLock spin_lock = 0;
142OSSpinLockTry(&spin_lock);
143 ]])],
144 [efl_have_osx_spinlock="yes"],
145 [efl_have_osx_spinlock="no"])
146fi
147
148AC_MSG_CHECKING([whether to build OSX spinlock code])
149AC_MSG_RESULT([${efl_have_osx_spinlock}])
150
151if test "x${efl_have_osx_spinlock}" = "xyes" ; then
152 AC_DEFINE([EFL_HAVE_OSX_SPINLOCK], [1], [Define to mention that OSX spinlocks are supported])
153fi
154
155
156
157AS_IF([test "x$_efl_have_posix_threads" = "xyes"],
158 [$1],
159 [m4_if([$2], [$2], [AC_MSG_ERROR([Threads are required.])])])
160
161
162])
163