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