annotate src/opus-1.3/configure.ac @ 84:08ae793730bd

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