1dnl Process this file with autoconf to produce a configure script. -*-m4-*- 2 3dnl The package_version file will be automatically synced to the git revision 4dnl by the update_version script when configured in the repository, but will 5dnl remain constant in tarball releases unless it is manually edited. 6m4_define([CURRENT_VERSION], 7 m4_esyscmd([ ./update_version 2>/dev/null || true 8 if test -e package_version; then 9 . ./package_version 10 printf "$PACKAGE_VERSION" 11 else 12 printf "unknown" 13 fi ])) 14 15AC_INIT([opus],[CURRENT_VERSION],[[email protected]]) 16 17AC_CONFIG_SRCDIR(src/opus_encoder.c) 18AC_CONFIG_MACRO_DIR([m4]) 19 20dnl enable silent rules on automake 1.11 and later 21m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 22 23# For libtool. 24dnl Please update these for releases. 25OPUS_LT_CURRENT=10 26OPUS_LT_REVISION=0 27OPUS_LT_AGE=10 28 29AC_SUBST(OPUS_LT_CURRENT) 30AC_SUBST(OPUS_LT_REVISION) 31AC_SUBST(OPUS_LT_AGE) 32 33AM_INIT_AUTOMAKE([no-define]) 34AM_MAINTAINER_MODE([enable]) 35 36AC_CANONICAL_HOST 37AC_MINGW32 38AM_PROG_LIBTOOL 39AM_PROG_CC_C_O 40 41AC_PROG_CC_C99 42AC_C_CONST 43AC_C_INLINE 44 45AM_PROG_AS 46 47AC_DEFINE([OPUS_BUILD], [], [This is a build of OPUS]) 48 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) 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. 53AC_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; 59 int foo (int_ptr $ac_kw ip, int * $ac_kw baz[]) { 60 return ip[0]; 61 }]], 62 [[int s[1]; 63 int * $ac_kw t = s; 64 t[0] = 0; 65 return foo(t, (void *)0)]])], 66 [ac_cv_c_restrict=$ac_kw]) 67 test "$ac_cv_c_restrict" != no && break 68 done 69 ]) 70 71AH_VERBATIM([restrict], 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]) 85 86case $ac_cv_c_restrict in 87 restrict) ;; 88 no) AC_DEFINE([restrict], []) ;; 89 *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; 90esac 91 92AC_MSG_CHECKING(for C99 variable-size arrays) 93AC_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 ]) 101AC_MSG_RESULT([$has_var_arrays]) 102 103AS_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 ]) 116 117LT_LIB_M 118 119AC_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 124AS_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" 131]) 132 133AM_CONDITIONAL([FIXED_POINT], [test "$enable_fixed_point" = "yes"]) 134 135AC_ARG_ENABLE([fixed-point-debug], 136 [AS_HELP_STRING([--enable-fixed-point-debug], [debug fixed-point implementation])],, 137 [enable_fixed_point_debug=no]) 138 139AS_IF([test "$enable_fixed_point_debug" = "yes"],[ 140 AC_DEFINE([FIXED_DEBUG], [1], [Debug fixed-point implementation]) 141]) 142 143AC_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 148AM_CONDITIONAL([DISABLE_FLOAT_API], [test "$enable_float_api" = "no"]) 149 150AS_IF([test "$enable_float_api" = "no"],[ 151 AC_DEFINE([DISABLE_FLOAT_API], [1], [Do not build the float API]) 152]) 153 154AC_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 158AS_IF([test "$enable_custom_modes" = "yes"],[ 159 AC_DEFINE([CUSTOM_MODES], [1], [Custom modes]) 160 PC_BUILD="$PC_BUILD, custom modes" 161]) 162 163AM_CONDITIONAL([CUSTOM_MODES], [test "$enable_custom_modes" = "yes"]) 164 165AC_ARG_ENABLE([dred], 166 [AS_HELP_STRING([--enable-dred], [Use Deep REDundancy (DRED)])],, 167 [enable_dred=no]) 168 169AS_IF([test "$enable_dred" = "yes"],[ 170 AC_DEFINE([ENABLE_DRED], [1], [DRED]) 171]) 172AM_CONDITIONAL([ENABLE_DRED], [test "$enable_dred" = "yes"]) 173 174AC_ARG_ENABLE([deep-plc], 175 [AS_HELP_STRING([--enable-deep-plc], [Use deep PLC for SILK])],, 176 [enable_deep_plc=no]) 177 178AS_IF([test "$enable_deep_plc" = "yes" || test "$enable_dred" = "yes" || test "$enable_osce" = "yes" || test "$enable_osce_training_data" = "yes"],[ 179 AC_DEFINE([ENABLE_DEEP_PLC], [1], [Deep PLC]) 180]) 181AM_CONDITIONAL([ENABLE_DEEP_PLC], [test "$enable_deep_plc" = "yes" || test "$enable_dred" = "yes" || test "$enable_osce" = "yes" || test "$enable_osce_training_data" = "yes"]) 182 183AC_ARG_ENABLE([lossgen], 184 [AS_HELP_STRING([--enable-lossgen], [Build opus_demo with packet loss simulator])],, 185 [enable_lossgen=no]) 186 187AS_IF([test "$enable_lossgen" = "yes"],[ 188 AC_DEFINE([ENABLE_LOSSGEN], [1], [LOSSGEN]) 189]) 190AM_CONDITIONAL([ENABLE_LOSSGEN], [test "$enable_lossgen" = "yes"]) 191 192has_float_approx=no 193case "$host_cpu" in 194i[[3456]]86 | x86_64 | arm* | aarch64* | powerpc64 | powerpc32 | ia64) 195 has_float_approx=yes 196 ;; 197esac 198 199AC_ARG_ENABLE([float-approx], 200 [AS_HELP_STRING([--enable-float-approx], [enable fast approximations for floating point])], 201 [if test "$enable_float_approx" = "yes"; then 202 AC_WARN([Floating point approximations are not supported on all platforms.]) 203 fi 204 ], 205 [enable_float_approx=$has_float_approx]) 206 207AS_IF([test "$enable_float_approx" = "yes"],[ 208 AC_DEFINE([FLOAT_APPROX], [1], [Float approximations]) 209]) 210 211AC_ARG_ENABLE([asm], 212 [AS_HELP_STRING([--disable-asm], [Disable assembly optimizations])],, 213 [enable_asm=yes]) 214 215AC_ARG_ENABLE([rtcd], 216 [AS_HELP_STRING([--disable-rtcd], [Disable run-time CPU capabilities detection])],, 217 [enable_rtcd=yes]) 218 219AC_ARG_ENABLE([intrinsics], 220 [AS_HELP_STRING([--disable-intrinsics], [Disable intrinsics optimizations])],, 221 [enable_intrinsics=yes]) 222 223rtcd_support=no 224cpu_arm=no 225cpu_x86=no 226 227AS_IF([test x"${enable_asm}" = x"yes"],[ 228 inline_optimization="No inline ASM for your platform, please send patches" 229 case $host_cpu in 230 arm*) 231 dnl Currently we only have asm for fixed-point 232 #AS_IF([test "$enable_float" != "yes"],[ 233 cpu_arm=yes 234 AC_DEFINE([OPUS_ARM_ASM], [], [Make use of ARM asm optimization]) 235 AS_GCC_INLINE_ASSEMBLY( 236 [inline_optimization="ARM"], 237 [inline_optimization="disabled"] 238 ) 239 AS_ASM_ARM_EDSP([OPUS_ARM_INLINE_EDSP=1],[OPUS_ARM_INLINE_EDSP=0]) 240 AS_ASM_ARM_MEDIA([OPUS_ARM_INLINE_MEDIA=1], 241 [OPUS_ARM_INLINE_MEDIA=0]) 242 AS_ASM_ARM_NEON([OPUS_ARM_INLINE_NEON=1],[OPUS_ARM_INLINE_NEON=0]) 243 AS_IF([test x"$inline_optimization" = x"ARM"],[ 244 AM_CONDITIONAL([OPUS_ARM_INLINE_ASM],[true]) 245 AC_DEFINE([OPUS_ARM_INLINE_ASM], 1, 246 [Use generic ARMv4 inline asm optimizations]) 247 AS_IF([test x"$OPUS_ARM_INLINE_EDSP" = x"1"],[ 248 AC_DEFINE([OPUS_ARM_INLINE_EDSP], [1], 249 [Use ARMv5E inline asm optimizations]) 250 inline_optimization="$inline_optimization (EDSP)" 251 ]) 252 AS_IF([test x"$OPUS_ARM_INLINE_MEDIA" = x"1"],[ 253 AC_DEFINE([OPUS_ARM_INLINE_MEDIA], [1], 254 [Use ARMv6 inline asm optimizations]) 255 inline_optimization="$inline_optimization (Media)" 256 ]) 257 AS_IF([test x"$OPUS_ARM_INLINE_NEON" = x"1"],[ 258 AC_DEFINE([OPUS_ARM_INLINE_NEON], 1, 259 [Use ARM NEON inline asm optimizations]) 260 inline_optimization="$inline_optimization (NEON)" 261 ]) 262 ]) 263 dnl We need Perl to translate RVCT-syntax asm to gas syntax. 264 AC_CHECK_PROG([HAVE_PERL], perl, yes, no) 265 AS_IF([test x"$HAVE_PERL" = x"yes"],[ 266 AM_CONDITIONAL([OPUS_ARM_EXTERNAL_ASM],[true]) 267 asm_optimization="ARM" 268 AS_IF([test x"$OPUS_ARM_INLINE_EDSP" = x"1"], [ 269 OPUS_ARM_PRESUME_EDSP=1 270 OPUS_ARM_MAY_HAVE_EDSP=1 271 ], 272 [ 273 OPUS_ARM_PRESUME_EDSP=0 274 OPUS_ARM_MAY_HAVE_EDSP=0 275 ]) 276 AS_IF([test x"$OPUS_ARM_INLINE_MEDIA" = x"1"], [ 277 OPUS_ARM_PRESUME_MEDIA=1 278 OPUS_ARM_MAY_HAVE_MEDIA=1 279 ], 280 [ 281 OPUS_ARM_PRESUME_MEDIA=0 282 OPUS_ARM_MAY_HAVE_MEDIA=0 283 ]) 284 AS_IF([test x"$OPUS_ARM_INLINE_NEON" = x"1"], [ 285 OPUS_ARM_PRESUME_NEON=1 286 OPUS_ARM_MAY_HAVE_NEON=1 287 ], 288 [ 289 OPUS_ARM_PRESUME_NEON=0 290 OPUS_ARM_MAY_HAVE_NEON=0 291 ]) 292 AS_IF([test x"$enable_rtcd" = x"yes"],[ 293 AS_IF([test x"$OPUS_ARM_MAY_HAVE_EDSP" != x"1"],[ 294 AC_MSG_NOTICE( 295 [Trying to force-enable armv5e EDSP instructions...]) 296 AS_ASM_ARM_EDSP_FORCE([OPUS_ARM_MAY_HAVE_EDSP=1]) 297 ]) 298 AS_IF([test x"$OPUS_ARM_MAY_HAVE_MEDIA" != x"1"],[ 299 AC_MSG_NOTICE( 300 [Trying to force-enable ARMv6 media instructions...]) 301 AS_ASM_ARM_MEDIA_FORCE([OPUS_ARM_MAY_HAVE_MEDIA=1]) 302 ]) 303 AS_IF([test x"$OPUS_ARM_MAY_HAVE_NEON" != x"1"],[ 304 AC_MSG_NOTICE( 305 [Trying to force-enable NEON instructions...]) 306 AS_ASM_ARM_NEON_FORCE([OPUS_ARM_MAY_HAVE_NEON=1]) 307 ]) 308 ]) 309 rtcd_support= 310 AS_IF([test x"$OPUS_ARM_MAY_HAVE_EDSP" = x"1"],[ 311 AC_DEFINE(OPUS_ARM_MAY_HAVE_EDSP, 1, 312 [Define if assembler supports EDSP instructions]) 313 AS_IF([test x"$OPUS_ARM_PRESUME_EDSP" = x"1"],[ 314 AC_DEFINE(OPUS_ARM_PRESUME_EDSP, 1, 315 [Define if binary requires EDSP instruction support]) 316 asm_optimization="$asm_optimization (EDSP)" 317 ], 318 [rtcd_support="$rtcd_support (EDSP)"] 319 ) 320 ]) 321 AC_SUBST(OPUS_ARM_MAY_HAVE_EDSP) 322 AS_IF([test x"$OPUS_ARM_MAY_HAVE_MEDIA" = x"1"],[ 323 AC_DEFINE(OPUS_ARM_MAY_HAVE_MEDIA, 1, 324 [Define if assembler supports ARMv6 media instructions]) 325 AS_IF([test x"$OPUS_ARM_PRESUME_MEDIA" = x"1"],[ 326 AC_DEFINE(OPUS_ARM_PRESUME_MEDIA, 1, 327 [Define if binary requires ARMv6 media instruction support]) 328 asm_optimization="$asm_optimization (Media)" 329 ], 330 [rtcd_support="$rtcd_support (Media)"] 331 ) 332 ]) 333 AC_SUBST(OPUS_ARM_MAY_HAVE_MEDIA) 334 AS_IF([test x"$OPUS_ARM_MAY_HAVE_NEON" = x"1"],[ 335 AC_DEFINE(OPUS_ARM_MAY_HAVE_NEON, 1, 336 [Define if compiler supports NEON instructions]) 337 AS_IF([test x"$OPUS_ARM_PRESUME_NEON" = x"1"], [ 338 AC_DEFINE(OPUS_ARM_PRESUME_NEON, 1, 339 [Define if binary requires NEON instruction support]) 340 asm_optimization="$asm_optimization (NEON)" 341 ], 342 [rtcd_support="$rtcd_support (NEON)"] 343 ) 344 ]) 345 AC_SUBST(OPUS_ARM_MAY_HAVE_NEON) 346 AS_IF([test x"$OPUS_ARM_MAY_HAVE_DOTPROD" = x"1"],[ 347 AC_DEFINE(OPUS_ARM_MAY_HAVE_DOTPROD, 1, 348 [Define if compiler supports DOTPROD instructions]) 349 AS_IF([test x"$OPUS_ARM_PRESUME_DOTPROD" = x"1"], [ 350 AC_DEFINE(OPUS_ARM_PRESUME_DOTPROD, 1, 351 [Define if binary requires DOTPROD instruction support]) 352 asm_optimization="$asm_optimization (DOTPROD)" 353 ], 354 [rtcd_support="$rtcd_support (DOTPROD)"] 355 ) 356 ]) 357 AC_SUBST(OPUS_ARM_MAY_HAVE_DOTPROD) 358 dnl Make sure turning on RTCD gets us at least one 359 dnl instruction set. 360 AS_IF([test x"$rtcd_support" != x""], 361 [rtcd_support=ARM"$rtcd_support"], 362 [rtcd_support="no"] 363 ) 364 AC_MSG_CHECKING([for apple style tools]) 365 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ 366#ifndef __APPLE__ 367#error 1 368#endif],[])], 369 [AC_MSG_RESULT([yes]); ARM2GNU_PARAMS="--apple"], 370 [AC_MSG_RESULT([no]); ARM2GNU_PARAMS=""]) 371 AC_SUBST(ARM2GNU_PARAMS) 372 ], 373 [ 374 AC_MSG_WARN( 375 [*** ARM assembly requires perl -- disabling optimizations]) 376 asm_optimization="(missing perl dependency for ARM)" 377 ]) 378 #]) 379 ;; 380 esac 381],[ 382 inline_optimization="disabled" 383 asm_optimization="disabled" 384]) 385 386AM_CONDITIONAL([OPUS_ARM_INLINE_ASM], 387 [test x"${inline_optimization%% *}" = x"ARM"]) 388AM_CONDITIONAL([OPUS_ARM_EXTERNAL_ASM], 389 [test x"${asm_optimization%% *}" = x"ARM"]) 390 391AM_CONDITIONAL([HAVE_SSE], [false]) 392AM_CONDITIONAL([HAVE_SSE2], [false]) 393AM_CONDITIONAL([HAVE_SSE4_1], [false]) 394AM_CONDITIONAL([HAVE_AVX2], [false]) 395 396m4_define([DEFAULT_X86_SSE_CFLAGS], [-msse]) 397m4_define([DEFAULT_X86_SSE2_CFLAGS], [-msse2]) 398m4_define([DEFAULT_X86_SSE4_1_CFLAGS], [-msse4.1]) 399m4_define([DEFAULT_X86_AVX2_CFLAGS], [-mavx -mfma -mavx2]) 400m4_define([DEFAULT_ARM_NEON_INTR_CFLAGS], [-mfpu=neon]) 401m4_define([DEFAULT_ARM_DOTPROD_INTR_CFLAGS], ["-march=armv8.2-a+dotprod"]) 402# With GCC on ARM32 softfp architectures (e.g. Android, or older Ubuntu) you need to specify 403# -mfloat-abi=softfp for -mfpu=neon to work. However, on ARM32 hardfp architectures (e.g. newer Ubuntu), 404# this option will break things. 405 406# As a heuristic, if host matches arm*eabi* but not arm*hf*, it's probably soft-float. 407m4_define([DEFAULT_ARM_NEON_SOFTFP_INTR_CFLAGS], [-mfpu=neon -mfloat-abi=softfp]) 408 409AS_CASE([$host], 410 [arm*hf*], [AS_VAR_SET([RESOLVED_DEFAULT_ARM_NEON_INTR_CFLAGS], "DEFAULT_ARM_NEON_INTR_CFLAGS")], 411 [arm*eabi*], [AS_VAR_SET([RESOLVED_DEFAULT_ARM_NEON_INTR_CFLAGS], "DEFAULT_ARM_NEON_SOFTFP_INTR_CFLAGS")], 412 [AS_VAR_SET([RESOLVED_DEFAULT_ARM_NEON_INTR_CFLAGS], "DEFAULT_ARM_NEON_INTR_CFLAGS")]) 413 414AC_ARG_VAR([X86_SSE_CFLAGS], [C compiler flags to compile SSE intrinsics @<:@default=]DEFAULT_X86_SSE_CFLAGS[@:>@]) 415AC_ARG_VAR([X86_SSE2_CFLAGS], [C compiler flags to compile SSE2 intrinsics @<:@default=]DEFAULT_X86_SSE2_CFLAGS[@:>@]) 416AC_ARG_VAR([X86_SSE4_1_CFLAGS], [C compiler flags to compile SSE4.1 intrinsics @<:@default=]DEFAULT_X86_SSE4_1_CFLAGS[@:>@]) 417AC_ARG_VAR([X86_AVX2_CFLAGS], [C compiler flags to compile AVX2 intrinsics @<:@default=]DEFAULT_X86_AVX2_CFLAGS[@:>@]) 418AC_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[@:>@]) 419AC_ARG_VAR([ARM_DOTPROD_INTR_CFLAGS], [C compiler flags to compile ARM DOTPROD intrinsics @<:@default=]DEFAULT_ARM_DOTPROD_INTR_CFLAGS[@:>@]) 420 421AS_VAR_SET_IF([X86_SSE_CFLAGS], [], [AS_VAR_SET([X86_SSE_CFLAGS], "DEFAULT_X86_SSE_CFLAGS")]) 422AS_VAR_SET_IF([X86_SSE2_CFLAGS], [], [AS_VAR_SET([X86_SSE2_CFLAGS], "DEFAULT_X86_SSE2_CFLAGS")]) 423AS_VAR_SET_IF([X86_SSE4_1_CFLAGS], [], [AS_VAR_SET([X86_SSE4_1_CFLAGS], "DEFAULT_X86_SSE4_1_CFLAGS")]) 424AS_VAR_SET_IF([X86_AVX2_CFLAGS], [], [AS_VAR_SET([X86_AVX2_CFLAGS], "DEFAULT_X86_AVX2_CFLAGS")]) 425AS_VAR_SET_IF([ARM_NEON_INTR_CFLAGS], [], [AS_VAR_SET([ARM_NEON_INTR_CFLAGS], ["$RESOLVED_DEFAULT_ARM_NEON_INTR_CFLAGS"])]) 426AS_VAR_SET_IF([ARM_DOTPROD_INTR_CFLAGS], [], [AS_VAR_SET([ARM_DOTPROD_INTR_CFLAGS], ["DEFAULT_ARM_DOTPROD_INTR_CFLAGS"])]) 427 428AC_DEFUN([OPUS_PATH_NE10], 429 [ 430 AC_ARG_WITH(NE10, 431 AC_HELP_STRING([--with-NE10=PFX],[Prefix where libNE10 is installed (optional)]), 432 NE10_prefix="$withval", NE10_prefix="") 433 AC_ARG_WITH(NE10-libraries, 434 AC_HELP_STRING([--with-NE10-libraries=DIR], 435 [Directory where libNE10 library is installed (optional)]), 436 NE10_libraries="$withval", NE10_libraries="") 437 AC_ARG_WITH(NE10-includes, 438 AC_HELP_STRING([--with-NE10-includes=DIR], 439 [Directory where libNE10 header files are installed (optional)]), 440 NE10_includes="$withval", NE10_includes="") 441 442 if test "x$NE10_libraries" != "x" ; then 443 NE10_LIBS="-L$NE10_libraries" 444 elif test "x$NE10_prefix" = "xno" || test "x$NE10_prefix" = "xyes" ; then 445 NE10_LIBS="" 446 elif test "x$NE10_prefix" != "x" ; then 447 NE10_LIBS="-L$NE10_prefix/lib" 448 elif test "x$prefix" != "xNONE" ; then 449 NE10_LIBS="-L$prefix/lib" 450 fi 451 452 if test "x$NE10_prefix" != "xno" ; then 453 NE10_LIBS="$NE10_LIBS -lNE10" 454 fi 455 456 if test "x$NE10_includes" != "x" ; then 457 NE10_CFLAGS="-I$NE10_includes" 458 elif test "x$NE10_prefix" = "xno" || test "x$NE10_prefix" = "xyes" ; then 459 NE10_CFLAGS="" 460 elif test "x$NE10_prefix" != "x" ; then 461 NE10_CFLAGS="-I$NE10_prefix/include" 462 elif test "x$prefix" != "xNONE"; then 463 NE10_CFLAGS="-I$prefix/include" 464 fi 465 466 AC_MSG_CHECKING(for NE10) 467 save_CFLAGS="$CFLAGS"; CFLAGS="$CFLAGS $NE10_CFLAGS" 468 save_LIBS="$LIBS"; LIBS="$LIBS $NE10_LIBS $LIBM" 469 AC_LINK_IFELSE( 470 [ 471 AC_LANG_PROGRAM( 472 [[#include <NE10_dsp.h> 473 ]], 474 [[ 475 ne10_fft_cfg_float32_t cfg; 476 cfg = ne10_fft_alloc_c2c_float32_neon(480); 477 ]] 478 ) 479 ],[ 480 HAVE_ARM_NE10=1 481 AC_MSG_RESULT([yes]) 482 ],[ 483 HAVE_ARM_NE10=0 484 AC_MSG_RESULT([no]) 485 NE10_CFLAGS="" 486 NE10_LIBS="" 487 ] 488 ) 489 CFLAGS="$save_CFLAGS"; LIBS="$save_LIBS" 490 #Now we know if libNE10 is installed or not 491 AS_IF([test x"$HAVE_ARM_NE10" = x"1"], 492 [ 493 AC_DEFINE([HAVE_ARM_NE10], 1, [NE10 library is installed on host. Make sure it is on target!]) 494 AC_SUBST(HAVE_ARM_NE10) 495 AC_SUBST(NE10_CFLAGS) 496 AC_SUBST(NE10_LIBS) 497 ] 498 ) 499 ] 500) 501 502AS_IF([test x"$enable_intrinsics" = x"yes"],[ 503 intrinsics_support="" 504 AS_CASE([$host_cpu], 505 [arm*|aarch64*], 506 [ 507 cpu_arm=yes 508 OPUS_CHECK_INTRINSICS( 509 [ARM Neon], 510 [$ARM_NEON_INTR_CFLAGS], 511 [OPUS_ARM_MAY_HAVE_NEON_INTR], 512 [OPUS_ARM_PRESUME_NEON_INTR], 513 [[#include <arm_neon.h> 514 ]], 515 [[ 516 static float32x4_t A0, A1, SUMM; 517 SUMM = vmlaq_f32(SUMM, A0, A1); 518 return (int)vgetq_lane_f32(SUMM, 0); 519 ]] 520 ) 521 AS_IF([test x"$OPUS_ARM_MAY_HAVE_NEON_INTR" = x"1" && test x"$OPUS_ARM_PRESUME_NEON_INTR" != x"1"], 522 [ 523 OPUS_ARM_NEON_INTR_CFLAGS="$ARM_NEON_INTR_CFLAGS" 524 AC_SUBST([OPUS_ARM_NEON_INTR_CFLAGS]) 525 ] 526 ) 527 528 AS_IF([test x"$OPUS_ARM_MAY_HAVE_NEON_INTR" = x"1"], 529 [ 530 AC_DEFINE([OPUS_ARM_MAY_HAVE_NEON_INTR], 1, [Compiler supports ARMv7/Aarch64 Neon Intrinsics]) 531 intrinsics_support="$intrinsics_support (NEON)" 532 533 AS_IF([test x"$enable_rtcd" != x"no" && test x"$OPUS_ARM_PRESUME_NEON_INTR" != x"1"], 534 [AS_IF([test x"$rtcd_support" = x"no"], 535 [rtcd_support="ARM (NEON Intrinsics)"], 536 [rtcd_support="$rtcd_support (NEON Intrinsics)"])]) 537 538 AS_IF([test x"$OPUS_ARM_PRESUME_NEON_INTR" = x"1"], 539 [AC_DEFINE([OPUS_ARM_PRESUME_NEON_INTR], 1, [Define if binary requires NEON intrinsics support])]) 540 541 OPUS_PATH_NE10() 542 AS_IF([test x"$NE10_LIBS" != x""], 543 [ 544 intrinsics_support="$intrinsics_support (NE10)" 545 AS_IF([test x"enable_rtcd" != x"" \ 546 && test x"$OPUS_ARM_PRESUME_NEON_INTR" != x"1"], 547 [rtcd_support="$rtcd_support (NE10)"]) 548 ]) 549 550 OPUS_CHECK_INTRINSICS( 551 [Aarch64 Neon], 552 [$ARM_NEON_INTR_CFLAGS], 553 [OPUS_ARM_MAY_HAVE_AARCH64_NEON_INTR], 554 [OPUS_ARM_PRESUME_AARCH64_NEON_INTR], 555 [[#include <arm_neon.h> 556 ]], 557 [[ 558 static int32_t IN; 559 static int16_t OUT; 560 OUT = vqmovns_s32(IN); 561 ]] 562 ) 563 564 AS_IF([test x"$OPUS_ARM_PRESUME_AARCH64_NEON_INTR" = x"1"], 565 [ 566 AC_DEFINE([OPUS_ARM_PRESUME_AARCH64_NEON_INTR], 1, [Define if binary requires Aarch64 Neon Intrinsics]) 567 intrinsics_support="$intrinsics_support (NEON [Aarch64])" 568 ]) 569 570 OPUS_CHECK_INTRINSICS( 571 [Aarch64 dotprod], 572 [$ARM_DOTPROD_INTR_CFLAGS], 573 [OPUS_ARM_MAY_HAVE_DOTPROD], 574 [OPUS_ARM_PRESUME_DOTPROD], 575 [[#include <arm_neon.h> 576 ]], 577 [[ 578 static int32x4_t acc; 579 static int8x16_t a, b; 580 acc = vdotq_s32(acc, a, b); 581 ]] 582 ) 583 AS_IF([test x"$OPUS_ARM_MAY_HAVE_DOTPROD" = x"1" && test x"$OPUS_ARM_PRESUME_DOTPROD" != x"1"], 584 [ 585 OPUS_ARM_DOTPROD_INTR_CFLAGS="$ARM_NEON_DOTPROD_CFLAGS" 586 AC_SUBST([OPUS_ARM_DOTPROD_INTR_CFLAGS]) 587 ] 588 ) 589 590 AS_IF([test x"$OPUS_ARM_MAY_HAVE_DOTPROD" = x"1"], 591 [ 592 AC_DEFINE([OPUS_ARM_MAY_HAVE_DOTPROD], 1, [Compiler supports Aarch64 DOTPROD Intrinsics]) 593 intrinsics_support="$intrinsics_support (DOTPROD)" 594 595 AS_IF([test x"$OPUS_ARM_PRESUME_DOTPROD" = x"1"], 596 [ 597 AC_DEFINE([OPUS_ARM_PRESUME_DOTPROD], 1, [Define if binary requires Aarch64 dotprod Intrinsics]) 598 intrinsics_support="$intrinsics_support (DOTPROD [Aarch64])" 599 ]) 600 601 AS_IF([test x"$enable_rtcd" != x"no" && test x"$OPUS_ARM_PRESUME_DOTPROD" != x"1"], 602 [AS_IF([test x"$rtcd_support" = x"no"], 603 [rtcd_support="ARM (DOTPROD Intrinsics)"], 604 [rtcd_support="$rtcd_support (DOTPROD Intrinsics)"])]) 605 606 ] 607 ) 608 609 610 AS_IF([test x"$intrinsics_support" = x""], 611 [intrinsics_support=no], 612 [intrinsics_support="ARM$intrinsics_support"]) 613 ], 614 [ 615 AC_MSG_WARN([Compiler does not support ARM intrinsics]) 616 intrinsics_support=no 617 ]) 618 ], 619 [i?86|x86_64], 620 [ 621 cpu_x86=yes 622 OPUS_CHECK_INTRINSICS( 623 [SSE], 624 [$X86_SSE_CFLAGS], 625 [OPUS_X86_MAY_HAVE_SSE], 626 [OPUS_X86_PRESUME_SSE], 627 [[#include <xmmintrin.h> 628 #include <time.h> 629 ]], 630 [[ 631 __m128 mtest; 632 mtest = _mm_set1_ps((float)time(NULL)); 633 mtest = _mm_mul_ps(mtest, mtest); 634 return _mm_cvtss_si32(mtest); 635 ]] 636 ) 637 AS_IF([test x"$OPUS_X86_MAY_HAVE_SSE" = x"1" && test x"$OPUS_X86_PRESUME_SSE" != x"1"], 638 [ 639 OPUS_X86_SSE_CFLAGS="$X86_SSE_CFLAGS" 640 AC_SUBST([OPUS_X86_SSE_CFLAGS]) 641 ] 642 ) 643 OPUS_CHECK_INTRINSICS( 644 [SSE2], 645 [$X86_SSE2_CFLAGS], 646 [OPUS_X86_MAY_HAVE_SSE2], 647 [OPUS_X86_PRESUME_SSE2], 648 [[#include <emmintrin.h> 649 #include <time.h> 650 ]], 651 [[ 652 __m128i mtest; 653 mtest = _mm_set1_epi32((int)time(NULL)); 654 mtest = _mm_mul_epu32(mtest, mtest); 655 return _mm_cvtsi128_si32(mtest); 656 ]] 657 ) 658 AS_IF([test x"$OPUS_X86_MAY_HAVE_SSE2" = x"1" && test x"$OPUS_X86_PRESUME_SSE2" != x"1"], 659 [ 660 OPUS_X86_SSE2_CFLAGS="$X86_SSE2_CFLAGS" 661 AC_SUBST([OPUS_X86_SSE2_CFLAGS]) 662 ] 663 ) 664 OPUS_CHECK_INTRINSICS( 665 [SSE4.1], 666 [$X86_SSE4_1_CFLAGS], 667 [OPUS_X86_MAY_HAVE_SSE4_1], 668 [OPUS_X86_PRESUME_SSE4_1], 669 [[#include <smmintrin.h> 670 #include <time.h> 671 ]], 672 [[ 673 __m128i mtest; 674 mtest = _mm_set1_epi32((int)time(NULL)); 675 mtest = _mm_mul_epi32(mtest, mtest); 676 return _mm_cvtsi128_si32(mtest); 677 ]] 678 ) 679 AS_IF([test x"$OPUS_X86_MAY_HAVE_SSE4_1" = x"1" && test x"$OPUS_X86_PRESUME_SSE4_1" != x"1"], 680 [ 681 OPUS_X86_SSE4_1_CFLAGS="$X86_SSE4_1_CFLAGS" 682 AC_SUBST([OPUS_X86_SSE4_1_CFLAGS]) 683 ] 684 ) 685 OPUS_CHECK_INTRINSICS( 686 [AVX2], 687 [$X86_AVX2_CFLAGS], 688 [OPUS_X86_MAY_HAVE_AVX2], 689 [OPUS_X86_PRESUME_AVX2], 690 [[#include <immintrin.h> 691 #include <time.h> 692 ]], 693 [[ 694 unsigned char utest[[16]] = {1}; 695 __m256 mtest; 696 __m256i mtest1; 697 __m256i mtest2; 698 mtest = _mm256_set1_ps((float)time(NULL)); 699 mtest = _mm256_fmadd_ps(mtest, mtest, mtest); 700 mtest1 = _mm256_set_m128i(_mm_loadu_si64(utest), _mm_loadu_si64(utest)); 701 mtest2 = 702 _mm256_cvtepi16_epi32(_mm_loadu_si128((__m128i_u *)utest)); 703 return _mm256_extract_epi16(_mm256_xor_si256( 704 _mm256_xor_si256(mtest1, mtest2), _mm256_cvttps_epi32(mtest)), 0); 705 ]] 706 ) 707 AS_IF([test x"$OPUS_X86_MAY_HAVE_AVX2" = x"1" && test x"$OPUS_X86_PRESUME_AVX2" != x"1"], 708 [ 709 OPUS_X86_AVX2_CFLAGS="$X86_AVX2_CFLAGS" 710 AC_SUBST([OPUS_X86_AVX2_CFLAGS]) 711 ] 712 ) 713 AS_IF([test x"$rtcd_support" = x"no"], [rtcd_support=""]) 714 AS_IF([test x"$OPUS_X86_MAY_HAVE_SSE" = x"1"], 715 [ 716 AC_DEFINE([OPUS_X86_MAY_HAVE_SSE], 1, [Compiler supports X86 SSE Intrinsics]) 717 intrinsics_support="$intrinsics_support SSE" 718 719 AS_IF([test x"$OPUS_X86_PRESUME_SSE" = x"1"], 720 [AC_DEFINE([OPUS_X86_PRESUME_SSE], 1, [Define if binary requires SSE intrinsics support])], 721 [rtcd_support="$rtcd_support SSE"]) 722 ], 723 [ 724 AC_MSG_WARN([Compiler does not support SSE intrinsics]) 725 ]) 726 727 AS_IF([test x"$OPUS_X86_MAY_HAVE_SSE2" = x"1"], 728 [ 729 AC_DEFINE([OPUS_X86_MAY_HAVE_SSE2], 1, [Compiler supports X86 SSE2 Intrinsics]) 730 intrinsics_support="$intrinsics_support SSE2" 731 732 AS_IF([test x"$OPUS_X86_PRESUME_SSE2" = x"1"], 733 [AC_DEFINE([OPUS_X86_PRESUME_SSE2], 1, [Define if binary requires SSE2 intrinsics support])], 734 [rtcd_support="$rtcd_support SSE2"]) 735 ], 736 [ 737 AC_MSG_WARN([Compiler does not support SSE2 intrinsics]) 738 ]) 739 740 AS_IF([test x"$OPUS_X86_MAY_HAVE_SSE4_1" = x"1"], 741 [ 742 AC_DEFINE([OPUS_X86_MAY_HAVE_SSE4_1], 1, [Compiler supports X86 SSE4.1 Intrinsics]) 743 intrinsics_support="$intrinsics_support SSE4.1" 744 745 AS_IF([test x"$OPUS_X86_PRESUME_SSE4_1" = x"1"], 746 [AC_DEFINE([OPUS_X86_PRESUME_SSE4_1], 1, [Define if binary requires SSE4.1 intrinsics support])], 747 [rtcd_support="$rtcd_support SSE4.1"]) 748 ], 749 [ 750 AC_MSG_WARN([Compiler does not support SSE4.1 intrinsics]) 751 ]) 752 AS_IF([test x"$OPUS_X86_MAY_HAVE_AVX2" = x"1"], 753 [ 754 AC_DEFINE([OPUS_X86_MAY_HAVE_AVX2], 1, [Compiler supports X86 AVX2 Intrinsics]) 755 intrinsics_support="$intrinsics_support AVX2" 756 757 AS_IF([test x"$OPUS_X86_PRESUME_AVX2" = x"1"], 758 [AC_DEFINE([OPUS_X86_PRESUME_AVX2], 1, [Define if binary requires AVX2 intrinsics support])], 759 [rtcd_support="$rtcd_support AVX2"]) 760 ], 761 [ 762 AC_MSG_WARN([Compiler does not support AVX2 intrinsics]) 763 ]) 764 765 AS_IF([test x"$intrinsics_support" = x""], 766 [intrinsics_support=no], 767 [intrinsics_support="x86$intrinsics_support"] 768 ) 769 AS_IF([test x"$rtcd_support" = x""], 770 [rtcd_support=no], 771 [rtcd_support="x86$rtcd_support"], 772 ) 773 774 AS_IF([test x"$enable_rtcd" = x"yes" && test x"$rtcd_support" != x""],[ 775 get_cpuid_by_asm="no" 776 AC_MSG_CHECKING([How to get X86 CPU Info]) 777 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 778 #include <stdio.h> 779 ]],[[ 780 unsigned int CPUInfo0; 781 unsigned int CPUInfo1; 782 unsigned int CPUInfo2; 783 unsigned int CPUInfo3; 784 unsigned int InfoType; 785 #if defined(__i386__) && defined(__PIC__) 786 __asm__ __volatile__ ( 787 "xchg %%ebx, %1\n" 788 "cpuid\n" 789 "xchg %%ebx, %1\n": 790 "=a" (CPUInfo0), 791 "=r" (CPUInfo1), 792 "=c" (CPUInfo2), 793 "=d" (CPUInfo3) : 794 "a" (InfoType), "c" (0) 795 ); 796 #else 797 __asm__ __volatile__ ( 798 "cpuid": 799 "=a" (CPUInfo0), 800 "=b" (CPUInfo1), 801 "=c" (CPUInfo2), 802 "=d" (CPUInfo3) : 803 "a" (InfoType), "c" (0) 804 ); 805 #endif 806 ]])], 807 [get_cpuid_by_asm="yes" 808 AC_MSG_RESULT([Inline Assembly]) 809 AC_DEFINE([CPU_INFO_BY_ASM], [1], [Get CPU Info by asm method])], 810 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 811 #include <cpuid.h> 812 ]],[[ 813 unsigned int CPUInfo0; 814 unsigned int CPUInfo1; 815 unsigned int CPUInfo2; 816 unsigned int CPUInfo3; 817 unsigned int InfoType; 818 __get_cpuid_count(InfoType, 0, &CPUInfo0, &CPUInfo1, &CPUInfo2, &CPUInfo3); 819 ]])], 820 [AC_MSG_RESULT([C method]) 821 AC_DEFINE([CPU_INFO_BY_C], [1], [Get CPU Info by c method])], 822 [AC_MSG_ERROR([no supported Get CPU Info method, please disable run-time CPU capabilities detection or intrinsics])])])]) 823 ], 824 [ 825 AC_MSG_WARN([No intrinsics support for your architecture]) 826 intrinsics_support="no" 827 ]) 828], 829[ 830 intrinsics_support="no" 831]) 832 833AM_CONDITIONAL([CPU_ARM], [test "$cpu_arm" = "yes"]) 834AM_CONDITIONAL([HAVE_ARM_DOTPROD], 835 [test x"$OPUS_ARM_MAY_HAVE_DOTPROD" = x"1"]) 836AM_CONDITIONAL([HAVE_ARM_NEON_INTR], 837 [test x"$OPUS_ARM_MAY_HAVE_NEON_INTR" = x"1"]) 838AM_CONDITIONAL([HAVE_ARM_NE10], 839 [test x"$HAVE_ARM_NE10" = x"1"]) 840AM_CONDITIONAL([CPU_X86], [test "$cpu_x86" = "yes"]) 841AM_CONDITIONAL([HAVE_SSE], 842 [test x"$OPUS_X86_MAY_HAVE_SSE" = x"1"]) 843AM_CONDITIONAL([HAVE_SSE2], 844 [test x"$OPUS_X86_MAY_HAVE_SSE2" = x"1"]) 845AM_CONDITIONAL([HAVE_SSE4_1], 846 [test x"$OPUS_X86_MAY_HAVE_SSE4_1" = x"1"]) 847AM_CONDITIONAL([HAVE_AVX2], 848 [test x"$OPUS_X86_MAY_HAVE_AVX2" = x"1"]) 849 850AM_CONDITIONAL([HAVE_RTCD], 851 [test x"$enable_rtcd" = x"yes" -a x"$rtcd_support" != x"no"]) 852AS_IF([test x"$enable_rtcd" = x"yes"],[ 853 AS_IF([test x"$rtcd_support" != x"no"],[ 854 AC_DEFINE([OPUS_HAVE_RTCD], [1], 855 [Use run-time CPU capabilities detection]) 856 OPUS_HAVE_RTCD=1 857 AC_SUBST(OPUS_HAVE_RTCD) 858 ]) 859],[ 860 rtcd_support="disabled" 861]) 862 863AC_ARG_ENABLE([assertions], 864 [AS_HELP_STRING([--enable-assertions],[enable additional software error checking])],, 865 [enable_assertions=no]) 866 867AS_IF([test "$enable_assertions" = "yes"], [ 868 AC_DEFINE([ENABLE_ASSERTIONS], [1], [Assertions]) 869]) 870 871AC_ARG_ENABLE([hardening], 872 [AS_HELP_STRING([--disable-hardening],[disable run-time checks that are cheap and safe for use in production])],, 873 [enable_hardening=yes]) 874 875AS_IF([test "$enable_hardening" = "yes"], [ 876 AC_DEFINE([ENABLE_HARDENING], [1], [Hardening]) 877]) 878 879AC_ARG_ENABLE([fuzzing], 880 [AS_HELP_STRING([--enable-fuzzing],[causes the encoder to make random decisions (do not use in production)])],, 881 [enable_fuzzing=no]) 882 883AS_IF([test "$enable_fuzzing" = "yes"], [ 884 AC_DEFINE([FUZZING], [1], [Fuzzing]) 885]) 886 887AC_ARG_ENABLE([check-asm], 888 [AS_HELP_STRING([--enable-check-asm], 889 [enable bit-exactness checks between optimized and c implementations])],, 890 [enable_check_asm=no]) 891 892AS_IF([test "$enable_check_asm" = "yes"], [ 893 AC_DEFINE([OPUS_CHECK_ASM], [1], [Run bit-exactness checks between optimized and c implementations]) 894]) 895 896AC_ARG_ENABLE([doc], 897 [AS_HELP_STRING([--disable-doc], [Do not build API documentation])],, 898 [enable_doc=yes]) 899 900AS_IF([test "$enable_doc" = "yes"], [ 901 AC_CHECK_PROG(HAVE_DOXYGEN, [doxygen], [yes], [no]) 902 AC_CHECK_PROG(HAVE_DOT, [dot], [yes], [no]) 903],[ 904 HAVE_DOXYGEN=no 905]) 906 907AC_ARG_ENABLE([dot-product], 908 AS_HELP_STRING([--disable-dot-product], [Disable dot product implementation]),, 909 enable_dot_product=yes) 910 911AS_IF([test "$enable_dot_product" = "no"], [ 912 AC_DEFINE([DISABLE_DOT_PROD], [1], [Disable dot product instructions]) 913]) 914 915AC_ARG_ENABLE([dnn-debug-float], 916 AS_HELP_STRING([--enable-dnn-debug-float], [Use floating-point DNN computation everywhere]),, 917 enable_dnn_debug_float=no) 918 919AS_IF([test "$enable_dnn_debug_float" = "no"], [ 920 AC_DEFINE([DISABLE_DEBUG_FLOAT], [1], [Disable DNN debug float]) 921]) 922 923AC_ARG_ENABLE([osce-training-data], 924 AS_HELP_STRING([--enable-osce-training-data], [enables feature output for SILK enhancement]),, 925 [enable_osc_training_data=no] 926) 927 928AS_IF([test "$enable_osce_training_data" = "yes"], [ 929 AC_DEFINE([ENABLE_OSCE_TRAINING_DATA], [1], [Enable dumping of OSCE training data]) 930]) 931 932AC_MSG_CHECKING([argument osce training data]) 933AS_IF([test "$enable_osce_training_data" = "yes"], [ 934 AC_MSG_RESULT([yes]) 935], [AC_MSG_RESULT([no])]) 936 937AC_ARG_ENABLE([osce], 938 AS_HELP_STRING([--enable-osce], [enables speech coding enhancement]),, 939 [enable_osce=no] 940) 941 942AS_IF([test "$enable_osce" = "yes" || test "$enable_osce_training_data" = "yes"], [ 943 AC_DEFINE([ENABLE_OSCE], [1], [Enable Opus Speech Coding Enhancement]) 944]) 945 946AM_CONDITIONAL([ENABLE_OSCE], [test "$enable_osce" = "yes" || test "$enable_osce_training_data" = "yes"]) 947 948AM_CONDITIONAL([HAVE_DOXYGEN], [test "$HAVE_DOXYGEN" = "yes"]) 949 950AC_ARG_ENABLE([extra-programs], 951 [AS_HELP_STRING([--disable-extra-programs], [Do not build extra programs (demo and tests)])],, 952 [enable_extra_programs=yes]) 953 954AM_CONDITIONAL([EXTRA_PROGRAMS], [test "$enable_extra_programs" = "yes"]) 955 956 957AC_ARG_ENABLE([rfc8251], 958 AS_HELP_STRING([--disable-rfc8251], [Disable bitstream fixes from RFC 8251]),, 959 [enable_rfc8251=yes]) 960 961AS_IF([test "$enable_rfc8251" = "no"], [ 962 AC_DEFINE([DISABLE_UPDATE_DRAFT], [1], [Disable bitstream fixes from RFC 8251]) 963]) 964 965 966saved_CFLAGS="$CFLAGS" 967CFLAGS="$CFLAGS -fvisibility=hidden" 968AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) 969AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])], 970 [ AC_MSG_RESULT([yes]) ], 971 [ AC_MSG_RESULT([no]) 972 CFLAGS="$saved_CFLAGS" 973 ]) 974 975on_x86=no 976case "$host_cpu" in 977i[[3456]]86 | x86_64) 978 on_x86=yes 979 ;; 980esac 981 982on_windows=no 983case $host in 984*cygwin*|*mingw*) 985 on_windows=yes 986 ;; 987esac 988 989dnl Enable stack-protector-all only on x86 where it's well supported. 990dnl on some platforms it causes crashes. Hopefully the OS's default's 991dnl include this on platforms that work but have been missed here. 992AC_ARG_ENABLE([stack-protector], 993 [AS_HELP_STRING([--disable-stack-protector],[Disable compiler stack hardening])],, 994 [ 995 AS_IF([test "$ac_cv_c_compiler_gnu" = "yes" && test "$on_x86" = "yes" && test "$on_windows" = "no"], 996 [enable_stack_protector=yes],[enable_stack_protector=no]) 997 ]) 998 999AS_IF([test "$enable_stack_protector" = "yes"], 1000 [ 1001 saved_CFLAGS="$CFLAGS" 1002 CFLAGS="$CFLAGS -fstack-protector-strong" 1003 AC_MSG_CHECKING([if ${CC} supports -fstack-protector-strong]) 1004 AC_LINK_IFELSE([AC_LANG_PROGRAM([],[[char foo;]])], 1005 [ AC_MSG_RESULT([yes]) ], 1006 [ 1007 AC_MSG_RESULT([no]) 1008 enable_stack_protector=no 1009 CFLAGS="$saved_CFLAGS" 1010 ]) 1011 ]) 1012 1013AS_IF([test x$ac_cv_c_compiler_gnu = xyes], 1014 [AX_ADD_FORTIFY_SOURCE] 1015) 1016 1017CFLAGS="$CFLAGS -W" 1018 1019warn_CFLAGS="-Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes" 1020saved_CFLAGS="$CFLAGS" 1021CFLAGS="$CFLAGS $warn_CFLAGS" 1022AC_MSG_CHECKING([if ${CC} supports ${warn_CFLAGS}]) 1023AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])], 1024 [ AC_MSG_RESULT([yes]) ], 1025 [ AC_MSG_RESULT([no]) 1026 CFLAGS="$saved_CFLAGS" 1027 ]) 1028 1029saved_LIBS="$LIBS" 1030LIBS="$LIBS $LIBM" 1031AC_CHECK_FUNCS([lrintf]) 1032AC_CHECK_FUNCS([lrint]) 1033LIBS="$saved_LIBS" 1034 1035AC_CHECK_FUNCS([__malloc_hook]) 1036 1037AC_SUBST([PC_BUILD]) 1038 1039AC_CONFIG_FILES([ 1040 Makefile 1041 opus.pc 1042 opus-uninstalled.pc 1043 celt/arm/armopts.s 1044 doc/Makefile 1045 doc/Doxyfile 1046]) 1047AC_CONFIG_HEADERS([config.h]) 1048 1049AC_OUTPUT 1050 1051AC_MSG_NOTICE([ 1052------------------------------------------------------------------------ 1053 $PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK. 1054 1055 Compiler support: 1056 1057 C99 var arrays: ................ ${has_var_arrays} 1058 C99 lrintf: .................... ${ac_cv_func_lrintf} 1059 Use alloca: .................... ${use_alloca} 1060 1061 General configuration: 1062 1063 Floating point support: ........ ${enable_float} 1064 Fast float approximations: ..... ${enable_float_approx} 1065 Fixed point debugging: ......... ${enable_fixed_point_debug} 1066 Inline Assembly Optimizations: . ${inline_optimization} 1067 External Assembly Optimizations: ${asm_optimization} 1068 Intrinsics Optimizations: ...... ${intrinsics_support} 1069 Run-time CPU detection: ........ ${rtcd_support} 1070 Custom modes: .................. ${enable_custom_modes} 1071 Assertion checking: ............ ${enable_assertions} 1072 Hardening: ..................... ${enable_hardening} 1073 Fuzzing: ....................... ${enable_fuzzing} 1074 Check ASM: ..................... ${enable_check_asm} 1075 1076 API documentation: ............. ${enable_doc} 1077 Extra programs: ................ ${enable_extra_programs} 1078------------------------------------------------------------------------ 1079 1080 Type "make; make install" to compile and install 1081 Type "make check" to run the test suite 1082]) 1083 1084