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