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 | 65471dd | 2013-12-04 18:25:34 -0500 | [diff] [blame] | 25 | OPUS_LT_CURRENT=5 |
Jean-Marc Valin | e05aaf2 | 2011-04-29 19:48:42 -0400 | [diff] [blame] | 26 | OPUS_LT_REVISION=0 |
Jean-Marc Valin | 65471dd | 2013-12-04 18:25:34 -0500 | [diff] [blame] | 27 | OPUS_LT_AGE=5 |
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 | |
Timothy B. Terriberry | 39386e0 | 2013-11-18 13:30:13 -0500 | [diff] [blame] | 192 | rtcd_support=no |
| 193 | cpu_arm=no |
| 194 | |
| 195 | AS_IF([test x"${enable_asm}" = x"yes"],[ |
| 196 | inline_optimization="No ASM for your platform, please send patches" |
| 197 | case $host_cpu in |
| 198 | arm*) |
| 199 | dnl Currently we only have asm for fixed-point |
| 200 | AS_IF([test "$enable_float" != "yes"],[ |
| 201 | cpu_arm=yes |
| 202 | AC_DEFINE([OPUS_ARM_ASM], [], [Make use of ARM asm optimization]) |
| 203 | AS_GCC_INLINE_ASSEMBLY( |
| 204 | [inline_optimization="ARM"], |
| 205 | [inline_optimization="disabled"] |
| 206 | ) |
| 207 | AS_ASM_ARM_EDSP([OPUS_ARM_INLINE_EDSP=1],[OPUS_ARM_INLINE_EDSP=0]) |
| 208 | AS_ASM_ARM_MEDIA([OPUS_ARM_INLINE_MEDIA=1], |
| 209 | [OPUS_ARM_INLINE_MEDIA=0]) |
| 210 | AS_ASM_ARM_NEON([OPUS_ARM_INLINE_NEON=1],[OPUS_ARM_INLINE_NEON=0]) |
| 211 | AS_IF([test x"$inline_optimization" = x"ARM"],[ |
| 212 | AM_CONDITIONAL([OPUS_ARM_INLINE_ASM],[true]) |
| 213 | AC_DEFINE([OPUS_ARM_INLINE_ASM], 1, |
| 214 | [Use generic ARMv4 inline asm optimizations]) |
| 215 | AS_IF([test x"$OPUS_ARM_INLINE_EDSP" = x"1"],[ |
| 216 | AC_DEFINE([OPUS_ARM_INLINE_EDSP], [1], |
| 217 | [Use ARMv5E inline asm optimizations]) |
| 218 | inline_optimization="$inline_optimization (EDSP)" |
| 219 | ]) |
| 220 | AS_IF([test x"$OPUS_ARM_INLINE_MEDIA" = x"1"],[ |
| 221 | AC_DEFINE([OPUS_ARM_INLINE_MEDIA], [1], |
| 222 | [Use ARMv6 inline asm optimizations]) |
| 223 | inline_optimization="$inline_optimization (Media)" |
| 224 | ]) |
| 225 | AS_IF([test x"$OPUS_ARM_INLINE_NEON" = x"1"],[ |
| 226 | AC_DEFINE([OPUS_ARM_INLINE_NEON], 1, |
| 227 | [Use ARM NEON inline asm optimizations]) |
| 228 | inline_optimization="$inline_optimization (NEON)" |
| 229 | ]) |
| 230 | ]) |
| 231 | dnl We need Perl to translate RVCT-syntax asm to gas syntax. |
| 232 | AC_CHECK_PROG([HAVE_PERL], perl, yes, no) |
| 233 | AS_IF([test x"$HAVE_PERL" = x"yes"],[ |
| 234 | AM_CONDITIONAL([OPUS_ARM_EXTERNAL_ASM],[true]) |
| 235 | asm_optimization="ARM" |
| 236 | AS_IF([test x"$OPUS_ARM_INLINE_EDSP" = x"1"], [ |
| 237 | OPUS_ARM_PRESUME_EDSP=1 |
| 238 | OPUS_ARM_MAY_HAVE_EDSP=1 |
| 239 | ], |
| 240 | [ |
| 241 | OPUS_ARM_PRESUME_EDSP=0 |
| 242 | OPUS_ARM_MAY_HAVE_EDSP=0 |
| 243 | ]) |
| 244 | AS_IF([test x"$OPUS_ARM_INLINE_MEDIA" = x"1"], [ |
| 245 | OPUS_ARM_PRESUME_MEDIA=1 |
| 246 | OPUS_ARM_MAY_HAVE_MEDIA=1 |
| 247 | ], |
| 248 | [ |
| 249 | OPUS_ARM_PRESUME_MEDIA=0 |
| 250 | OPUS_ARM_MAY_HAVE_MEDIA=0 |
| 251 | ]) |
| 252 | AS_IF([test x"$OPUS_ARM_INLINE_NEON" = x"1"], [ |
| 253 | OPUS_ARM_PRESUME_NEON=1 |
| 254 | OPUS_ARM_MAY_HAVE_NEON=1 |
| 255 | ], |
| 256 | [ |
| 257 | OPUS_ARM_PRESUME_NEON=0 |
| 258 | OPUS_ARM_MAY_HAVE_NEON=0 |
| 259 | ]) |
| 260 | AS_IF([test x"$enable_rtcd" = x"yes"],[ |
| 261 | AS_IF([test x"$OPUS_ARM_MAY_HAVE_EDSP" != x"1"],[ |
| 262 | AC_MSG_NOTICE( |
| 263 | [Trying to force-enable armv5e EDSP instructions...]) |
| 264 | AS_ASM_ARM_EDSP_FORCE([OPUS_ARM_MAY_HAVE_EDSP=1]) |
| 265 | ]) |
| 266 | AS_IF([test x"$OPUS_ARM_MAY_HAVE_MEDIA" != x"1"],[ |
| 267 | AC_MSG_NOTICE( |
| 268 | [Trying to force-enable ARMv6 media instructions...]) |
| 269 | AS_ASM_ARM_MEDIA_FORCE([OPUS_ARM_MAY_HAVE_MEDIA=1]) |
| 270 | ]) |
| 271 | AS_IF([test x"$OPUS_ARM_MAY_HAVE_NEON" != x"1"],[ |
| 272 | AC_MSG_NOTICE( |
| 273 | [Trying to force-enable NEON instructions...]) |
| 274 | AS_ASM_ARM_NEON_FORCE([OPUS_ARM_MAY_HAVE_NEON=1]) |
| 275 | ]) |
| 276 | ]) |
| 277 | rtcd_support= |
| 278 | AS_IF([test x"$OPUS_ARM_MAY_HAVE_EDSP" = x"1"],[ |
| 279 | AC_DEFINE(OPUS_ARM_MAY_HAVE_EDSP, 1, |
| 280 | [Define if assembler supports EDSP instructions]) |
| 281 | AS_IF([test x"$OPUS_ARM_PRESUME_EDSP" = x"1"],[ |
| 282 | AC_DEFINE(OPUS_ARM_PRESUME_EDSP, 1, |
| 283 | [Define if binary requires EDSP instruction support]) |
| 284 | asm_optimization="$asm_optimization (EDSP)" |
| 285 | ], |
| 286 | [rtcd_support="$rtcd_support (EDSP)"] |
| 287 | ) |
| 288 | ]) |
| 289 | AC_SUBST(OPUS_ARM_MAY_HAVE_EDSP) |
| 290 | AS_IF([test x"$OPUS_ARM_MAY_HAVE_MEDIA" = x"1"],[ |
| 291 | AC_DEFINE(OPUS_ARM_MAY_HAVE_MEDIA, 1, |
| 292 | [Define if assembler supports ARMv6 media instructions]) |
| 293 | AS_IF([test x"$OPUS_ARM_PRESUME_MEDIA" = x"1"],[ |
| 294 | AC_DEFINE(OPUS_ARM_PRESUME_MEDIA, 1, |
| 295 | [Define if binary requires ARMv6 media instruction support]) |
| 296 | asm_optimization="$asm_optimization (Media)" |
| 297 | ], |
| 298 | [rtcd_support="$rtcd_support (Media)"] |
| 299 | ) |
| 300 | ]) |
| 301 | AC_SUBST(OPUS_ARM_MAY_HAVE_MEDIA) |
| 302 | AS_IF([test x"$OPUS_ARM_MAY_HAVE_NEON" = x"1"],[ |
| 303 | AC_DEFINE(OPUS_ARM_MAY_HAVE_NEON, 1, |
| 304 | [Define if compiler supports NEON instructions]) |
| 305 | AS_IF([test x"$OPUS_ARM_PRESUME_NEON" = x"1"], [ |
| 306 | AC_DEFINE(OPUS_ARM_PRESUME_NEON, 1, |
| 307 | [Define if binary requires NEON instruction support]) |
| 308 | asm_optimization="$asm_optimization (NEON)" |
| 309 | ], |
| 310 | [rtcd_support="$rtcd_support (NEON)"] |
| 311 | ) |
| 312 | ]) |
| 313 | AC_SUBST(OPUS_ARM_MAY_HAVE_NEON) |
| 314 | dnl Make sure turning on RTCD gets us at least one |
| 315 | dnl instruction set. |
| 316 | AS_IF([test x"$rtcd_support" != x""], |
| 317 | [rtcd_support=ARM"$rtcd_support"], |
| 318 | [rtcd_support="no"] |
| 319 | ) |
Martin Storsjo | 76e831d | 2014-03-19 21:36:39 +0200 | [diff] [blame] | 320 | AC_MSG_CHECKING([for apple style tools]) |
| 321 | AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ |
| 322 | #ifndef __APPLE__ |
| 323 | #error 1 |
| 324 | #endif],[])], |
| 325 | [AC_MSG_RESULT([yes]); ARM2GNU_PARAMS="--apple"], |
| 326 | [AC_MSG_RESULT([no]); ARM2GNU_PARAMS=""]) |
| 327 | AC_SUBST(ARM2GNU_PARAMS) |
Timothy B. Terriberry | 39386e0 | 2013-11-18 13:30:13 -0500 | [diff] [blame] | 328 | ], |
| 329 | [ |
| 330 | AC_MSG_WARN( |
| 331 | [*** ARM assembly requires perl -- disabling optimizations]) |
| 332 | asm_optimization="(missing perl dependency for ARM)" |
| 333 | ]) |
| 334 | ]) |
| 335 | ;; |
| 336 | esac |
| 337 | ],[ |
| 338 | inline_optimization="disabled" |
| 339 | asm_optimization="disabled" |
| 340 | ]) |
| 341 | |
| 342 | AM_CONDITIONAL([CPU_ARM], [test "$cpu_arm" = "yes"]) |
| 343 | AM_CONDITIONAL([OPUS_ARM_INLINE_ASM], |
Peter Korsgaard | 253e15f | 2013-12-08 11:05:41 +0100 | [diff] [blame] | 344 | [test x"${inline_optimization%% *}" = x"ARM"]) |
Timothy B. Terriberry | 39386e0 | 2013-11-18 13:30:13 -0500 | [diff] [blame] | 345 | AM_CONDITIONAL([OPUS_ARM_EXTERNAL_ASM], |
Peter Korsgaard | 253e15f | 2013-12-08 11:05:41 +0100 | [diff] [blame] | 346 | [test x"${asm_optimization%% *}" = x"ARM"]) |
Timothy B. Terriberry | 39386e0 | 2013-11-18 13:30:13 -0500 | [diff] [blame] | 347 | |
| 348 | AS_IF([test x"$enable_rtcd" = x"yes"],[ |
| 349 | AS_IF([test x"$rtcd_support" != x"no"],[ |
| 350 | AC_DEFINE([OPUS_HAVE_RTCD], [1], |
| 351 | [Use run-time CPU capabilities detection]) |
| 352 | OPUS_HAVE_RTCD=1 |
| 353 | AC_SUBST(OPUS_HAVE_RTCD) |
Ron | 5bac4f2 | 2013-06-29 02:06:53 +0930 | [diff] [blame] | 354 | ]) |
| 355 | ],[ |
Timothy B. Terriberry | 39386e0 | 2013-11-18 13:30:13 -0500 | [diff] [blame] | 356 | rtcd_support="disabled" |
Ron | 5bac4f2 | 2013-06-29 02:06:53 +0930 | [diff] [blame] | 357 | ]) |
Aurélien Zanelli | cd4c824 | 2013-05-31 15:07:00 +0200 | [diff] [blame] | 358 | |
Ron | 5bac4f2 | 2013-06-29 02:06:53 +0930 | [diff] [blame] | 359 | AC_ARG_ENABLE([assertions], |
| 360 | [AS_HELP_STRING([--enable-assertions],[enable additional software error checking])],, |
| 361 | [enable_assertions=no]) |
Jean-Marc Valin | e05aaf2 | 2011-04-29 19:48:42 -0400 | [diff] [blame] | 362 | |
Ron | 5bac4f2 | 2013-06-29 02:06:53 +0930 | [diff] [blame] | 363 | AS_IF([test "$enable_assertions" = "yes"], [ |
| 364 | AC_DEFINE([ENABLE_ASSERTIONS], [1], [Assertions]) |
| 365 | ]) |
Jean-Marc Valin | f334c82 | 2011-08-11 16:21:58 -0400 | [diff] [blame] | 366 | |
Ron | 5bac4f2 | 2013-06-29 02:06:53 +0930 | [diff] [blame] | 367 | AC_ARG_ENABLE([fuzzing], |
| 368 | [AS_HELP_STRING([--enable-fuzzing],[causes the encoder to make random decisions])],, |
| 369 | [enable_fuzzing=no]) |
| 370 | |
| 371 | AS_IF([test "$enable_fuzzing" = "yes"], [ |
| 372 | AC_DEFINE([FUZZING], [1], [Fuzzing]) |
| 373 | ]) |
| 374 | |
Ralph Giles | 35d4fb7 | 2011-09-06 23:18:00 -0700 | [diff] [blame] | 375 | AC_ARG_ENABLE([doc], |
Ron | 5bac4f2 | 2013-06-29 02:06:53 +0930 | [diff] [blame] | 376 | [AS_HELP_STRING([--disable-doc], [Do not build API documentation])],, |
| 377 | [enable_doc=yes]) |
Ralph Giles | 35d4fb7 | 2011-09-06 23:18:00 -0700 | [diff] [blame] | 378 | |
Ron | 5bac4f2 | 2013-06-29 02:06:53 +0930 | [diff] [blame] | 379 | AS_IF([test "$enable_doc" = "yes"], [ |
| 380 | AC_CHECK_PROG(HAVE_DOXYGEN, [doxygen], [yes], [no]) |
| 381 | ],[ |
| 382 | HAVE_DOXYGEN=no |
| 383 | ]) |
| 384 | |
| 385 | AM_CONDITIONAL([HAVE_DOXYGEN], [test "$HAVE_DOXYGEN" = "yes"]) |
| 386 | |
Aurélien Zanelli | faec673 | 2013-05-26 22:08:02 +0200 | [diff] [blame] | 387 | AC_ARG_ENABLE([extra-programs], |
Ron | 5bac4f2 | 2013-06-29 02:06:53 +0930 | [diff] [blame] | 388 | [AS_HELP_STRING([--disable-extra-programs], [Do not build extra programs (demo and tests)])],, |
| 389 | [enable_extra_programs=yes]) |
| 390 | |
| 391 | AM_CONDITIONAL([EXTRA_PROGRAMS], [test "$enable_extra_programs" = "yes"]) |
| 392 | |
Aurélien Zanelli | faec673 | 2013-05-26 22:08:02 +0200 | [diff] [blame] | 393 | |
Jean-Marc Valin | e05aaf2 | 2011-04-29 19:48:42 -0400 | [diff] [blame] | 394 | saved_CFLAGS="$CFLAGS" |
| 395 | CFLAGS="$CFLAGS -fvisibility=hidden" |
Gregory Maxwell | e53ebd6 | 2011-10-21 14:21:53 -0400 | [diff] [blame] | 396 | AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) |
Ron | 5bac4f2 | 2013-06-29 02:06:53 +0930 | [diff] [blame] | 397 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])], |
| 398 | [ AC_MSG_RESULT([yes]) ], |
| 399 | [ AC_MSG_RESULT([no]) |
| 400 | CFLAGS="$saved_CFLAGS" |
| 401 | ]) |
Gregory Maxwell | 6c83b0b | 2012-05-14 00:30:34 -0400 | [diff] [blame] | 402 | |
Gregory Maxwell | 6c83b0b | 2012-05-14 00:30:34 -0400 | [diff] [blame] | 403 | CFLAGS="$CFLAGS -W" |
| 404 | |
Ralph Giles | 99e8a93 | 2013-03-12 22:57:00 -0700 | [diff] [blame] | 405 | warn_CFLAGS="-Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes" |
Gregory Maxwell | 6c83b0b | 2012-05-14 00:30:34 -0400 | [diff] [blame] | 406 | saved_CFLAGS="$CFLAGS" |
Ralph Giles | 42f39c5 | 2013-03-11 10:59:13 -0700 | [diff] [blame] | 407 | CFLAGS="$CFLAGS $warn_CFLAGS" |
| 408 | AC_MSG_CHECKING([if ${CC} supports ${warn_CFLAGS}]) |
Ron | 5bac4f2 | 2013-06-29 02:06:53 +0930 | [diff] [blame] | 409 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])], |
| 410 | [ AC_MSG_RESULT([yes]) ], |
| 411 | [ AC_MSG_RESULT([no]) |
| 412 | CFLAGS="$saved_CFLAGS" |
| 413 | ]) |
Jean-Marc Valin | e05aaf2 | 2011-04-29 19:48:42 -0400 | [diff] [blame] | 414 | |
Ron | 5bac4f2 | 2013-06-29 02:06:53 +0930 | [diff] [blame] | 415 | saved_LIBS="$LIBS" |
| 416 | LIBS="$LIBS $LIBM" |
Jean-Marc Valin | e05aaf2 | 2011-04-29 19:48:42 -0400 | [diff] [blame] | 417 | AC_CHECK_FUNCS([lrintf]) |
| 418 | AC_CHECK_FUNCS([lrint]) |
Ron | 5bac4f2 | 2013-06-29 02:06:53 +0930 | [diff] [blame] | 419 | LIBS="$saved_LIBS" |
| 420 | |
Ralph Giles | c19bc34 | 2011-10-28 07:14:58 -0700 | [diff] [blame] | 421 | AC_CHECK_FUNCS([__malloc_hook]) |
Jean-Marc Valin | e05aaf2 | 2011-04-29 19:48:42 -0400 | [diff] [blame] | 422 | |
Ralph Giles | d47ddfb | 2012-09-16 23:09:21 -0700 | [diff] [blame] | 423 | AC_SUBST([PC_BUILD]) |
Ralph Giles | d47ddfb | 2012-09-16 23:09:21 -0700 | [diff] [blame] | 424 | |
Timothy B. Terriberry | 39386e0 | 2013-11-18 13:30:13 -0500 | [diff] [blame] | 425 | AC_CONFIG_FILES([ |
| 426 | Makefile |
| 427 | opus.pc |
| 428 | opus-uninstalled.pc |
| 429 | celt/arm/armopts.s |
| 430 | doc/Makefile |
| 431 | doc/Doxyfile |
| 432 | ]) |
Ron | 2f2f9d6 | 2013-05-11 02:05:24 +0930 | [diff] [blame] | 433 | AC_CONFIG_HEADERS([config.h]) |
Ron | c40d500 | 2012-09-19 07:56:17 +0930 | [diff] [blame] | 434 | |
| 435 | AC_OUTPUT |
Jean-Marc Valin | e05aaf2 | 2011-04-29 19:48:42 -0400 | [diff] [blame] | 436 | |
Ron | 4a7bb1f | 2013-06-09 00:57:02 +0930 | [diff] [blame] | 437 | AC_MSG_NOTICE([ |
Jean-Marc Valin | e05aaf2 | 2011-04-29 19:48:42 -0400 | [diff] [blame] | 438 | ------------------------------------------------------------------------ |
Ron | 2f2f9d6 | 2013-05-11 02:05:24 +0930 | [diff] [blame] | 439 | $PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK. |
| 440 | |
Jean-Marc Valin | e05aaf2 | 2011-04-29 19:48:42 -0400 | [diff] [blame] | 441 | Compiler support: |
| 442 | |
| 443 | C99 var arrays: ................ ${has_var_arrays} |
| 444 | C99 lrintf: .................... ${ac_cv_func_lrintf} |
Ron | 5bac4f2 | 2013-06-29 02:06:53 +0930 | [diff] [blame] | 445 | Use alloca: .................... ${use_alloca} |
Timothy B. Terriberry | 39386e0 | 2013-11-18 13:30:13 -0500 | [diff] [blame] | 446 | |
Jean-Marc Valin | e05aaf2 | 2011-04-29 19:48:42 -0400 | [diff] [blame] | 447 | General configuration: |
Timothy B. Terriberry | 39386e0 | 2013-11-18 13:30:13 -0500 | [diff] [blame] | 448 | |
Ron | 5bac4f2 | 2013-06-29 02:06:53 +0930 | [diff] [blame] | 449 | Floating point support: ........ ${enable_float} |
| 450 | Fast float approximations: ..... ${enable_float_approx} |
| 451 | Fixed point debugging: ......... ${enable_fixed_point_debug} |
Timothy B. Terriberry | 39386e0 | 2013-11-18 13:30:13 -0500 | [diff] [blame] | 452 | Inline Assembly Optimizations: . ${inline_optimization} |
| 453 | External Assembly Optimizations: ${asm_optimization} |
Aurélien Zanelli | cd4c824 | 2013-05-31 15:07:00 +0200 | [diff] [blame] | 454 | Run-time CPU detection: ........ ${rtcd_support} |
Ron | 5bac4f2 | 2013-06-29 02:06:53 +0930 | [diff] [blame] | 455 | Custom modes: .................. ${enable_custom_modes} |
| 456 | Assertion checking: ............ ${enable_assertions} |
| 457 | Fuzzing: ....................... ${enable_fuzzing} |
Ralph Giles | 35d4fb7 | 2011-09-06 23:18:00 -0700 | [diff] [blame] | 458 | |
Ron | 5bac4f2 | 2013-06-29 02:06:53 +0930 | [diff] [blame] | 459 | API documentation: ............. ${enable_doc} |
| 460 | Extra programs: ................ ${enable_extra_programs} |
Jean-Marc Valin | e05aaf2 | 2011-04-29 19:48:42 -0400 | [diff] [blame] | 461 | ------------------------------------------------------------------------ |
Ron | 4a7bb1f | 2013-06-09 00:57:02 +0930 | [diff] [blame] | 462 | |
| 463 | Type "make; make install" to compile and install |
| 464 | Type "make check" to run the test suite |
Jean-Marc Valin | e05aaf2 | 2011-04-29 19:48:42 -0400 | [diff] [blame] | 465 | ]) |
| 466 | |