summaryrefslogtreecommitdiff
path: root/legacy/eina/m4/common/efl_threads.m4
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2012-05-29 21:57:48 +0000
committerVincent Torri <vincent.torri@gmail.com>2012-05-29 21:57:48 +0000
commit4889dc71d2b6136a350b1cdacb922105665e77e0 (patch)
treecb6ef1a6c33b93858d512232ee1ff0d8a1537408 /legacy/eina/m4/common/efl_threads.m4
parentef25a41a76497796b680adc08ad479402ae8bd9b (diff)
Eina: remove threads options from configure
remove --disable-posix-threads and --disable-win32-threads from configure options, and detect automatically the threading support. SVN revision: 71517
Diffstat (limited to '')
-rw-r--r--legacy/eina/m4/common/efl_threads.m4125
1 files changed, 30 insertions, 95 deletions
diff --git a/legacy/eina/m4/common/efl_threads.m4 b/legacy/eina/m4/common/efl_threads.m4
index a761d51..9deb1d6 100644
--- a/legacy/eina/m4/common/efl_threads.m4
+++ b/legacy/eina/m4/common/efl_threads.m4
@@ -12,92 +12,35 @@ 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 configure option 15EFL_PTHREAD_CFLAGS=""
16 16EFL_PTHREAD_LIBS=""
17AC_ARG_ENABLE([posix-threads],
18 [AC_HELP_STRING([--disable-posix-threads], [enable POSIX threads code @<:@default=auto@:>@])],
19 [
20 if test "x${enableval}" = "xyes" ; then
21 _efl_enable_posix_threads="yes"
22 else
23 _efl_enable_posix_threads="no"
24 fi
25 ],
26 [_efl_enable_posix_threads="auto"])
27
28AC_MSG_CHECKING([whether to build POSIX threads code])
29AC_MSG_RESULT([${_efl_enable_posix_threads}])
30
31AC_ARG_ENABLE([win32-threads],
32 [AC_HELP_STRING([--disable-win32-threads], [enable Win32 threads code @<:@default=no@:>@])],
33 [
34 if test "x${enableval}" = "xyes" ; then
35 _efl_enable_win32_threads="yes"
36 else
37 _efl_enable_win32_threads="no"
38 fi
39 ],
40 [_efl_enable_win32_threads="no"])
41
42AC_MSG_CHECKING([whether to build Windows threads code])
43AC_MSG_RESULT([${_efl_enable_win32_threads}])
44
45dnl
46dnl * no + no
47dnl * yes + no : win32: error, other : pthread
48dnl * yes + yes : win32 : wthread, other : pthread
49dnl * no + yes : win32 : wthread, other : error
50
51if test "x${_efl_enable_posix_threads}" = "xyes" && test "x${_efl_enable_win32_threads}" = "xyes" ; then
52 case "$host_os" in
53 mingw*)
54 _efl_enable_posix_threads=no
55 ;;
56 *)
57 _efl_enable_win32_threads=no
58 ;;
59 esac
60fi
61
62if test "x${_efl_enable_win32_threads}" = "xyes" ; then
63 case "$host_os" in
64 mingw*)
65 ;;
66 *)
67 AC_MSG_ERROR([Win32 threads support requested but non Windows system found.])
68 ;;
69 esac
70fi
71
72if test "x${_efl_enable_posix_threads}" = "xyes" ; then
73 case "$host_os" in
74 mingw*)
75 AC_MSG_ERROR([POSIX threads support requested but Windows system found.])
76 ;;
77 *)
78 ;;
79 esac
80fi
81 17
82dnl check if the compiler supports POSIX threads 18_efl_enable_posix_threads="no"
19_efl_have_posix_threads="no"
20_efl_have_win32_threads="no"
83 21
84case "$host_os" in 22case "$host_os" in
85 mingw*) 23 mingw*)
24 _efl_have_win32_threads="yes"
25 AC_DEFINE([EFL_HAVE_WIN32_THREADS], [1], [Define to mention that Win32 threads are supported])
26 AC_DEFINE([EFL_HAVE_THREADS], [1], [Define to mention that POSIX or Win32 threads are supported])
86 ;; 27 ;;
87 solaris*) 28 solaris*)
29 _efl_enable_posix_threads="yes"
88 _efl_threads_cflags="-mt" 30 _efl_threads_cflags="-mt"
89 _efl_threads_libs="-mt" 31 _efl_threads_libs="-mt"
90 ;; 32 ;;
91 *) 33 *)
34 _efl_enable_posix_threads="yes"
92 _efl_threads_cflags="-pthread" 35 _efl_threads_cflags="-pthread"
93 _efl_threads_libs="-pthread" 36 _efl_threads_libs="-pthread"
94 ;; 37 ;;
95esac 38esac
96 39
97_efl_have_posix_threads="no" 40dnl check if the compiler supports POSIX threads
98_efl_have_win32_threads="no"
99 41
100if test "x${_efl_enable_posix_threads}" = "xyes" || test "x${_efl_enable_posix_threads}" = "xauto" ; then 42
43if test "x${_efl_enable_posix_threads}" = "xyes" ; then
101 44
102 SAVE_CFLAGS=${CFLAGS} 45 SAVE_CFLAGS=${CFLAGS}
103 CFLAGS="${CFLAGS} ${_efl_threads_cflags}" 46 CFLAGS="${CFLAGS} ${_efl_threads_cflags}"
@@ -111,25 +54,30 @@ if test "x${_efl_enable_posix_threads}" = "xyes" || test "x${_efl_enable_posix_t
111pthread_t id; 54pthread_t id;
112id = pthread_self(); 55id = pthread_self();
113 ]])], 56 ]])],
114 [_efl_have_posix_threads="yes"], 57 [
58 _efl_have_posix_threads="yes"
59 AC_DEFINE([EFL_HAVE_POSIX_THREADS], [1], [Define to mention that POSIX threads are supported])
60 AC_DEFINE([EFL_HAVE_THREADS], [1], [Define to mention that POSIX or Win32 threads are supported])
61 EFL_PTHREAD_CFLAGS=${_efl_threads_cflags}
62 EFL_PTHREAD_LIBS=${_efl_threads_libs}
63 ],
115 [_efl_have_posix_threads="no"]) 64 [_efl_have_posix_threads="no"])
116 CFLAGS=${SAVE_CFLAGS} 65 CFLAGS=${SAVE_CFLAGS}
117 LIBS=${SAVE_LIBS} 66 LIBS=${SAVE_LIBS}
118 67
119fi 68fi
120 69
121AC_MSG_CHECKING([whether system support POSIX threads]) 70AC_MSG_CHECKING([which threads API is used])
122AC_MSG_RESULT([${_efl_have_posix_threads}])
123if test "$x{_efl_enable_posix_threads}" = "xyes" && test "x${_efl_have_posix_threads}" = "xno"; then
124 AC_MSG_ERROR([POSIX threads support requested but not found.])
125fi
126
127EFL_PTHREAD_CFLAGS=""
128EFL_PTHREAD_LIBS=""
129if test "x${_efl_have_posix_threads}" = "xyes" ; then 71if test "x${_efl_have_posix_threads}" = "xyes" ; then
130 EFL_PTHREAD_CFLAGS=${_efl_threads_cflags} 72 have_threads="POSIX"
131 EFL_PTHREAD_LIBS=${_efl_threads_libs} 73else
74 if test "x${_efl_have_win32_threads}" = "xyes" ; then
75 have_threads="Windows"
76 else
77 have_threads="none"
78 fi
132fi 79fi
80AC_MSG_RESULT([${have_threads}])
133 81
134AC_SUBST(EFL_PTHREAD_CFLAGS) 82AC_SUBST(EFL_PTHREAD_CFLAGS)
135AC_SUBST(EFL_PTHREAD_LIBS) 83AC_SUBST(EFL_PTHREAD_LIBS)
@@ -153,24 +101,11 @@ AC_ARG_ENABLE([debug-threads],
153 [_efl_enable_debug_threads="${enableval}"]) 101 [_efl_enable_debug_threads="${enableval}"])
154 102
155have_debug_threads="no" 103have_debug_threads="no"
156if test "x${_efl_have_posix_threads}" = "xyes" -a "x${_efl_enable_debug_threads}" = "xyes"; then 104if test "x${_efl_have_posix_threads}" = "xyes" && test "x${_efl_enable_debug_threads}" = "xyes"; then
157 have_debug_threads="yes" 105 have_debug_threads="yes"
158 AC_DEFINE([EFL_DEBUG_THREADS], [1], [Assert when forgot to call eina_threads_init]) 106 AC_DEFINE([EFL_DEBUG_THREADS], [1], [Assert when forgot to call eina_threads_init])
159fi 107fi
160 108
161if test "x${_efl_have_posix_threads}" = "xyes" ; then
162 AC_DEFINE([EFL_HAVE_POSIX_THREADS], [1], [Define to mention that POSIX threads are supported])
163fi
164
165if test "x${_efl_enable_win32_threads}" = "xyes" ; then
166 _efl_have_win32_threads="yes"
167 AC_DEFINE([EFL_HAVE_WIN32_THREADS], [1], [Define to mention that Win32 threads are supported])
168fi
169
170if test "x${_efl_have_posix_threads}" = "xyes" || test "x${_efl_have_win32_threads}" = "xyes" ; then
171 AC_DEFINE([EFL_HAVE_THREADS], [1], [Define to mention that POSIX or Win32 threads are supported])
172fi
173
174AS_IF([test "x$_efl_have_posix_threads" = "xyes" || test "x$_efl_have_win32_threads" = "xyes"], [$1], [$2]) 109AS_IF([test "x$_efl_have_posix_threads" = "xyes" || test "x$_efl_have_win32_threads" = "xyes"], [$1], [$2])
175]) 110])
176 111