cannam@154
|
1 dnl Process this file with autoconf to produce a configure script. -*-m4-*-
|
cannam@154
|
2
|
cannam@154
|
3 dnl The package_version file will be automatically synced to the git revision
|
cannam@154
|
4 dnl by the update_version script when configured in the repository, but will
|
cannam@154
|
5 dnl remain constant in tarball releases unless it is manually edited.
|
cannam@154
|
6 m4_define([CURRENT_VERSION],
|
cannam@154
|
7 m4_esyscmd([ ./update_version 2>/dev/null || true
|
cannam@154
|
8 if test -e package_version; then
|
cannam@154
|
9 . ./package_version
|
cannam@154
|
10 printf "$PACKAGE_VERSION"
|
cannam@154
|
11 else
|
cannam@154
|
12 printf "unknown"
|
cannam@154
|
13 fi ]))
|
cannam@154
|
14
|
cannam@154
|
15 AC_INIT([opus],[CURRENT_VERSION],[opus@xiph.org])
|
cannam@154
|
16
|
cannam@154
|
17 AC_CONFIG_SRCDIR(src/opus_encoder.c)
|
cannam@154
|
18 AC_CONFIG_MACRO_DIR([m4])
|
cannam@154
|
19
|
cannam@154
|
20 dnl enable silent rules on automake 1.11 and later
|
cannam@154
|
21 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
cannam@154
|
22
|
cannam@154
|
23 # For libtool.
|
cannam@154
|
24 dnl Please update these for releases.
|
cannam@154
|
25 OPUS_LT_CURRENT=7
|
cannam@154
|
26 OPUS_LT_REVISION=0
|
cannam@154
|
27 OPUS_LT_AGE=7
|
cannam@154
|
28
|
cannam@154
|
29 AC_SUBST(OPUS_LT_CURRENT)
|
cannam@154
|
30 AC_SUBST(OPUS_LT_REVISION)
|
cannam@154
|
31 AC_SUBST(OPUS_LT_AGE)
|
cannam@154
|
32
|
cannam@154
|
33 AM_INIT_AUTOMAKE([no-define])
|
cannam@154
|
34 AM_MAINTAINER_MODE([enable])
|
cannam@154
|
35
|
cannam@154
|
36 AC_CANONICAL_HOST
|
cannam@154
|
37 AC_MINGW32
|
cannam@154
|
38 AM_PROG_LIBTOOL
|
cannam@154
|
39 AM_PROG_CC_C_O
|
cannam@154
|
40
|
cannam@154
|
41 AC_PROG_CC_C99
|
cannam@154
|
42 AC_C_CONST
|
cannam@154
|
43 AC_C_INLINE
|
cannam@154
|
44
|
cannam@154
|
45 AM_PROG_AS
|
cannam@154
|
46
|
cannam@154
|
47 AC_DEFINE([OPUS_BUILD], [], [This is a build of OPUS])
|
cannam@154
|
48
|
cannam@154
|
49 #Use a hacked up version of autoconf's AC_C_RESTRICT because it's not
|
cannam@154
|
50 #strong enough a test to detect old buggy versions of GCC (e.g. 2.95.3)
|
cannam@154
|
51 #Note: Both this and the test for variable-size arrays below are also
|
cannam@154
|
52 # done by AC_PROG_CC_C99, but not thoroughly enough apparently.
|
cannam@154
|
53 AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict,
|
cannam@154
|
54 [ac_cv_c_restrict=no
|
cannam@154
|
55 # The order here caters to the fact that C++ does not require restrict.
|
cannam@154
|
56 for ac_kw in __restrict __restrict__ _Restrict restrict; do
|
cannam@154
|
57 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
cannam@154
|
58 [[typedef int * int_ptr;
|
cannam@154
|
59 int foo (int_ptr $ac_kw ip, int * $ac_kw baz[]) {
|
cannam@154
|
60 return ip[0];
|
cannam@154
|
61 }]],
|
cannam@154
|
62 [[int s[1];
|
cannam@154
|
63 int * $ac_kw t = s;
|
cannam@154
|
64 t[0] = 0;
|
cannam@154
|
65 return foo(t, (void *)0)]])],
|
cannam@154
|
66 [ac_cv_c_restrict=$ac_kw])
|
cannam@154
|
67 test "$ac_cv_c_restrict" != no && break
|
cannam@154
|
68 done
|
cannam@154
|
69 ])
|
cannam@154
|
70
|
cannam@154
|
71 AH_VERBATIM([restrict],
|
cannam@154
|
72 [/* Define to the equivalent of the C99 'restrict' keyword, or to
|
cannam@154
|
73 nothing if this is not supported. Do not define if restrict is
|
cannam@154
|
74 supported directly. */
|
cannam@154
|
75 #undef restrict
|
cannam@154
|
76 /* Work around a bug in Sun C++: it does not support _Restrict or
|
cannam@154
|
77 __restrict__, even though the corresponding Sun C compiler ends up with
|
cannam@154
|
78 "#define restrict _Restrict" or "#define restrict __restrict__" in the
|
cannam@154
|
79 previous line. Perhaps some future version of Sun C++ will work with
|
cannam@154
|
80 restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
|
cannam@154
|
81 #if defined __SUNPRO_CC && !defined __RESTRICT
|
cannam@154
|
82 # define _Restrict
|
cannam@154
|
83 # define __restrict__
|
cannam@154
|
84 #endif])
|
cannam@154
|
85
|
cannam@154
|
86 case $ac_cv_c_restrict in
|
cannam@154
|
87 restrict) ;;
|
cannam@154
|
88 no) AC_DEFINE([restrict], []) ;;
|
cannam@154
|
89 *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
|
cannam@154
|
90 esac
|
cannam@154
|
91
|
cannam@154
|
92 AC_MSG_CHECKING(for C99 variable-size arrays)
|
cannam@154
|
93 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
|
cannam@154
|
94 [[static int x; char a[++x]; a[sizeof a - 1] = 0; int N; return a[0];]])],
|
cannam@154
|
95 [ has_var_arrays=yes
|
cannam@154
|
96 use_alloca="no (using var arrays)"
|
cannam@154
|
97 AC_DEFINE([VAR_ARRAYS], [1], [Use C99 variable-size arrays])
|
cannam@154
|
98 ],[
|
cannam@154
|
99 has_var_arrays=no
|
cannam@154
|
100 ])
|
cannam@154
|
101 AC_MSG_RESULT([$has_var_arrays])
|
cannam@154
|
102
|
cannam@154
|
103 AS_IF([test "$has_var_arrays" = "no"],
|
cannam@154
|
104 [
|
cannam@154
|
105 AC_CHECK_HEADERS([alloca.h])
|
cannam@154
|
106 AC_MSG_CHECKING(for alloca)
|
cannam@154
|
107 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <alloca.h>]],
|
cannam@154
|
108 [[int foo=10; int *array = alloca(foo);]])],
|
cannam@154
|
109 [ use_alloca=yes;
|
cannam@154
|
110 AC_DEFINE([USE_ALLOCA], [], [Make use of alloca])
|
cannam@154
|
111 ],[
|
cannam@154
|
112 use_alloca=no
|
cannam@154
|
113 ])
|
cannam@154
|
114 AC_MSG_RESULT([$use_alloca])
|
cannam@154
|
115 ])
|
cannam@154
|
116
|
cannam@154
|
117 LT_LIB_M
|
cannam@154
|
118
|
cannam@154
|
119 AC_ARG_ENABLE([fixed-point],
|
cannam@154
|
120 [AS_HELP_STRING([--enable-fixed-point],
|
cannam@154
|
121 [compile without floating point (for machines without a fast enough FPU)])],,
|
cannam@154
|
122 [enable_fixed_point=no])
|
cannam@154
|
123
|
cannam@154
|
124 AS_IF([test "$enable_fixed_point" = "yes"],[
|
cannam@154
|
125 enable_float="no"
|
cannam@154
|
126 AC_DEFINE([FIXED_POINT], [1], [Compile as fixed-point (for machines without a fast enough FPU)])
|
cannam@154
|
127 PC_BUILD="fixed-point"
|
cannam@154
|
128 ],[
|
cannam@154
|
129 enable_float="yes";
|
cannam@154
|
130 PC_BUILD="floating-point"
|
cannam@154
|
131 ])
|
cannam@154
|
132
|
cannam@154
|
133 AM_CONDITIONAL([FIXED_POINT], [test "$enable_fixed_point" = "yes"])
|
cannam@154
|
134
|
cannam@154
|
135 AC_ARG_ENABLE([fixed-point-debug],
|
cannam@154
|
136 [AS_HELP_STRING([--enable-fixed-point-debug], [debug fixed-point implementation])],,
|
cannam@154
|
137 [enable_fixed_point_debug=no])
|
cannam@154
|
138
|
cannam@154
|
139 AS_IF([test "$enable_fixed_point_debug" = "yes"],[
|
cannam@154
|
140 AC_DEFINE([FIXED_DEBUG], [1], [Debug fixed-point implementation])
|
cannam@154
|
141 ])
|
cannam@154
|
142
|
cannam@154
|
143 AC_ARG_ENABLE([float_api],
|
cannam@154
|
144 [AS_HELP_STRING([--disable-float-api],
|
cannam@154
|
145 [compile without the floating point API (for machines with no float library)])],,
|
cannam@154
|
146 [enable_float_api=yes])
|
cannam@154
|
147
|
cannam@154
|
148 AM_CONDITIONAL([DISABLE_FLOAT_API], [test "$enable_float_api" = "no"])
|
cannam@154
|
149
|
cannam@154
|
150 AS_IF([test "$enable_float_api" = "no"],[
|
cannam@154
|
151 AC_DEFINE([DISABLE_FLOAT_API], [1], [Do not build the float API])
|
cannam@154
|
152 ])
|
cannam@154
|
153
|
cannam@154
|
154 AC_ARG_ENABLE([custom-modes],
|
cannam@154
|
155 [AS_HELP_STRING([--enable-custom-modes], [enable non-Opus modes, e.g. 44.1 kHz & 2^n frames])],,
|
cannam@154
|
156 [enable_custom_modes=no])
|
cannam@154
|
157
|
cannam@154
|
158 AS_IF([test "$enable_custom_modes" = "yes"],[
|
cannam@154
|
159 AC_DEFINE([CUSTOM_MODES], [1], [Custom modes])
|
cannam@154
|
160 PC_BUILD="$PC_BUILD, custom modes"
|
cannam@154
|
161 ])
|
cannam@154
|
162
|
cannam@154
|
163 AM_CONDITIONAL([CUSTOM_MODES], [test "$enable_custom_modes" = "yes"])
|
cannam@154
|
164
|
cannam@154
|
165 has_float_approx=no
|
cannam@154
|
166 #case "$host_cpu" in
|
cannam@154
|
167 #i[[3456]]86 | x86_64 | powerpc64 | powerpc32 | ia64)
|
cannam@154
|
168 # has_float_approx=yes
|
cannam@154
|
169 # ;;
|
cannam@154
|
170 #esac
|
cannam@154
|
171
|
cannam@154
|
172 AC_ARG_ENABLE([float-approx],
|
cannam@154
|
173 [AS_HELP_STRING([--enable-float-approx], [enable fast approximations for floating point])],
|
cannam@154
|
174 [if test "$enable_float_approx" = "yes"; then
|
cannam@154
|
175 AC_WARN([Floating point approximations are not supported on all platforms.])
|
cannam@154
|
176 fi
|
cannam@154
|
177 ],
|
cannam@154
|
178 [enable_float_approx=$has_float_approx])
|
cannam@154
|
179
|
cannam@154
|
180 AS_IF([test "$enable_float_approx" = "yes"],[
|
cannam@154
|
181 AC_DEFINE([FLOAT_APPROX], [1], [Float approximations])
|
cannam@154
|
182 ])
|
cannam@154
|
183
|
cannam@154
|
184 AC_ARG_ENABLE([asm],
|
cannam@154
|
185 [AS_HELP_STRING([--disable-asm], [Disable assembly optimizations])],,
|
cannam@154
|
186 [enable_asm=yes])
|
cannam@154
|
187
|
cannam@154
|
188 AC_ARG_ENABLE([rtcd],
|
cannam@154
|
189 [AS_HELP_STRING([--disable-rtcd], [Disable run-time CPU capabilities detection])],,
|
cannam@154
|
190 [enable_rtcd=yes])
|
cannam@154
|
191
|
cannam@154
|
192 AC_ARG_ENABLE([intrinsics],
|
cannam@154
|
193 [AS_HELP_STRING([--disable-intrinsics], [Disable intrinsics optimizations])],,
|
cannam@154
|
194 [enable_intrinsics=yes])
|
cannam@154
|
195
|
cannam@154
|
196 rtcd_support=no
|
cannam@154
|
197 cpu_arm=no
|
cannam@154
|
198
|
cannam@154
|
199 AS_IF([test x"${enable_asm}" = x"yes"],[
|
cannam@154
|
200 inline_optimization="No inline ASM for your platform, please send patches"
|
cannam@154
|
201 case $host_cpu in
|
cannam@154
|
202 arm*)
|
cannam@154
|
203 dnl Currently we only have asm for fixed-point
|
cannam@154
|
204 AS_IF([test "$enable_float" != "yes"],[
|
cannam@154
|
205 cpu_arm=yes
|
cannam@154
|
206 AC_DEFINE([OPUS_ARM_ASM], [], [Make use of ARM asm optimization])
|
cannam@154
|
207 AS_GCC_INLINE_ASSEMBLY(
|
cannam@154
|
208 [inline_optimization="ARM"],
|
cannam@154
|
209 [inline_optimization="disabled"]
|
cannam@154
|
210 )
|
cannam@154
|
211 AS_ASM_ARM_EDSP([OPUS_ARM_INLINE_EDSP=1],[OPUS_ARM_INLINE_EDSP=0])
|
cannam@154
|
212 AS_ASM_ARM_MEDIA([OPUS_ARM_INLINE_MEDIA=1],
|
cannam@154
|
213 [OPUS_ARM_INLINE_MEDIA=0])
|
cannam@154
|
214 AS_ASM_ARM_NEON([OPUS_ARM_INLINE_NEON=1],[OPUS_ARM_INLINE_NEON=0])
|
cannam@154
|
215 AS_IF([test x"$inline_optimization" = x"ARM"],[
|
cannam@154
|
216 AM_CONDITIONAL([OPUS_ARM_INLINE_ASM],[true])
|
cannam@154
|
217 AC_DEFINE([OPUS_ARM_INLINE_ASM], 1,
|
cannam@154
|
218 [Use generic ARMv4 inline asm optimizations])
|
cannam@154
|
219 AS_IF([test x"$OPUS_ARM_INLINE_EDSP" = x"1"],[
|
cannam@154
|
220 AC_DEFINE([OPUS_ARM_INLINE_EDSP], [1],
|
cannam@154
|
221 [Use ARMv5E inline asm optimizations])
|
cannam@154
|
222 inline_optimization="$inline_optimization (EDSP)"
|
cannam@154
|
223 ])
|
cannam@154
|
224 AS_IF([test x"$OPUS_ARM_INLINE_MEDIA" = x"1"],[
|
cannam@154
|
225 AC_DEFINE([OPUS_ARM_INLINE_MEDIA], [1],
|
cannam@154
|
226 [Use ARMv6 inline asm optimizations])
|
cannam@154
|
227 inline_optimization="$inline_optimization (Media)"
|
cannam@154
|
228 ])
|
cannam@154
|
229 AS_IF([test x"$OPUS_ARM_INLINE_NEON" = x"1"],[
|
cannam@154
|
230 AC_DEFINE([OPUS_ARM_INLINE_NEON], 1,
|
cannam@154
|
231 [Use ARM NEON inline asm optimizations])
|
cannam@154
|
232 inline_optimization="$inline_optimization (NEON)"
|
cannam@154
|
233 ])
|
cannam@154
|
234 ])
|
cannam@154
|
235 dnl We need Perl to translate RVCT-syntax asm to gas syntax.
|
cannam@154
|
236 AC_CHECK_PROG([HAVE_PERL], perl, yes, no)
|
cannam@154
|
237 AS_IF([test x"$HAVE_PERL" = x"yes"],[
|
cannam@154
|
238 AM_CONDITIONAL([OPUS_ARM_EXTERNAL_ASM],[true])
|
cannam@154
|
239 asm_optimization="ARM"
|
cannam@154
|
240 AS_IF([test x"$OPUS_ARM_INLINE_EDSP" = x"1"], [
|
cannam@154
|
241 OPUS_ARM_PRESUME_EDSP=1
|
cannam@154
|
242 OPUS_ARM_MAY_HAVE_EDSP=1
|
cannam@154
|
243 ],
|
cannam@154
|
244 [
|
cannam@154
|
245 OPUS_ARM_PRESUME_EDSP=0
|
cannam@154
|
246 OPUS_ARM_MAY_HAVE_EDSP=0
|
cannam@154
|
247 ])
|
cannam@154
|
248 AS_IF([test x"$OPUS_ARM_INLINE_MEDIA" = x"1"], [
|
cannam@154
|
249 OPUS_ARM_PRESUME_MEDIA=1
|
cannam@154
|
250 OPUS_ARM_MAY_HAVE_MEDIA=1
|
cannam@154
|
251 ],
|
cannam@154
|
252 [
|
cannam@154
|
253 OPUS_ARM_PRESUME_MEDIA=0
|
cannam@154
|
254 OPUS_ARM_MAY_HAVE_MEDIA=0
|
cannam@154
|
255 ])
|
cannam@154
|
256 AS_IF([test x"$OPUS_ARM_INLINE_NEON" = x"1"], [
|
cannam@154
|
257 OPUS_ARM_PRESUME_NEON=1
|
cannam@154
|
258 OPUS_ARM_MAY_HAVE_NEON=1
|
cannam@154
|
259 ],
|
cannam@154
|
260 [
|
cannam@154
|
261 OPUS_ARM_PRESUME_NEON=0
|
cannam@154
|
262 OPUS_ARM_MAY_HAVE_NEON=0
|
cannam@154
|
263 ])
|
cannam@154
|
264 AS_IF([test x"$enable_rtcd" = x"yes"],[
|
cannam@154
|
265 AS_IF([test x"$OPUS_ARM_MAY_HAVE_EDSP" != x"1"],[
|
cannam@154
|
266 AC_MSG_NOTICE(
|
cannam@154
|
267 [Trying to force-enable armv5e EDSP instructions...])
|
cannam@154
|
268 AS_ASM_ARM_EDSP_FORCE([OPUS_ARM_MAY_HAVE_EDSP=1])
|
cannam@154
|
269 ])
|
cannam@154
|
270 AS_IF([test x"$OPUS_ARM_MAY_HAVE_MEDIA" != x"1"],[
|
cannam@154
|
271 AC_MSG_NOTICE(
|
cannam@154
|
272 [Trying to force-enable ARMv6 media instructions...])
|
cannam@154
|
273 AS_ASM_ARM_MEDIA_FORCE([OPUS_ARM_MAY_HAVE_MEDIA=1])
|
cannam@154
|
274 ])
|
cannam@154
|
275 AS_IF([test x"$OPUS_ARM_MAY_HAVE_NEON" != x"1"],[
|
cannam@154
|
276 AC_MSG_NOTICE(
|
cannam@154
|
277 [Trying to force-enable NEON instructions...])
|
cannam@154
|
278 AS_ASM_ARM_NEON_FORCE([OPUS_ARM_MAY_HAVE_NEON=1])
|
cannam@154
|
279 ])
|
cannam@154
|
280 ])
|
cannam@154
|
281 rtcd_support=
|
cannam@154
|
282 AS_IF([test x"$OPUS_ARM_MAY_HAVE_EDSP" = x"1"],[
|
cannam@154
|
283 AC_DEFINE(OPUS_ARM_MAY_HAVE_EDSP, 1,
|
cannam@154
|
284 [Define if assembler supports EDSP instructions])
|
cannam@154
|
285 AS_IF([test x"$OPUS_ARM_PRESUME_EDSP" = x"1"],[
|
cannam@154
|
286 AC_DEFINE(OPUS_ARM_PRESUME_EDSP, 1,
|
cannam@154
|
287 [Define if binary requires EDSP instruction support])
|
cannam@154
|
288 asm_optimization="$asm_optimization (EDSP)"
|
cannam@154
|
289 ],
|
cannam@154
|
290 [rtcd_support="$rtcd_support (EDSP)"]
|
cannam@154
|
291 )
|
cannam@154
|
292 ])
|
cannam@154
|
293 AC_SUBST(OPUS_ARM_MAY_HAVE_EDSP)
|
cannam@154
|
294 AS_IF([test x"$OPUS_ARM_MAY_HAVE_MEDIA" = x"1"],[
|
cannam@154
|
295 AC_DEFINE(OPUS_ARM_MAY_HAVE_MEDIA, 1,
|
cannam@154
|
296 [Define if assembler supports ARMv6 media instructions])
|
cannam@154
|
297 AS_IF([test x"$OPUS_ARM_PRESUME_MEDIA" = x"1"],[
|
cannam@154
|
298 AC_DEFINE(OPUS_ARM_PRESUME_MEDIA, 1,
|
cannam@154
|
299 [Define if binary requires ARMv6 media instruction support])
|
cannam@154
|
300 asm_optimization="$asm_optimization (Media)"
|
cannam@154
|
301 ],
|
cannam@154
|
302 [rtcd_support="$rtcd_support (Media)"]
|
cannam@154
|
303 )
|
cannam@154
|
304 ])
|
cannam@154
|
305 AC_SUBST(OPUS_ARM_MAY_HAVE_MEDIA)
|
cannam@154
|
306 AS_IF([test x"$OPUS_ARM_MAY_HAVE_NEON" = x"1"],[
|
cannam@154
|
307 AC_DEFINE(OPUS_ARM_MAY_HAVE_NEON, 1,
|
cannam@154
|
308 [Define if compiler supports NEON instructions])
|
cannam@154
|
309 AS_IF([test x"$OPUS_ARM_PRESUME_NEON" = x"1"], [
|
cannam@154
|
310 AC_DEFINE(OPUS_ARM_PRESUME_NEON, 1,
|
cannam@154
|
311 [Define if binary requires NEON instruction support])
|
cannam@154
|
312 asm_optimization="$asm_optimization (NEON)"
|
cannam@154
|
313 ],
|
cannam@154
|
314 [rtcd_support="$rtcd_support (NEON)"]
|
cannam@154
|
315 )
|
cannam@154
|
316 ])
|
cannam@154
|
317 AC_SUBST(OPUS_ARM_MAY_HAVE_NEON)
|
cannam@154
|
318 dnl Make sure turning on RTCD gets us at least one
|
cannam@154
|
319 dnl instruction set.
|
cannam@154
|
320 AS_IF([test x"$rtcd_support" != x""],
|
cannam@154
|
321 [rtcd_support=ARM"$rtcd_support"],
|
cannam@154
|
322 [rtcd_support="no"]
|
cannam@154
|
323 )
|
cannam@154
|
324 AC_MSG_CHECKING([for apple style tools])
|
cannam@154
|
325 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
|
cannam@154
|
326 #ifndef __APPLE__
|
cannam@154
|
327 #error 1
|
cannam@154
|
328 #endif],[])],
|
cannam@154
|
329 [AC_MSG_RESULT([yes]); ARM2GNU_PARAMS="--apple"],
|
cannam@154
|
330 [AC_MSG_RESULT([no]); ARM2GNU_PARAMS=""])
|
cannam@154
|
331 AC_SUBST(ARM2GNU_PARAMS)
|
cannam@154
|
332 ],
|
cannam@154
|
333 [
|
cannam@154
|
334 AC_MSG_WARN(
|
cannam@154
|
335 [*** ARM assembly requires perl -- disabling optimizations])
|
cannam@154
|
336 asm_optimization="(missing perl dependency for ARM)"
|
cannam@154
|
337 ])
|
cannam@154
|
338 ])
|
cannam@154
|
339 ;;
|
cannam@154
|
340 esac
|
cannam@154
|
341 ],[
|
cannam@154
|
342 inline_optimization="disabled"
|
cannam@154
|
343 asm_optimization="disabled"
|
cannam@154
|
344 ])
|
cannam@154
|
345
|
cannam@154
|
346 AM_CONDITIONAL([OPUS_ARM_INLINE_ASM],
|
cannam@154
|
347 [test x"${inline_optimization%% *}" = x"ARM"])
|
cannam@154
|
348 AM_CONDITIONAL([OPUS_ARM_EXTERNAL_ASM],
|
cannam@154
|
349 [test x"${asm_optimization%% *}" = x"ARM"])
|
cannam@154
|
350
|
cannam@154
|
351 AM_CONDITIONAL([HAVE_SSE], [false])
|
cannam@154
|
352 AM_CONDITIONAL([HAVE_SSE2], [false])
|
cannam@154
|
353 AM_CONDITIONAL([HAVE_SSE4_1], [false])
|
cannam@154
|
354 AM_CONDITIONAL([HAVE_AVX], [false])
|
cannam@154
|
355
|
cannam@154
|
356 m4_define([DEFAULT_X86_SSE_CFLAGS], [-msse])
|
cannam@154
|
357 m4_define([DEFAULT_X86_SSE2_CFLAGS], [-msse2])
|
cannam@154
|
358 m4_define([DEFAULT_X86_SSE4_1_CFLAGS], [-msse4.1])
|
cannam@154
|
359 m4_define([DEFAULT_X86_AVX_CFLAGS], [-mavx])
|
cannam@154
|
360 m4_define([DEFAULT_ARM_NEON_INTR_CFLAGS], [-mfpu=neon])
|
cannam@154
|
361 # With GCC on ARM32 softfp architectures (e.g. Android, or older Ubuntu) you need to specify
|
cannam@154
|
362 # -mfloat-abi=softfp for -mfpu=neon to work. However, on ARM32 hardfp architectures (e.g. newer Ubuntu),
|
cannam@154
|
363 # this option will break things.
|
cannam@154
|
364
|
cannam@154
|
365 # As a heuristic, if host matches arm*eabi* but not arm*hf*, it's probably soft-float.
|
cannam@154
|
366 m4_define([DEFAULT_ARM_NEON_SOFTFP_INTR_CFLAGS], [-mfpu=neon -mfloat-abi=softfp])
|
cannam@154
|
367
|
cannam@154
|
368 AS_CASE([$host],
|
cannam@154
|
369 [arm*hf*], [AS_VAR_SET([RESOLVED_DEFAULT_ARM_NEON_INTR_CFLAGS], "DEFAULT_ARM_NEON_INTR_CFLAGS")],
|
cannam@154
|
370 [arm*eabi*], [AS_VAR_SET([RESOLVED_DEFAULT_ARM_NEON_INTR_CFLAGS], "DEFAULT_ARM_NEON_SOFTFP_INTR_CFLAGS")],
|
cannam@154
|
371 [AS_VAR_SET([RESOLVED_DEFAULT_ARM_NEON_INTR_CFLAGS], "DEFAULT_ARM_NEON_INTR_CFLAGS")])
|
cannam@154
|
372
|
cannam@154
|
373 AC_ARG_VAR([X86_SSE_CFLAGS], [C compiler flags to compile SSE intrinsics @<:@default=]DEFAULT_X86_SSE_CFLAGS[@:>@])
|
cannam@154
|
374 AC_ARG_VAR([X86_SSE2_CFLAGS], [C compiler flags to compile SSE2 intrinsics @<:@default=]DEFAULT_X86_SSE2_CFLAGS[@:>@])
|
cannam@154
|
375 AC_ARG_VAR([X86_SSE4_1_CFLAGS], [C compiler flags to compile SSE4.1 intrinsics @<:@default=]DEFAULT_X86_SSE4_1_CFLAGS[@:>@])
|
cannam@154
|
376 AC_ARG_VAR([X86_AVX_CFLAGS], [C compiler flags to compile AVX intrinsics @<:@default=]DEFAULT_X86_AVX_CFLAGS[@:>@])
|
cannam@154
|
377 AC_ARG_VAR([ARM_NEON_INTR_CFLAGS], [C compiler flags to compile ARM NEON intrinsics @<:@default=]DEFAULT_ARM_NEON_INTR_CFLAGS / DEFAULT_ARM_NEON_SOFTFP_INTR_CFLAGS[@:>@])
|
cannam@154
|
378
|
cannam@154
|
379 AS_VAR_SET_IF([X86_SSE_CFLAGS], [], [AS_VAR_SET([X86_SSE_CFLAGS], "DEFAULT_X86_SSE_CFLAGS")])
|
cannam@154
|
380 AS_VAR_SET_IF([X86_SSE2_CFLAGS], [], [AS_VAR_SET([X86_SSE2_CFLAGS], "DEFAULT_X86_SSE2_CFLAGS")])
|
cannam@154
|
381 AS_VAR_SET_IF([X86_SSE4_1_CFLAGS], [], [AS_VAR_SET([X86_SSE4_1_CFLAGS], "DEFAULT_X86_SSE4_1_CFLAGS")])
|
cannam@154
|
382 AS_VAR_SET_IF([X86_AVX_CFLAGS], [], [AS_VAR_SET([X86_AVX_CFLAGS], "DEFAULT_X86_AVX_CFLAGS")])
|
cannam@154
|
383 AS_VAR_SET_IF([ARM_NEON_INTR_CFLAGS], [], [AS_VAR_SET([ARM_NEON_INTR_CFLAGS], ["$RESOLVED_DEFAULT_ARM_NEON_INTR_CFLAGS"])])
|
cannam@154
|
384
|
cannam@154
|
385 AC_DEFUN([OPUS_PATH_NE10],
|
cannam@154
|
386 [
|
cannam@154
|
387 AC_ARG_WITH(NE10,
|
cannam@154
|
388 AC_HELP_STRING([--with-NE10=PFX],[Prefix where libNE10 is installed (optional)]),
|
cannam@154
|
389 NE10_prefix="$withval", NE10_prefix="")
|
cannam@154
|
390 AC_ARG_WITH(NE10-libraries,
|
cannam@154
|
391 AC_HELP_STRING([--with-NE10-libraries=DIR],
|
cannam@154
|
392 [Directory where libNE10 library is installed (optional)]),
|
cannam@154
|
393 NE10_libraries="$withval", NE10_libraries="")
|
cannam@154
|
394 AC_ARG_WITH(NE10-includes,
|
cannam@154
|
395 AC_HELP_STRING([--with-NE10-includes=DIR],
|
cannam@154
|
396 [Directory where libNE10 header files are installed (optional)]),
|
cannam@154
|
397 NE10_includes="$withval", NE10_includes="")
|
cannam@154
|
398
|
cannam@154
|
399 if test "x$NE10_libraries" != "x" ; then
|
cannam@154
|
400 NE10_LIBS="-L$NE10_libraries"
|
cannam@154
|
401 elif test "x$NE10_prefix" = "xno" || test "x$NE10_prefix" = "xyes" ; then
|
cannam@154
|
402 NE10_LIBS=""
|
cannam@154
|
403 elif test "x$NE10_prefix" != "x" ; then
|
cannam@154
|
404 NE10_LIBS="-L$NE10_prefix/lib"
|
cannam@154
|
405 elif test "x$prefix" != "xNONE" ; then
|
cannam@154
|
406 NE10_LIBS="-L$prefix/lib"
|
cannam@154
|
407 fi
|
cannam@154
|
408
|
cannam@154
|
409 if test "x$NE10_prefix" != "xno" ; then
|
cannam@154
|
410 NE10_LIBS="$NE10_LIBS -lNE10"
|
cannam@154
|
411 fi
|
cannam@154
|
412
|
cannam@154
|
413 if test "x$NE10_includes" != "x" ; then
|
cannam@154
|
414 NE10_CFLAGS="-I$NE10_includes"
|
cannam@154
|
415 elif test "x$NE10_prefix" = "xno" || test "x$NE10_prefix" = "xyes" ; then
|
cannam@154
|
416 NE10_CFLAGS=""
|
cannam@154
|
417 elif test "x$NE10_prefix" != "x" ; then
|
cannam@154
|
418 NE10_CFLAGS="-I$NE10_prefix/include"
|
cannam@154
|
419 elif test "x$prefix" != "xNONE"; then
|
cannam@154
|
420 NE10_CFLAGS="-I$prefix/include"
|
cannam@154
|
421 fi
|
cannam@154
|
422
|
cannam@154
|
423 AC_MSG_CHECKING(for NE10)
|
cannam@154
|
424 save_CFLAGS="$CFLAGS"; CFLAGS="$CFLAGS $NE10_CFLAGS"
|
cannam@154
|
425 save_LIBS="$LIBS"; LIBS="$LIBS $NE10_LIBS $LIBM"
|
cannam@154
|
426 AC_LINK_IFELSE(
|
cannam@154
|
427 [
|
cannam@154
|
428 AC_LANG_PROGRAM(
|
cannam@154
|
429 [[#include <NE10_dsp.h>
|
cannam@154
|
430 ]],
|
cannam@154
|
431 [[
|
cannam@154
|
432 ne10_fft_cfg_float32_t cfg;
|
cannam@154
|
433 cfg = ne10_fft_alloc_c2c_float32_neon(480);
|
cannam@154
|
434 ]]
|
cannam@154
|
435 )
|
cannam@154
|
436 ],[
|
cannam@154
|
437 HAVE_ARM_NE10=1
|
cannam@154
|
438 AC_MSG_RESULT([yes])
|
cannam@154
|
439 ],[
|
cannam@154
|
440 HAVE_ARM_NE10=0
|
cannam@154
|
441 AC_MSG_RESULT([no])
|
cannam@154
|
442 NE10_CFLAGS=""
|
cannam@154
|
443 NE10_LIBS=""
|
cannam@154
|
444 ]
|
cannam@154
|
445 )
|
cannam@154
|
446 CFLAGS="$save_CFLAGS"; LIBS="$save_LIBS"
|
cannam@154
|
447 #Now we know if libNE10 is installed or not
|
cannam@154
|
448 AS_IF([test x"$HAVE_ARM_NE10" = x"1"],
|
cannam@154
|
449 [
|
cannam@154
|
450 AC_DEFINE([HAVE_ARM_NE10], 1, [NE10 library is installed on host. Make sure it is on target!])
|
cannam@154
|
451 AC_SUBST(HAVE_ARM_NE10)
|
cannam@154
|
452 AC_SUBST(NE10_CFLAGS)
|
cannam@154
|
453 AC_SUBST(NE10_LIBS)
|
cannam@154
|
454 ]
|
cannam@154
|
455 )
|
cannam@154
|
456 ]
|
cannam@154
|
457 )
|
cannam@154
|
458
|
cannam@154
|
459 AS_IF([test x"$enable_intrinsics" = x"yes"],[
|
cannam@154
|
460 intrinsics_support=""
|
cannam@154
|
461 AS_CASE([$host_cpu],
|
cannam@154
|
462 [arm*|aarch64*],
|
cannam@154
|
463 [
|
cannam@154
|
464 cpu_arm=yes
|
cannam@154
|
465 OPUS_CHECK_INTRINSICS(
|
cannam@154
|
466 [ARM Neon],
|
cannam@154
|
467 [$ARM_NEON_INTR_CFLAGS],
|
cannam@154
|
468 [OPUS_ARM_MAY_HAVE_NEON_INTR],
|
cannam@154
|
469 [OPUS_ARM_PRESUME_NEON_INTR],
|
cannam@154
|
470 [[#include <arm_neon.h>
|
cannam@154
|
471 ]],
|
cannam@154
|
472 [[
|
cannam@154
|
473 static float32x4_t A0, A1, SUMM;
|
cannam@154
|
474 SUMM = vmlaq_f32(SUMM, A0, A1);
|
cannam@154
|
475 return (int)vgetq_lane_f32(SUMM, 0);
|
cannam@154
|
476 ]]
|
cannam@154
|
477 )
|
cannam@154
|
478 AS_IF([test x"$OPUS_ARM_MAY_HAVE_NEON_INTR" = x"1" && test x"$OPUS_ARM_PRESUME_NEON_INTR" != x"1"],
|
cannam@154
|
479 [
|
cannam@154
|
480 OPUS_ARM_NEON_INTR_CFLAGS="$ARM_NEON_INTR_CFLAGS"
|
cannam@154
|
481 AC_SUBST([OPUS_ARM_NEON_INTR_CFLAGS])
|
cannam@154
|
482 ]
|
cannam@154
|
483 )
|
cannam@154
|
484
|
cannam@154
|
485 AS_IF([test x"$OPUS_ARM_MAY_HAVE_NEON_INTR" = x"1"],
|
cannam@154
|
486 [
|
cannam@154
|
487 AC_DEFINE([OPUS_ARM_MAY_HAVE_NEON_INTR], 1, [Compiler supports ARMv7/Aarch64 Neon Intrinsics])
|
cannam@154
|
488 intrinsics_support="$intrinsics_support (NEON)"
|
cannam@154
|
489
|
cannam@154
|
490 AS_IF([test x"$enable_rtcd" != x"no" && test x"$OPUS_ARM_PRESUME_NEON_INTR" != x"1"],
|
cannam@154
|
491 [AS_IF([test x"$rtcd_support" = x"no"],
|
cannam@154
|
492 [rtcd_support="ARM (NEON Intrinsics)"],
|
cannam@154
|
493 [rtcd_support="$rtcd_support (NEON Intrinsics)"])])
|
cannam@154
|
494
|
cannam@154
|
495 AS_IF([test x"$OPUS_ARM_PRESUME_NEON_INTR" = x"1"],
|
cannam@154
|
496 [AC_DEFINE([OPUS_ARM_PRESUME_NEON_INTR], 1, [Define if binary requires NEON intrinsics support])])
|
cannam@154
|
497
|
cannam@154
|
498 OPUS_PATH_NE10()
|
cannam@154
|
499 AS_IF([test x"$NE10_LIBS" != x""],
|
cannam@154
|
500 [
|
cannam@154
|
501 intrinsics_support="$intrinsics_support (NE10)"
|
cannam@154
|
502 AS_IF([test x"enable_rtcd" != x"" \
|
cannam@154
|
503 && test x"$OPUS_ARM_PRESUME_NEON_INTR" != x"1"],
|
cannam@154
|
504 [rtcd_support="$rtcd_support (NE10)"])
|
cannam@154
|
505 ])
|
cannam@154
|
506
|
cannam@154
|
507 OPUS_CHECK_INTRINSICS(
|
cannam@154
|
508 [Aarch64 Neon],
|
cannam@154
|
509 [$ARM_NEON_INTR_CFLAGS],
|
cannam@154
|
510 [OPUS_ARM_MAY_HAVE_AARCH64_NEON_INTR],
|
cannam@154
|
511 [OPUS_ARM_PRESUME_AARCH64_NEON_INTR],
|
cannam@154
|
512 [[#include <arm_neon.h>
|
cannam@154
|
513 ]],
|
cannam@154
|
514 [[
|
cannam@154
|
515 static int32_t IN;
|
cannam@154
|
516 static int16_t OUT;
|
cannam@154
|
517 OUT = vqmovns_s32(IN);
|
cannam@154
|
518 ]]
|
cannam@154
|
519 )
|
cannam@154
|
520
|
cannam@154
|
521 AS_IF([test x"$OPUS_ARM_PRESUME_AARCH64_NEON_INTR" = x"1"],
|
cannam@154
|
522 [
|
cannam@154
|
523 AC_DEFINE([OPUS_ARM_PRESUME_AARCH64_NEON_INTR], 1, [Define if binary requires Aarch64 Neon Intrinsics])
|
cannam@154
|
524 intrinsics_support="$intrinsics_support (NEON [Aarch64])"
|
cannam@154
|
525 ])
|
cannam@154
|
526
|
cannam@154
|
527 AS_IF([test x"$intrinsics_support" = x""],
|
cannam@154
|
528 [intrinsics_support=no],
|
cannam@154
|
529 [intrinsics_support="ARM$intrinsics_support"])
|
cannam@154
|
530 ],
|
cannam@154
|
531 [
|
cannam@154
|
532 AC_MSG_WARN([Compiler does not support ARM intrinsics])
|
cannam@154
|
533 intrinsics_support=no
|
cannam@154
|
534 ])
|
cannam@154
|
535 ],
|
cannam@154
|
536 [i?86|x86_64],
|
cannam@154
|
537 [
|
cannam@154
|
538 OPUS_CHECK_INTRINSICS(
|
cannam@154
|
539 [SSE],
|
cannam@154
|
540 [$X86_SSE_CFLAGS],
|
cannam@154
|
541 [OPUS_X86_MAY_HAVE_SSE],
|
cannam@154
|
542 [OPUS_X86_PRESUME_SSE],
|
cannam@154
|
543 [[#include <xmmintrin.h>
|
cannam@154
|
544 #include <time.h>
|
cannam@154
|
545 ]],
|
cannam@154
|
546 [[
|
cannam@154
|
547 __m128 mtest;
|
cannam@154
|
548 mtest = _mm_set1_ps((float)time(NULL));
|
cannam@154
|
549 mtest = _mm_mul_ps(mtest, mtest);
|
cannam@154
|
550 return _mm_cvtss_si32(mtest);
|
cannam@154
|
551 ]]
|
cannam@154
|
552 )
|
cannam@154
|
553 AS_IF([test x"$OPUS_X86_MAY_HAVE_SSE" = x"1" && test x"$OPUS_X86_PRESUME_SSE" != x"1"],
|
cannam@154
|
554 [
|
cannam@154
|
555 OPUS_X86_SSE_CFLAGS="$X86_SSE_CFLAGS"
|
cannam@154
|
556 AC_SUBST([OPUS_X86_SSE_CFLAGS])
|
cannam@154
|
557 ]
|
cannam@154
|
558 )
|
cannam@154
|
559 OPUS_CHECK_INTRINSICS(
|
cannam@154
|
560 [SSE2],
|
cannam@154
|
561 [$X86_SSE2_CFLAGS],
|
cannam@154
|
562 [OPUS_X86_MAY_HAVE_SSE2],
|
cannam@154
|
563 [OPUS_X86_PRESUME_SSE2],
|
cannam@154
|
564 [[#include <emmintrin.h>
|
cannam@154
|
565 #include <time.h>
|
cannam@154
|
566 ]],
|
cannam@154
|
567 [[
|
cannam@154
|
568 __m128i mtest;
|
cannam@154
|
569 mtest = _mm_set1_epi32((int)time(NULL));
|
cannam@154
|
570 mtest = _mm_mul_epu32(mtest, mtest);
|
cannam@154
|
571 return _mm_cvtsi128_si32(mtest);
|
cannam@154
|
572 ]]
|
cannam@154
|
573 )
|
cannam@154
|
574 AS_IF([test x"$OPUS_X86_MAY_HAVE_SSE2" = x"1" && test x"$OPUS_X86_PRESUME_SSE2" != x"1"],
|
cannam@154
|
575 [
|
cannam@154
|
576 OPUS_X86_SSE2_CFLAGS="$X86_SSE2_CFLAGS"
|
cannam@154
|
577 AC_SUBST([OPUS_X86_SSE2_CFLAGS])
|
cannam@154
|
578 ]
|
cannam@154
|
579 )
|
cannam@154
|
580 OPUS_CHECK_INTRINSICS(
|
cannam@154
|
581 [SSE4.1],
|
cannam@154
|
582 [$X86_SSE4_1_CFLAGS],
|
cannam@154
|
583 [OPUS_X86_MAY_HAVE_SSE4_1],
|
cannam@154
|
584 [OPUS_X86_PRESUME_SSE4_1],
|
cannam@154
|
585 [[#include <smmintrin.h>
|
cannam@154
|
586 #include <time.h>
|
cannam@154
|
587 ]],
|
cannam@154
|
588 [[
|
cannam@154
|
589 __m128i mtest;
|
cannam@154
|
590 mtest = _mm_set1_epi32((int)time(NULL));
|
cannam@154
|
591 mtest = _mm_mul_epi32(mtest, mtest);
|
cannam@154
|
592 return _mm_cvtsi128_si32(mtest);
|
cannam@154
|
593 ]]
|
cannam@154
|
594 )
|
cannam@154
|
595 AS_IF([test x"$OPUS_X86_MAY_HAVE_SSE4_1" = x"1" && test x"$OPUS_X86_PRESUME_SSE4_1" != x"1"],
|
cannam@154
|
596 [
|
cannam@154
|
597 OPUS_X86_SSE4_1_CFLAGS="$X86_SSE4_1_CFLAGS"
|
cannam@154
|
598 AC_SUBST([OPUS_X86_SSE4_1_CFLAGS])
|
cannam@154
|
599 ]
|
cannam@154
|
600 )
|
cannam@154
|
601 OPUS_CHECK_INTRINSICS(
|
cannam@154
|
602 [AVX],
|
cannam@154
|
603 [$X86_AVX_CFLAGS],
|
cannam@154
|
604 [OPUS_X86_MAY_HAVE_AVX],
|
cannam@154
|
605 [OPUS_X86_PRESUME_AVX],
|
cannam@154
|
606 [[#include <immintrin.h>
|
cannam@154
|
607 #include <time.h>
|
cannam@154
|
608 ]],
|
cannam@154
|
609 [[
|
cannam@154
|
610 __m256 mtest;
|
cannam@154
|
611 mtest = _mm256_set1_ps((float)time(NULL));
|
cannam@154
|
612 mtest = _mm256_addsub_ps(mtest, mtest);
|
cannam@154
|
613 return _mm_cvtss_si32(_mm256_extractf128_ps(mtest, 0));
|
cannam@154
|
614 ]]
|
cannam@154
|
615 )
|
cannam@154
|
616 AS_IF([test x"$OPUS_X86_MAY_HAVE_AVX" = x"1" && test x"$OPUS_X86_PRESUME_AVX" != x"1"],
|
cannam@154
|
617 [
|
cannam@154
|
618 OPUS_X86_AVX_CFLAGS="$X86_AVX_CFLAGS"
|
cannam@154
|
619 AC_SUBST([OPUS_X86_AVX_CFLAGS])
|
cannam@154
|
620 ]
|
cannam@154
|
621 )
|
cannam@154
|
622 AS_IF([test x"$rtcd_support" = x"no"], [rtcd_support=""])
|
cannam@154
|
623 AS_IF([test x"$OPUS_X86_MAY_HAVE_SSE" = x"1"],
|
cannam@154
|
624 [
|
cannam@154
|
625 AC_DEFINE([OPUS_X86_MAY_HAVE_SSE], 1, [Compiler supports X86 SSE Intrinsics])
|
cannam@154
|
626 intrinsics_support="$intrinsics_support SSE"
|
cannam@154
|
627
|
cannam@154
|
628 AS_IF([test x"$OPUS_X86_PRESUME_SSE" = x"1"],
|
cannam@154
|
629 [AC_DEFINE([OPUS_X86_PRESUME_SSE], 1, [Define if binary requires SSE intrinsics support])],
|
cannam@154
|
630 [rtcd_support="$rtcd_support SSE"])
|
cannam@154
|
631 ],
|
cannam@154
|
632 [
|
cannam@154
|
633 AC_MSG_WARN([Compiler does not support SSE intrinsics])
|
cannam@154
|
634 ])
|
cannam@154
|
635
|
cannam@154
|
636 AS_IF([test x"$OPUS_X86_MAY_HAVE_SSE2" = x"1"],
|
cannam@154
|
637 [
|
cannam@154
|
638 AC_DEFINE([OPUS_X86_MAY_HAVE_SSE2], 1, [Compiler supports X86 SSE2 Intrinsics])
|
cannam@154
|
639 intrinsics_support="$intrinsics_support SSE2"
|
cannam@154
|
640
|
cannam@154
|
641 AS_IF([test x"$OPUS_X86_PRESUME_SSE2" = x"1"],
|
cannam@154
|
642 [AC_DEFINE([OPUS_X86_PRESUME_SSE2], 1, [Define if binary requires SSE2 intrinsics support])],
|
cannam@154
|
643 [rtcd_support="$rtcd_support SSE2"])
|
cannam@154
|
644 ],
|
cannam@154
|
645 [
|
cannam@154
|
646 AC_MSG_WARN([Compiler does not support SSE2 intrinsics])
|
cannam@154
|
647 ])
|
cannam@154
|
648
|
cannam@154
|
649 AS_IF([test x"$OPUS_X86_MAY_HAVE_SSE4_1" = x"1"],
|
cannam@154
|
650 [
|
cannam@154
|
651 AC_DEFINE([OPUS_X86_MAY_HAVE_SSE4_1], 1, [Compiler supports X86 SSE4.1 Intrinsics])
|
cannam@154
|
652 intrinsics_support="$intrinsics_support SSE4.1"
|
cannam@154
|
653
|
cannam@154
|
654 AS_IF([test x"$OPUS_X86_PRESUME_SSE4_1" = x"1"],
|
cannam@154
|
655 [AC_DEFINE([OPUS_X86_PRESUME_SSE4_1], 1, [Define if binary requires SSE4.1 intrinsics support])],
|
cannam@154
|
656 [rtcd_support="$rtcd_support SSE4.1"])
|
cannam@154
|
657 ],
|
cannam@154
|
658 [
|
cannam@154
|
659 AC_MSG_WARN([Compiler does not support SSE4.1 intrinsics])
|
cannam@154
|
660 ])
|
cannam@154
|
661 AS_IF([test x"$OPUS_X86_MAY_HAVE_AVX" = x"1"],
|
cannam@154
|
662 [
|
cannam@154
|
663 AC_DEFINE([OPUS_X86_MAY_HAVE_AVX], 1, [Compiler supports X86 AVX Intrinsics])
|
cannam@154
|
664 intrinsics_support="$intrinsics_support AVX"
|
cannam@154
|
665
|
cannam@154
|
666 AS_IF([test x"$OPUS_X86_PRESUME_AVX" = x"1"],
|
cannam@154
|
667 [AC_DEFINE([OPUS_X86_PRESUME_AVX], 1, [Define if binary requires AVX intrinsics support])],
|
cannam@154
|
668 [rtcd_support="$rtcd_support AVX"])
|
cannam@154
|
669 ],
|
cannam@154
|
670 [
|
cannam@154
|
671 AC_MSG_WARN([Compiler does not support AVX intrinsics])
|
cannam@154
|
672 ])
|
cannam@154
|
673
|
cannam@154
|
674 AS_IF([test x"$intrinsics_support" = x""],
|
cannam@154
|
675 [intrinsics_support=no],
|
cannam@154
|
676 [intrinsics_support="x86$intrinsics_support"]
|
cannam@154
|
677 )
|
cannam@154
|
678 AS_IF([test x"$rtcd_support" = x""],
|
cannam@154
|
679 [rtcd_support=no],
|
cannam@154
|
680 [rtcd_support="x86$rtcd_support"],
|
cannam@154
|
681 )
|
cannam@154
|
682
|
cannam@154
|
683 AS_IF([test x"$enable_rtcd" = x"yes" && test x"$rtcd_support" != x""],[
|
cannam@154
|
684 get_cpuid_by_asm="no"
|
cannam@154
|
685 AC_MSG_CHECKING([How to get X86 CPU Info])
|
cannam@154
|
686 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
cannam@154
|
687 #include <stdio.h>
|
cannam@154
|
688 ]],[[
|
cannam@154
|
689 unsigned int CPUInfo0;
|
cannam@154
|
690 unsigned int CPUInfo1;
|
cannam@154
|
691 unsigned int CPUInfo2;
|
cannam@154
|
692 unsigned int CPUInfo3;
|
cannam@154
|
693 unsigned int InfoType;
|
cannam@154
|
694 __asm__ __volatile__ (
|
cannam@154
|
695 "cpuid":
|
cannam@154
|
696 "=a" (CPUInfo0),
|
cannam@154
|
697 "=b" (CPUInfo1),
|
cannam@154
|
698 "=c" (CPUInfo2),
|
cannam@154
|
699 "=d" (CPUInfo3) :
|
cannam@154
|
700 "a" (InfoType), "c" (0)
|
cannam@154
|
701 );
|
cannam@154
|
702 ]])],
|
cannam@154
|
703 [get_cpuid_by_asm="yes"
|
cannam@154
|
704 AC_MSG_RESULT([Inline Assembly])
|
cannam@154
|
705 AC_DEFINE([CPU_INFO_BY_ASM], [1], [Get CPU Info by asm method])],
|
cannam@154
|
706 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
cannam@154
|
707 #include <cpuid.h>
|
cannam@154
|
708 ]],[[
|
cannam@154
|
709 unsigned int CPUInfo0;
|
cannam@154
|
710 unsigned int CPUInfo1;
|
cannam@154
|
711 unsigned int CPUInfo2;
|
cannam@154
|
712 unsigned int CPUInfo3;
|
cannam@154
|
713 unsigned int InfoType;
|
cannam@154
|
714 __get_cpuid(InfoType, &CPUInfo0, &CPUInfo1, &CPUInfo2, &CPUInfo3);
|
cannam@154
|
715 ]])],
|
cannam@154
|
716 [AC_MSG_RESULT([C method])
|
cannam@154
|
717 AC_DEFINE([CPU_INFO_BY_C], [1], [Get CPU Info by c method])],
|
cannam@154
|
718 [AC_MSG_ERROR([no supported Get CPU Info method, please disable run-time CPU capabilities detection or intrinsics])])])])
|
cannam@154
|
719 ],
|
cannam@154
|
720 [
|
cannam@154
|
721 AC_MSG_WARN([No intrinsics support for your architecture])
|
cannam@154
|
722 intrinsics_support="no"
|
cannam@154
|
723 ])
|
cannam@154
|
724 ],
|
cannam@154
|
725 [
|
cannam@154
|
726 intrinsics_support="no"
|
cannam@154
|
727 ])
|
cannam@154
|
728
|
cannam@154
|
729 AM_CONDITIONAL([CPU_ARM], [test "$cpu_arm" = "yes"])
|
cannam@154
|
730 AM_CONDITIONAL([HAVE_ARM_NEON_INTR],
|
cannam@154
|
731 [test x"$OPUS_ARM_MAY_HAVE_NEON_INTR" = x"1"])
|
cannam@154
|
732 AM_CONDITIONAL([HAVE_ARM_NE10],
|
cannam@154
|
733 [test x"$HAVE_ARM_NE10" = x"1"])
|
cannam@154
|
734 AM_CONDITIONAL([HAVE_SSE],
|
cannam@154
|
735 [test x"$OPUS_X86_MAY_HAVE_SSE" = x"1"])
|
cannam@154
|
736 AM_CONDITIONAL([HAVE_SSE2],
|
cannam@154
|
737 [test x"$OPUS_X86_MAY_HAVE_SSE2" = x"1"])
|
cannam@154
|
738 AM_CONDITIONAL([HAVE_SSE4_1],
|
cannam@154
|
739 [test x"$OPUS_X86_MAY_HAVE_SSE4_1" = x"1"])
|
cannam@154
|
740 AM_CONDITIONAL([HAVE_AVX],
|
cannam@154
|
741 [test x"$OPUS_X86_MAY_HAVE_AVX" = x"1"])
|
cannam@154
|
742
|
cannam@154
|
743 AS_IF([test x"$enable_rtcd" = x"yes"],[
|
cannam@154
|
744 AS_IF([test x"$rtcd_support" != x"no"],[
|
cannam@154
|
745 AC_DEFINE([OPUS_HAVE_RTCD], [1],
|
cannam@154
|
746 [Use run-time CPU capabilities detection])
|
cannam@154
|
747 OPUS_HAVE_RTCD=1
|
cannam@154
|
748 AC_SUBST(OPUS_HAVE_RTCD)
|
cannam@154
|
749 ])
|
cannam@154
|
750 ],[
|
cannam@154
|
751 rtcd_support="disabled"
|
cannam@154
|
752 ])
|
cannam@154
|
753
|
cannam@154
|
754 AC_ARG_ENABLE([assertions],
|
cannam@154
|
755 [AS_HELP_STRING([--enable-assertions],[enable additional software error checking])],,
|
cannam@154
|
756 [enable_assertions=no])
|
cannam@154
|
757
|
cannam@154
|
758 AS_IF([test "$enable_assertions" = "yes"], [
|
cannam@154
|
759 AC_DEFINE([ENABLE_ASSERTIONS], [1], [Assertions])
|
cannam@154
|
760 ])
|
cannam@154
|
761
|
cannam@154
|
762 AC_ARG_ENABLE([hardening],
|
cannam@154
|
763 [AS_HELP_STRING([--disable-hardening],[disable run-time checks that are cheap and safe for use in production])],,
|
cannam@154
|
764 [enable_hardening=yes])
|
cannam@154
|
765
|
cannam@154
|
766 AS_IF([test "$enable_hardening" = "yes"], [
|
cannam@154
|
767 AC_DEFINE([ENABLE_HARDENING], [1], [Hardening])
|
cannam@154
|
768 ])
|
cannam@154
|
769
|
cannam@154
|
770 AC_ARG_ENABLE([fuzzing],
|
cannam@154
|
771 [AS_HELP_STRING([--enable-fuzzing],[causes the encoder to make random decisions (do not use in production)])],,
|
cannam@154
|
772 [enable_fuzzing=no])
|
cannam@154
|
773
|
cannam@154
|
774 AS_IF([test "$enable_fuzzing" = "yes"], [
|
cannam@154
|
775 AC_DEFINE([FUZZING], [1], [Fuzzing])
|
cannam@154
|
776 ])
|
cannam@154
|
777
|
cannam@154
|
778 AC_ARG_ENABLE([check-asm],
|
cannam@154
|
779 [AS_HELP_STRING([--enable-check-asm],
|
cannam@154
|
780 [enable bit-exactness checks between optimized and c implementations])],,
|
cannam@154
|
781 [enable_check_asm=no])
|
cannam@154
|
782
|
cannam@154
|
783 AS_IF([test "$enable_check_asm" = "yes"], [
|
cannam@154
|
784 AC_DEFINE([OPUS_CHECK_ASM], [1], [Run bit-exactness checks between optimized and c implementations])
|
cannam@154
|
785 ])
|
cannam@154
|
786
|
cannam@154
|
787 AC_ARG_ENABLE([doc],
|
cannam@154
|
788 [AS_HELP_STRING([--disable-doc], [Do not build API documentation])],,
|
cannam@154
|
789 [enable_doc=yes])
|
cannam@154
|
790
|
cannam@154
|
791 AS_IF([test "$enable_doc" = "yes"], [
|
cannam@154
|
792 AC_CHECK_PROG(HAVE_DOXYGEN, [doxygen], [yes], [no])
|
cannam@154
|
793 AC_CHECK_PROG(HAVE_DOT, [dot], [yes], [no])
|
cannam@154
|
794 ],[
|
cannam@154
|
795 HAVE_DOXYGEN=no
|
cannam@154
|
796 ])
|
cannam@154
|
797
|
cannam@154
|
798 AM_CONDITIONAL([HAVE_DOXYGEN], [test "$HAVE_DOXYGEN" = "yes"])
|
cannam@154
|
799
|
cannam@154
|
800 AC_ARG_ENABLE([extra-programs],
|
cannam@154
|
801 [AS_HELP_STRING([--disable-extra-programs], [Do not build extra programs (demo and tests)])],,
|
cannam@154
|
802 [enable_extra_programs=yes])
|
cannam@154
|
803
|
cannam@154
|
804 AM_CONDITIONAL([EXTRA_PROGRAMS], [test "$enable_extra_programs" = "yes"])
|
cannam@154
|
805
|
cannam@154
|
806
|
cannam@154
|
807 AC_ARG_ENABLE([rfc8251],
|
cannam@154
|
808 AS_HELP_STRING([--disable-rfc8251], [Disable bitstream fixes from RFC 8251]),,
|
cannam@154
|
809 [enable_rfc8251=yes])
|
cannam@154
|
810
|
cannam@154
|
811 AS_IF([test "$enable_rfc8251" = "no"], [
|
cannam@154
|
812 AC_DEFINE([DISABLE_UPDATE_DRAFT], [1], [Disable bitstream fixes from RFC 8251])
|
cannam@154
|
813 ])
|
cannam@154
|
814
|
cannam@154
|
815
|
cannam@154
|
816 saved_CFLAGS="$CFLAGS"
|
cannam@154
|
817 CFLAGS="$CFLAGS -fvisibility=hidden"
|
cannam@154
|
818 AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
|
cannam@154
|
819 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
|
cannam@154
|
820 [ AC_MSG_RESULT([yes]) ],
|
cannam@154
|
821 [ AC_MSG_RESULT([no])
|
cannam@154
|
822 CFLAGS="$saved_CFLAGS"
|
cannam@154
|
823 ])
|
cannam@154
|
824
|
cannam@154
|
825 on_x86=no
|
cannam@154
|
826 case "$host_cpu" in
|
cannam@154
|
827 i[[3456]]86 | x86_64)
|
cannam@154
|
828 on_x86=yes
|
cannam@154
|
829 ;;
|
cannam@154
|
830 esac
|
cannam@154
|
831
|
cannam@154
|
832 on_windows=no
|
cannam@154
|
833 case $host in
|
cannam@154
|
834 *cygwin*|*mingw*)
|
cannam@154
|
835 on_windows=yes
|
cannam@154
|
836 ;;
|
cannam@154
|
837 esac
|
cannam@154
|
838
|
cannam@154
|
839 dnl Enable stack-protector-all only on x86 where it's well supported.
|
cannam@154
|
840 dnl on some platforms it causes crashes. Hopefully the OS's default's
|
cannam@154
|
841 dnl include this on platforms that work but have been missed here.
|
cannam@154
|
842 AC_ARG_ENABLE([stack-protector],
|
cannam@154
|
843 [AS_HELP_STRING([--disable-stack-protector],[Disable compiler stack hardening])],,
|
cannam@154
|
844 [
|
cannam@154
|
845 AS_IF([test "$ac_cv_c_compiler_gnu" = "yes" && test "$on_x86" = "yes" && test "$on_windows" = "no"],
|
cannam@154
|
846 [enable_stack_protector=yes],[enable_stack_protector=no])
|
cannam@154
|
847 ])
|
cannam@154
|
848
|
cannam@154
|
849 AS_IF([test "$enable_stack_protector" = "yes"],
|
cannam@154
|
850 [
|
cannam@154
|
851 saved_CFLAGS="$CFLAGS"
|
cannam@154
|
852 CFLAGS="$CFLAGS -fstack-protector-strong"
|
cannam@154
|
853 AC_MSG_CHECKING([if ${CC} supports -fstack-protector-strong])
|
cannam@154
|
854 AC_LINK_IFELSE([AC_LANG_PROGRAM([],[[char foo;]])],
|
cannam@154
|
855 [ AC_MSG_RESULT([yes]) ],
|
cannam@154
|
856 [
|
cannam@154
|
857 AC_MSG_RESULT([no])
|
cannam@154
|
858 enable_stack_protector=no
|
cannam@154
|
859 CFLAGS="$saved_CFLAGS"
|
cannam@154
|
860 ])
|
cannam@154
|
861 ])
|
cannam@154
|
862
|
cannam@154
|
863 AS_IF([test x$ac_cv_c_compiler_gnu = xyes],
|
cannam@154
|
864 [AX_ADD_FORTIFY_SOURCE]
|
cannam@154
|
865 )
|
cannam@154
|
866
|
cannam@154
|
867 CFLAGS="$CFLAGS -W"
|
cannam@154
|
868
|
cannam@154
|
869 warn_CFLAGS="-Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes"
|
cannam@154
|
870 saved_CFLAGS="$CFLAGS"
|
cannam@154
|
871 CFLAGS="$CFLAGS $warn_CFLAGS"
|
cannam@154
|
872 AC_MSG_CHECKING([if ${CC} supports ${warn_CFLAGS}])
|
cannam@154
|
873 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
|
cannam@154
|
874 [ AC_MSG_RESULT([yes]) ],
|
cannam@154
|
875 [ AC_MSG_RESULT([no])
|
cannam@154
|
876 CFLAGS="$saved_CFLAGS"
|
cannam@154
|
877 ])
|
cannam@154
|
878
|
cannam@154
|
879 saved_LIBS="$LIBS"
|
cannam@154
|
880 LIBS="$LIBS $LIBM"
|
cannam@154
|
881 AC_CHECK_FUNCS([lrintf])
|
cannam@154
|
882 AC_CHECK_FUNCS([lrint])
|
cannam@154
|
883 LIBS="$saved_LIBS"
|
cannam@154
|
884
|
cannam@154
|
885 AC_CHECK_FUNCS([__malloc_hook])
|
cannam@154
|
886
|
cannam@154
|
887 AC_SUBST([PC_BUILD])
|
cannam@154
|
888
|
cannam@154
|
889 AC_CONFIG_FILES([
|
cannam@154
|
890 Makefile
|
cannam@154
|
891 opus.pc
|
cannam@154
|
892 opus-uninstalled.pc
|
cannam@154
|
893 celt/arm/armopts.s
|
cannam@154
|
894 doc/Makefile
|
cannam@154
|
895 doc/Doxyfile
|
cannam@154
|
896 ])
|
cannam@154
|
897 AC_CONFIG_HEADERS([config.h])
|
cannam@154
|
898
|
cannam@154
|
899 AC_OUTPUT
|
cannam@154
|
900
|
cannam@154
|
901 AC_MSG_NOTICE([
|
cannam@154
|
902 ------------------------------------------------------------------------
|
cannam@154
|
903 $PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK.
|
cannam@154
|
904
|
cannam@154
|
905 Compiler support:
|
cannam@154
|
906
|
cannam@154
|
907 C99 var arrays: ................ ${has_var_arrays}
|
cannam@154
|
908 C99 lrintf: .................... ${ac_cv_func_lrintf}
|
cannam@154
|
909 Use alloca: .................... ${use_alloca}
|
cannam@154
|
910
|
cannam@154
|
911 General configuration:
|
cannam@154
|
912
|
cannam@154
|
913 Floating point support: ........ ${enable_float}
|
cannam@154
|
914 Fast float approximations: ..... ${enable_float_approx}
|
cannam@154
|
915 Fixed point debugging: ......... ${enable_fixed_point_debug}
|
cannam@154
|
916 Inline Assembly Optimizations: . ${inline_optimization}
|
cannam@154
|
917 External Assembly Optimizations: ${asm_optimization}
|
cannam@154
|
918 Intrinsics Optimizations: ...... ${intrinsics_support}
|
cannam@154
|
919 Run-time CPU detection: ........ ${rtcd_support}
|
cannam@154
|
920 Custom modes: .................. ${enable_custom_modes}
|
cannam@154
|
921 Assertion checking: ............ ${enable_assertions}
|
cannam@154
|
922 Hardening: ..................... ${enable_hardening}
|
cannam@154
|
923 Fuzzing: ....................... ${enable_fuzzing}
|
cannam@154
|
924 Check ASM: ..................... ${enable_check_asm}
|
cannam@154
|
925
|
cannam@154
|
926 API documentation: ............. ${enable_doc}
|
cannam@154
|
927 Extra programs: ................ ${enable_extra_programs}
|
cannam@154
|
928 ------------------------------------------------------------------------
|
cannam@154
|
929
|
cannam@154
|
930 Type "make; make install" to compile and install
|
cannam@154
|
931 Type "make check" to run the test suite
|
cannam@154
|
932 ])
|
cannam@154
|
933
|