aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/m4/efl_cpu.m4
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libraries/eina/m4/efl_cpu.m4341
1 files changed, 341 insertions, 0 deletions
diff --git a/libraries/eina/m4/efl_cpu.m4 b/libraries/eina/m4/efl_cpu.m4
new file mode 100644
index 0000000..8fa6cd7
--- /dev/null
+++ b/libraries/eina/m4/efl_cpu.m4
@@ -0,0 +1,341 @@
1dnl Copyright (C) 2008 Vincent Torri <vtorri at univ-evry dot fr>
2dnl That code is public domain and can be freely used or copied.
3
4dnl Macro that check if several ASM instruction sets are available or not.
5
6dnl Usage: EFL_CHECK_CPU_MMX([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
7dnl Add -mmmx to EFL_SIMD_FLAGS if the compiler supports it and call AC_SUBST(EFL_SIMD_FLAGS)
8dnl Define EFL_HAVE_MMX
9
10AC_DEFUN([EFL_CHECK_CPU_MMX],
11[
12dnl configure option
13
14AC_ARG_ENABLE([cpu-mmx],
15 [AC_HELP_STRING([--disable-cpu-mmx], [disable mmx code @<:@default=enabled@:>@])],
16 [
17 if test "x${enableval}" = "xyes" ; then
18 _efl_enable_cpu_mmx="yes"
19 else
20 _efl_enable_cpu_mmx="no"
21 fi
22 ],
23 [_efl_enable_cpu_mmx="yes"])
24
25AC_MSG_CHECKING([whether to build mmx code])
26AC_MSG_RESULT([${_efl_enable_cpu_mmx}])
27
28dnl check if the CPU is supporting MMX instruction sets
29
30_efl_build_cpu_mmx="no"
31if test "x${_efl_enable_cpu_mmx}" = "xyes" ; then
32 case $host_cpu in
33 i*86 | x86_64 | amd64)
34 _efl_build_cpu_mmx="yes"
35 ;;
36 esac
37fi
38
39AC_MSG_CHECKING([whether mmx instructions set is available])
40AC_MSG_RESULT([${_efl_build_cpu_mmx}])
41
42dnl check if the compiler supports -mmmx
43
44if test "x${_efl_build_cpu_mmx}" = "xyes" ; then
45 SAVE_CFLAGS=${CFLAGS}
46 CFLAGS="-mmmx"
47 AC_LANG_PUSH([C])
48
49 AC_COMPILE_IFELSE(
50 [AC_LANG_PROGRAM([[]],
51 [[]])],
52 [
53 have_linker_option="yes"
54 EFL_SIMD_FLAGS="${EFL_SIMD_FLAGS} -mmmx"],
55 [have_linker_option="no"])
56
57 AC_LANG_POP([C])
58 CFLAGS=${SAVE_CFLAGS}
59
60 AC_MSG_CHECKING([whether mmx linker option is supported])
61 AC_MSG_RESULT([${have_linker_option}])
62fi
63
64AC_SUBST(EFL_SIMD_FLAGS)
65
66if test "x${_efl_build_cpu_mmx}" = "xyes" ; then
67 AC_DEFINE([EFL_HAVE_MMX], [1], [Define to mention that MMX is supported])
68fi
69
70AS_IF([test "x$_efl_build_cpu_mmx" = "xyes"], [$1], [$2])
71])
72
73dnl Usage: EFL_CHECK_CPU_SSE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
74dnl Add -msse to EFL_SIMD_FLAGS if the compiler supports it and call AC_SUBST(EFL_SIMD_FLAGS)
75dnl Define EFL_HAVE_SSE
76
77AC_DEFUN([EFL_CHECK_CPU_SSE],
78[
79dnl configure option
80
81AC_ARG_ENABLE([cpu-sse],
82 [AC_HELP_STRING([--disable-cpu-sse], [disable sse code @<:@default=enabled@:>@])],
83 [
84 if test "x${enableval}" = "xyes" ; then
85 _efl_enable_cpu_sse="yes"
86 else
87 _efl_enable_cpu_sse="no"
88 fi
89 ],
90 [_efl_enable_cpu_sse="yes"])
91
92AC_MSG_CHECKING([whether to build sse code])
93AC_MSG_RESULT([${_efl_enable_cpu_sse}])
94
95dnl check if the CPU is supporting SSE instruction sets
96
97_efl_build_cpu_sse="no"
98if test "x${_efl_enable_cpu_sse}" = "xyes" ; then
99 case $host_cpu in
100 i*86 | x86_64 | amd64)
101 _efl_build_cpu_sse="yes"
102 ;;
103 esac
104fi
105
106AC_MSG_CHECKING([whether sse instructions set is available])
107AC_MSG_RESULT([${_efl_build_cpu_sse}])
108
109dnl check if the compiler supports -msse
110
111if test "x${_efl_build_cpu_sse}" = "xyes" ; then
112 SAVE_CFLAGS=${CFLAGS}
113 CFLAGS="-msse"
114 AC_LANG_PUSH([C])
115
116 AC_COMPILE_IFELSE(
117 [AC_LANG_PROGRAM([[]],
118 [[]])
119 ],
120 [
121 have_linker_option="yes"
122 EFL_SIMD_FLAGS="${EFL_SIMD_FLAGS} -msse"
123 ],
124 [have_linker_option="no"])
125
126 AC_LANG_POP([C])
127 CFLAGS=${SAVE_CFLAGS}
128
129 AC_MSG_CHECKING([whether sse linker option is supported])
130 AC_MSG_RESULT([${have_linker_option}])
131fi
132
133AC_SUBST(EFL_SIMD_FLAGS)
134
135if test "x${_efl_build_cpu_sse}" = "xyes" ; then
136 AC_DEFINE([EFL_HAVE_SSE], [1], [Define to mention that SSE is supported])
137fi
138
139AS_IF([test "x$_efl_build_cpu_sse" = "xyes"], [$1], [$2])
140])
141
142dnl Usage: EFL_CHECK_CPU_SSE2([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
143dnl Add -msse2 to EFL_SIMD_FLAGS if the compiler supports it and call AC_SUBST(EFL_SIMD_FLAGS)
144dnl Define EFL_HAVE_SSE2
145
146AC_DEFUN([EFL_CHECK_CPU_SSE2],
147[
148
149dnl configure option
150
151AC_ARG_ENABLE([cpu-sse2],
152 [AC_HELP_STRING([--disable-cpu-sse2], [disable sse2 code @<:@default=enabled@:>@])],
153 [
154 if test "x${enableval}" = "xyes" ; then
155 _efl_enable_cpu_sse2="yes"
156 else
157 _efl_enable_cpu_sse2="no"
158 fi
159 ],
160 [_efl_enable_cpu_sse2="yes"])
161
162AC_MSG_CHECKING([whether to build sse2 code])
163AC_MSG_RESULT([${_efl_enable_cpu_sse2}])
164
165dnl check if the CPU is supporting SSE2 instruction sets
166
167_efl_build_cpu_sse2="no"
168if test "x${_efl_enable_cpu_sse2}" = "xyes" ; then
169 case $host_cpu in
170 i*86 | x86_64 | amd64)
171 _efl_build_cpu_sse2="yes"
172 ;;
173 esac
174fi
175
176AC_MSG_CHECKING([whether sse2 instructions set is available])
177AC_MSG_RESULT([${_efl_build_cpu_sse2}])
178
179dnl check if the compiler supports -msse2
180
181if test "x${_efl_build_cpu_sse2}" = "xyes" ; then
182 SAVE_CFLAGS=${CFLAGS}
183 CFLAGS="-msse2"
184 AC_LANG_PUSH([C])
185
186 AC_COMPILE_IFELSE(
187 [AC_LANG_PROGRAM([[]],
188 [[]])
189 ],
190 [
191 have_linker_option="yes"
192 EFL_SIMD_FLAGS="${EFL_SIMD_FLAGS} -msse2"
193 ],
194 [have_linker_option="no"])
195
196 AC_LANG_POP([C])
197 CFLAGS=${SAVE_CFLAGS}
198
199 AC_MSG_CHECKING([whether sse2 linker option is supported])
200 AC_MSG_RESULT([${have_linker_option}])
201fi
202
203AC_SUBST(EFL_SIMD_FLAGS)
204
205if test "x${_efl_build_cpu_sse2}" = "xyes" ; then
206 AC_DEFINE([EFL_HAVE_SSE2], [1], [Define to mention that SSE2 is supported])
207fi
208
209AS_IF([test "x$_efl_build_cpu_sse2" = "xyes"], [$1], [$2])
210])
211
212dnl Usage: EFL_CHECK_CPU_ALTIVEC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
213dnl Add -faltivec or -maltivec to EFL_SIMD_FLAGS if the compiler supports it and
214dnl call AC_SUBST(EFL_SIMD_FLAGS)
215dnl Define EFL_HAVE_ALTIVEC
216
217AC_DEFUN([EFL_CHECK_CPU_ALTIVEC],
218[
219
220dnl configure option
221
222AC_ARG_ENABLE([cpu-altivec],
223 [AC_HELP_STRING([--disable-cpu-altivec], [disable altivec code @<:@default=enabled@:>@])],
224 [
225 if test "x${enableval}" = "xyes" ; then
226 _efl_enable_cpu_altivec="yes"
227 else
228 _efl_enable_cpu_altivec="no"
229 fi
230 ],
231 [_efl_enable_cpu_altivec="yes"]
232)
233AC_MSG_CHECKING([whether to build altivec code])
234AC_MSG_RESULT([${_efl_enable_cpu_altivec}])
235
236dnl check if the CPU is supporting ALTIVEC instruction sets
237
238_efl_build_cpu_altivec="no"
239if test "x${_efl_enable_cpu_altivec}" = "xyes" ; then
240 case $host_cpu in
241 *power* | *ppc*)
242 _efl_build_cpu_altivec="yes"
243 ;;
244 esac
245fi
246
247AC_MSG_CHECKING([whether altivec instructions set is available])
248AC_MSG_RESULT([${_efl_build_cpu_altivec}])
249
250dnl check if the compiler supports -faltivec or -maltivec and
251dnl if altivec.h is available.
252
253_efl_have_faltivec="no"
254if test "x${_efl_build_cpu_altivec}" = "xyes" ; then
255 SAVE_CFLAGS=${CFLAGS}
256 CFLAGS="-faltivec"
257 AC_LANG_PUSH([C])
258
259 AC_COMPILE_IFELSE(
260 [AC_LANG_PROGRAM([[
261#include <altivec.h>
262 ]],
263 [[]])],
264 [_efl_have_faltivec="yes"
265 _efl_altivec_flag="-faltivec"],
266 [_efl_have_faltivec="no"])
267
268 if test "x${_efl_have_faltivec}" = "xno" ; then
269 CFLAGS="-maltivec"
270
271 AC_COMPILE_IFELSE(
272 [AC_LANG_PROGRAM([[
273#include <altivec.h>
274 ]],
275 [[]])],
276 [_efl_have_faltivec="yes"
277 _efl_altivec_flag="-maltivec"],
278 [_efl_have_faltivec="no"])
279 fi
280
281 AC_LANG_POP([C])
282 CFLAGS=${SAVE_CFLAGS}
283
284 AC_MSG_CHECKING([whether altivec linker option is supported])
285 AC_MSG_RESULT([${_efl_have_faltivec}])
286fi
287
288EFL_SIMD_FLAGS="${EFL_SIMD_FLAGS} ${_efl_altivec_flag}"
289AC_SUBST(EFL_SIMD_FLAGS)
290
291if test "x${_efl_have_faltivec}" = "xyes" ; then
292 AC_DEFINE([EFL_HAVE_ALTIVEC], [1], [Define to mention that ALTIVEC is supported])
293fi
294
295AS_IF([test "x$_efl_have_faltivec" = "xyes"], [$1], [$2])
296])
297
298dnl Usage: EFL_CHECK_CPU_NEON([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
299dnl Add -mneon to EFL_SIMD_FLAGS if the compiler supports it and call AC_SUBST(EFL_SIMD_FLAGS)
300dnl Define EFL_HAVE_NEON
301
302AC_DEFUN([EFL_CHECK_CPU_NEON],
303[
304dnl configure option
305
306AC_ARG_ENABLE([cpu-neon],
307 [AC_HELP_STRING([--disable-cpu-neon], [disable neon code @<:@default=enabled@:>@])],
308 [
309 if test "x${enableval}" = "xyes" ; then
310 _efl_enable_cpu_neon="yes"
311 else
312 _efl_enable_cpu_neon="no"
313 fi
314 ],
315 [_efl_enable_cpu_neon="yes"])
316
317AC_MSG_CHECKING([whether to build neon code])
318AC_MSG_RESULT([${_efl_enable_cpu_neon}])
319
320dnl check if the CPU is supporting NEON instruction sets
321
322_efl_build_cpu_neon="no"
323if test "x${_efl_enable_cpu_neon}" = "xyes" ; then
324 case $host_cpu in
325 armv7*)
326 _efl_build_cpu_neon="yes"
327 ;;
328 esac
329fi
330
331AC_MSG_CHECKING([whether neon instructions set is available])
332AC_MSG_RESULT([${_efl_build_cpu_neon}])
333
334if test "x${_efl_build_cpu_neon}" = "xyes" ; then
335 AC_DEFINE([EFL_HAVE_NEON], [1], [Define to mention that NEON is supported])
336fi
337
338AS_IF([test "x$_efl_build_cpu_neon" = "xyes"], [$1], [$2])
339])
340
341dnl End of efl_cpu.m4