configure.ac 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. dnl Process this file with autoconf to produce a configure script. -*-m4-*-
  2. dnl The package_version file will be automatically synced to the git revision
  3. dnl by the update_version script when configured in the repository, but will
  4. dnl remain constant in tarball releases unless it is manually edited.
  5. m4_define([CURRENT_VERSION],
  6. m4_esyscmd([ ./update_version 2>/dev/null || true
  7. if test -e package_version; then
  8. . ./package_version
  9. printf "$PACKAGE_VERSION"
  10. else
  11. printf "unknown"
  12. fi ]))
  13. AC_INIT([opus],[CURRENT_VERSION],[opus@xiph.org])
  14. AC_CONFIG_SRCDIR(src/opus_encoder.c)
  15. AC_CONFIG_MACRO_DIR([m4])
  16. dnl enable silent rules on automake 1.11 and later
  17. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  18. # For libtool.
  19. dnl Please update these for releases.
  20. OPUS_LT_CURRENT=5
  21. OPUS_LT_REVISION=0
  22. OPUS_LT_AGE=5
  23. AC_SUBST(OPUS_LT_CURRENT)
  24. AC_SUBST(OPUS_LT_REVISION)
  25. AC_SUBST(OPUS_LT_AGE)
  26. AM_INIT_AUTOMAKE([no-define])
  27. AM_MAINTAINER_MODE([enable])
  28. AC_CANONICAL_HOST
  29. AC_MINGW32
  30. AM_PROG_LIBTOOL
  31. AM_PROG_CC_C_O
  32. AC_PROG_CC_C99
  33. AC_C_CONST
  34. AC_C_INLINE
  35. AM_PROG_AS
  36. AC_DEFINE([OPUS_BUILD], [], [This is a build of OPUS])
  37. #Use a hacked up version of autoconf's AC_C_RESTRICT because it's not
  38. #strong enough a test to detect old buggy versions of GCC (e.g. 2.95.3)
  39. #Note: Both this and the test for variable-size arrays below are also
  40. # done by AC_PROG_CC_C99, but not thoroughly enough apparently.
  41. AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict,
  42. [ac_cv_c_restrict=no
  43. # The order here caters to the fact that C++ does not require restrict.
  44. for ac_kw in __restrict __restrict__ _Restrict restrict; do
  45. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
  46. [[typedef int * int_ptr;
  47. int foo (int_ptr $ac_kw ip, int * $ac_kw baz[]) {
  48. return ip[0];
  49. }]],
  50. [[int s[1];
  51. int * $ac_kw t = s;
  52. t[0] = 0;
  53. return foo(t, (void *)0)]])],
  54. [ac_cv_c_restrict=$ac_kw])
  55. test "$ac_cv_c_restrict" != no && break
  56. done
  57. ])
  58. AH_VERBATIM([restrict],
  59. [/* Define to the equivalent of the C99 'restrict' keyword, or to
  60. nothing if this is not supported. Do not define if restrict is
  61. supported directly. */
  62. #undef restrict
  63. /* Work around a bug in Sun C++: it does not support _Restrict or
  64. __restrict__, even though the corresponding Sun C compiler ends up with
  65. "#define restrict _Restrict" or "#define restrict __restrict__" in the
  66. previous line. Perhaps some future version of Sun C++ will work with
  67. restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
  68. #if defined __SUNPRO_CC && !defined __RESTRICT
  69. # define _Restrict
  70. # define __restrict__
  71. #endif])
  72. case $ac_cv_c_restrict in
  73. restrict) ;;
  74. no) AC_DEFINE([restrict], []) ;;
  75. *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
  76. esac
  77. AC_MSG_CHECKING(for C99 variable-size arrays)
  78. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
  79. [[static int x; char a[++x]; a[sizeof a - 1] = 0; int N; return a[0];]])],
  80. [ has_var_arrays=yes
  81. use_alloca="no (using var arrays)"
  82. AC_DEFINE([VAR_ARRAYS], [1], [Use C99 variable-size arrays])
  83. ],[
  84. has_var_arrays=no
  85. ])
  86. AC_MSG_RESULT([$has_var_arrays])
  87. AS_IF([test "$has_var_arrays" = "no"],
  88. [
  89. AC_CHECK_HEADERS([alloca.h])
  90. AC_MSG_CHECKING(for alloca)
  91. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <alloca.h>]],
  92. [[int foo=10; int *array = alloca(foo);]])],
  93. [ use_alloca=yes;
  94. AC_DEFINE([USE_ALLOCA], [], [Make use of alloca])
  95. ],[
  96. use_alloca=no
  97. ])
  98. AC_MSG_RESULT([$use_alloca])
  99. ])
  100. LT_LIB_M
  101. AC_ARG_ENABLE([fixed-point],
  102. [AS_HELP_STRING([--enable-fixed-point],
  103. [compile without floating point (for machines without a fast enough FPU)])],,
  104. [enable_fixed_point=no])
  105. AS_IF([test "$enable_fixed_point" = "yes"],[
  106. enable_float="no"
  107. AC_DEFINE([FIXED_POINT], [1], [Compile as fixed-point (for machines without a fast enough FPU)])
  108. PC_BUILD="fixed-point"
  109. ],[
  110. enable_float="yes";
  111. PC_BUILD="floating-point"
  112. ])
  113. AM_CONDITIONAL([FIXED_POINT], [test "$enable_fixed_point" = "yes"])
  114. AC_ARG_ENABLE([fixed-point-debug],
  115. [AS_HELP_STRING([--enable-fixed-point-debug], [debug fixed-point implementation])],,
  116. [enable_fixed_point_debug=no])
  117. AS_IF([test "$enable_fixed_point_debug" = "yes"],[
  118. AC_DEFINE([FIXED_DEBUG], [1], [Debug fixed-point implementation])
  119. ])
  120. AC_ARG_ENABLE([float_api],
  121. [AS_HELP_STRING([--disable-float-api],
  122. [compile without the floating point API (for machines with no float library)])],,
  123. [enable_float_api=yes])
  124. AM_CONDITIONAL([DISABLE_FLOAT_API], [test "$enable_float_api" = "no"])
  125. AS_IF([test "$enable_float_api" = "no"],[
  126. AC_DEFINE([DISABLE_FLOAT_API], [1], [Do not build the float API])
  127. ])
  128. AC_ARG_ENABLE([custom-modes],
  129. [AS_HELP_STRING([--enable-custom-modes], [enable non-Opus modes, e.g. 44.1 kHz & 2^n frames])],,
  130. [enable_custom_modes=no])
  131. AS_IF([test "$enable_custom_modes" = "yes"],[
  132. AC_DEFINE([CUSTOM_MODES], [1], [Custom modes])
  133. PC_BUILD="$PC_BUILD, custom modes"
  134. ])
  135. AM_CONDITIONAL([CUSTOM_MODES], [test "$enable_custom_modes" = "yes"])
  136. has_float_approx=no
  137. #case "$host_cpu" in
  138. #i[[3456]]86 | x86_64 | powerpc64 | powerpc32 | ia64)
  139. # has_float_approx=yes
  140. # ;;
  141. #esac
  142. AC_ARG_ENABLE([float-approx],
  143. [AS_HELP_STRING([--enable-float-approx], [enable fast approximations for floating point])],
  144. [if test "$enable_float_approx" = "yes"; then
  145. AC_WARN([Floating point approximations are not supported on all platforms.])
  146. fi
  147. ],
  148. [enable_float_approx=$has_float_approx])
  149. AS_IF([test "$enable_float_approx" = "yes"],[
  150. AC_DEFINE([FLOAT_APPROX], [1], [Float approximations])
  151. ])
  152. AC_ARG_ENABLE([asm],
  153. [AS_HELP_STRING([--disable-asm], [Disable assembly optimizations])],,
  154. [enable_asm=yes])
  155. AC_ARG_ENABLE([rtcd],
  156. [AS_HELP_STRING([--disable-rtcd], [Disable run-time CPU capabilities detection])],,
  157. [enable_rtcd=yes])
  158. AC_ARG_ENABLE([intrinsics],
  159. [AS_HELP_STRING([--enable-intrinsics], [Enable intrinsics optimizations (only for fixed point x86)])],,
  160. [enable_intrinsics=no])
  161. rtcd_support=no
  162. cpu_arm=no
  163. AS_IF([test x"${enable_asm}" = x"yes"],[
  164. inline_optimization="No ASM for your platform, please send patches"
  165. case $host_cpu in
  166. arm*)
  167. dnl Currently we only have asm for fixed-point
  168. AS_IF([test "$enable_float" != "yes"],[
  169. cpu_arm=yes
  170. AC_DEFINE([OPUS_ARM_ASM], [], [Make use of ARM asm optimization])
  171. AS_GCC_INLINE_ASSEMBLY(
  172. [inline_optimization="ARM"],
  173. [inline_optimization="disabled"]
  174. )
  175. AS_ASM_ARM_EDSP([OPUS_ARM_INLINE_EDSP=1],[OPUS_ARM_INLINE_EDSP=0])
  176. AS_ASM_ARM_MEDIA([OPUS_ARM_INLINE_MEDIA=1],
  177. [OPUS_ARM_INLINE_MEDIA=0])
  178. AS_ASM_ARM_NEON([OPUS_ARM_INLINE_NEON=1],[OPUS_ARM_INLINE_NEON=0])
  179. AS_IF([test x"$inline_optimization" = x"ARM"],[
  180. AM_CONDITIONAL([OPUS_ARM_INLINE_ASM],[true])
  181. AC_DEFINE([OPUS_ARM_INLINE_ASM], 1,
  182. [Use generic ARMv4 inline asm optimizations])
  183. AS_IF([test x"$OPUS_ARM_INLINE_EDSP" = x"1"],[
  184. AC_DEFINE([OPUS_ARM_INLINE_EDSP], [1],
  185. [Use ARMv5E inline asm optimizations])
  186. inline_optimization="$inline_optimization (EDSP)"
  187. ])
  188. AS_IF([test x"$OPUS_ARM_INLINE_MEDIA" = x"1"],[
  189. AC_DEFINE([OPUS_ARM_INLINE_MEDIA], [1],
  190. [Use ARMv6 inline asm optimizations])
  191. inline_optimization="$inline_optimization (Media)"
  192. ])
  193. AS_IF([test x"$OPUS_ARM_INLINE_NEON" = x"1"],[
  194. AC_DEFINE([OPUS_ARM_INLINE_NEON], 1,
  195. [Use ARM NEON inline asm optimizations])
  196. inline_optimization="$inline_optimization (NEON)"
  197. ])
  198. ])
  199. dnl We need Perl to translate RVCT-syntax asm to gas syntax.
  200. AC_CHECK_PROG([HAVE_PERL], perl, yes, no)
  201. AS_IF([test x"$HAVE_PERL" = x"yes"],[
  202. AM_CONDITIONAL([OPUS_ARM_EXTERNAL_ASM],[true])
  203. asm_optimization="ARM"
  204. AS_IF([test x"$OPUS_ARM_INLINE_EDSP" = x"1"], [
  205. OPUS_ARM_PRESUME_EDSP=1
  206. OPUS_ARM_MAY_HAVE_EDSP=1
  207. ],
  208. [
  209. OPUS_ARM_PRESUME_EDSP=0
  210. OPUS_ARM_MAY_HAVE_EDSP=0
  211. ])
  212. AS_IF([test x"$OPUS_ARM_INLINE_MEDIA" = x"1"], [
  213. OPUS_ARM_PRESUME_MEDIA=1
  214. OPUS_ARM_MAY_HAVE_MEDIA=1
  215. ],
  216. [
  217. OPUS_ARM_PRESUME_MEDIA=0
  218. OPUS_ARM_MAY_HAVE_MEDIA=0
  219. ])
  220. AS_IF([test x"$OPUS_ARM_INLINE_NEON" = x"1"], [
  221. OPUS_ARM_PRESUME_NEON=1
  222. OPUS_ARM_MAY_HAVE_NEON=1
  223. ],
  224. [
  225. OPUS_ARM_PRESUME_NEON=0
  226. OPUS_ARM_MAY_HAVE_NEON=0
  227. ])
  228. AS_IF([test x"$enable_rtcd" = x"yes"],[
  229. AS_IF([test x"$OPUS_ARM_MAY_HAVE_EDSP" != x"1"],[
  230. AC_MSG_NOTICE(
  231. [Trying to force-enable armv5e EDSP instructions...])
  232. AS_ASM_ARM_EDSP_FORCE([OPUS_ARM_MAY_HAVE_EDSP=1])
  233. ])
  234. AS_IF([test x"$OPUS_ARM_MAY_HAVE_MEDIA" != x"1"],[
  235. AC_MSG_NOTICE(
  236. [Trying to force-enable ARMv6 media instructions...])
  237. AS_ASM_ARM_MEDIA_FORCE([OPUS_ARM_MAY_HAVE_MEDIA=1])
  238. ])
  239. AS_IF([test x"$OPUS_ARM_MAY_HAVE_NEON" != x"1"],[
  240. AC_MSG_NOTICE(
  241. [Trying to force-enable NEON instructions...])
  242. AS_ASM_ARM_NEON_FORCE([OPUS_ARM_MAY_HAVE_NEON=1])
  243. ])
  244. ])
  245. rtcd_support=
  246. AS_IF([test x"$OPUS_ARM_MAY_HAVE_EDSP" = x"1"],[
  247. AC_DEFINE(OPUS_ARM_MAY_HAVE_EDSP, 1,
  248. [Define if assembler supports EDSP instructions])
  249. AS_IF([test x"$OPUS_ARM_PRESUME_EDSP" = x"1"],[
  250. AC_DEFINE(OPUS_ARM_PRESUME_EDSP, 1,
  251. [Define if binary requires EDSP instruction support])
  252. asm_optimization="$asm_optimization (EDSP)"
  253. ],
  254. [rtcd_support="$rtcd_support (EDSP)"]
  255. )
  256. ])
  257. AC_SUBST(OPUS_ARM_MAY_HAVE_EDSP)
  258. AS_IF([test x"$OPUS_ARM_MAY_HAVE_MEDIA" = x"1"],[
  259. AC_DEFINE(OPUS_ARM_MAY_HAVE_MEDIA, 1,
  260. [Define if assembler supports ARMv6 media instructions])
  261. AS_IF([test x"$OPUS_ARM_PRESUME_MEDIA" = x"1"],[
  262. AC_DEFINE(OPUS_ARM_PRESUME_MEDIA, 1,
  263. [Define if binary requires ARMv6 media instruction support])
  264. asm_optimization="$asm_optimization (Media)"
  265. ],
  266. [rtcd_support="$rtcd_support (Media)"]
  267. )
  268. ])
  269. AC_SUBST(OPUS_ARM_MAY_HAVE_MEDIA)
  270. AS_IF([test x"$OPUS_ARM_MAY_HAVE_NEON" = x"1"],[
  271. AC_DEFINE(OPUS_ARM_MAY_HAVE_NEON, 1,
  272. [Define if compiler supports NEON instructions])
  273. AS_IF([test x"$OPUS_ARM_PRESUME_NEON" = x"1"], [
  274. AC_DEFINE(OPUS_ARM_PRESUME_NEON, 1,
  275. [Define if binary requires NEON instruction support])
  276. asm_optimization="$asm_optimization (NEON)"
  277. ],
  278. [rtcd_support="$rtcd_support (NEON)"]
  279. )
  280. ])
  281. AC_SUBST(OPUS_ARM_MAY_HAVE_NEON)
  282. dnl Make sure turning on RTCD gets us at least one
  283. dnl instruction set.
  284. AS_IF([test x"$rtcd_support" != x""],
  285. [rtcd_support=ARM"$rtcd_support"],
  286. [rtcd_support="no"]
  287. )
  288. AC_MSG_CHECKING([for apple style tools])
  289. AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
  290. #ifndef __APPLE__
  291. #error 1
  292. #endif],[])],
  293. [AC_MSG_RESULT([yes]); ARM2GNU_PARAMS="--apple"],
  294. [AC_MSG_RESULT([no]); ARM2GNU_PARAMS=""])
  295. AC_SUBST(ARM2GNU_PARAMS)
  296. ],
  297. [
  298. AC_MSG_WARN(
  299. [*** ARM assembly requires perl -- disabling optimizations])
  300. asm_optimization="(missing perl dependency for ARM)"
  301. ])
  302. ])
  303. ;;
  304. esac
  305. ],[
  306. inline_optimization="disabled"
  307. asm_optimization="disabled"
  308. ])
  309. AM_CONDITIONAL([CPU_ARM], [test "$cpu_arm" = "yes"])
  310. AM_CONDITIONAL([OPUS_ARM_INLINE_ASM],
  311. [test x"${inline_optimization%% *}" = x"ARM"])
  312. AM_CONDITIONAL([OPUS_ARM_EXTERNAL_ASM],
  313. [test x"${asm_optimization%% *}" = x"ARM"])
  314. AM_CONDITIONAL([HAVE_SSE4_1], [false])
  315. AM_CONDITIONAL([HAVE_SSE2], [false])
  316. AS_IF([test x"$enable_intrinsics" = x"yes"],[
  317. AS_IF([test x"$enable_float" = x"no"],
  318. [AS_IF([test x"$host_cpu" = x"i386" -o x"$host_cpu" = x"i686" -o x"$host_cpu" = x"x86_64"],[
  319. AS_IF([test x"$enable_rtcd" = x"yes"],[
  320. get_cpuid_by_asm="no"
  321. AC_MSG_CHECKING([Get CPU Info])
  322. AC_LINK_IFELSE(AC_LANG_PROGRAM([
  323. #include <stdio.h>
  324. ],[
  325. unsigned int CPUInfo0;
  326. unsigned int CPUInfo1;
  327. unsigned int CPUInfo2;
  328. unsigned int CPUInfo3;
  329. unsigned int InfoType;
  330. __asm__ __volatile__ (
  331. "cpuid11":
  332. "=a" (CPUInfo0),
  333. "=b" (CPUInfo1),
  334. "=c" (CPUInfo2),
  335. "=d" (CPUInfo3) :
  336. "a" (InfoType), "c" (0)
  337. );
  338. ]),
  339. [get_cpuid_by_asm="yes"
  340. AC_MSG_RESULT([Inline Assembly])],
  341. [AC_LINK_IFELSE(AC_LANG_PROGRAM([
  342. #include <cpuid.h>
  343. ],[
  344. unsigned int CPUInfo0;
  345. unsigned int CPUInfo1;
  346. unsigned int CPUInfo2;
  347. unsigned int CPUInfo3;
  348. unsigned int InfoType;
  349. __get_cpuid(InfoType, &CPUInfo0, &CPUInfo1, &CPUInfo2, &CPUInfo3);
  350. ]),
  351. [AC_MSG_RESULT([C method])],
  352. [AC_MSG_ERROR([not support Get CPU Info, please disable intrinsics ])])])
  353. AC_MSG_CHECKING([sse4.1])
  354. TMP_CFLAGS="$CFLAGS"
  355. gcc -Q --help=target | grep "\-msse4.1 "
  356. AS_IF([test x"$?" = x"0"],[
  357. CFLAGS="$CFLAGS -msse4.1"
  358. AC_CHECK_HEADER(xmmintrin.h, [], [AC_MSG_ERROR([Couldn't find xmmintrin.h])])
  359. AC_CHECK_HEADER(emmintrin.h, [], [AC_MSG_ERROR([Couldn't find emmintrin.h])])
  360. AC_CHECK_HEADER(smmintrin.h, [], [AC_MSG_ERROR([Couldn't find smmintrin.h])],[
  361. #ifdef HAVE_XMMINSTRIN_H
  362. #include <xmmintrin.h>
  363. #endif
  364. #ifdef HAVE_EMMINSTRIN_H
  365. #include <emmintrin.h>
  366. #endif
  367. ])
  368. AC_LINK_IFELSE(AC_LANG_PROGRAM([
  369. #include <xmmintrin.h>
  370. #include <emmintrin.h>
  371. #include <smmintrin.h>
  372. ],[
  373. __m128i mtest = _mm_setzero_si128();
  374. mtest = _mm_cmpeq_epi64(mtest, mtest);
  375. ]),
  376. [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([Compiler & linker failure for sse4.1, please disable intrinsics])])
  377. CFLAGS="$TMP_CFLAGS"
  378. AC_DEFINE([OPUS_X86_MAY_HAVE_SSE4_1], [1], [For x86 sse4.1 instrinsics optimizations])
  379. AC_DEFINE([OPUS_X86_MAY_HAVE_SSE2], [1], [For x86 sse2 instrinsics optimizations])
  380. rtcd_support="x86 sse4.1"
  381. AM_CONDITIONAL([HAVE_SSE4_1], [true])
  382. AM_CONDITIONAL([HAVE_SSE2], [true])
  383. AS_IF([test x"$get_cpuid_by_asm" = x"yes"],[AC_DEFINE([CPU_INFO_BY_ASM], [1], [Get CPU Info by asm method])],
  384. [AC_DEFINE([CPU_INFO_BY_C], [1], [Get CPU Info by C method])])
  385. ],[
  386. gcc -Q --help=target | grep "\-msse2 "
  387. AC_MSG_CHECKING([sse2])
  388. AS_IF([test x"$?" = x"0"],[
  389. AC_MSG_RESULT([yes])
  390. CFLAGS="$CFLAGS -msse2"
  391. AC_CHECK_HEADER(xmmintrin.h, [], [AC_MSG_ERROR([Couldn't find xmmintrin.h])])
  392. AC_CHECK_HEADER(emmintrin.h, [], [AC_MSG_ERROR([Couldn't find emmintrin.h])])
  393. AC_LINK_IFELSE(AC_LANG_PROGRAM([
  394. #include <xmmintrin.h>
  395. #include <emmintrin.h>
  396. ],[
  397. __m128i mtest = _mm_setzero_si128();
  398. ]),
  399. [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([Compiler & linker failure for sse2, please disable intrinsics])])
  400. CFLAGS="$TMP_CFLAGS"
  401. AC_DEFINE([OPUS_X86_MAY_HAVE_SSE2], [1], [For x86 sse2 instrinsics optimize])
  402. rtcd_support="x86 sse2"
  403. AM_CONDITIONAL([HAVE_SSE2], [true])
  404. AS_IF([test x"$get_cpuid_by_asm" = x"yes"],[AC_DEFINE([CPU_INFO_BY_ASM], [1], [Get CPU Info by asm method])],
  405. [AC_DEFINE([CPU_INFO_BY_C], [1], [Get CPU Info by c method])])
  406. ],[enable_intrinsics="no"])
  407. ])
  408. ], [enable_intrinsics="no"])
  409. ])
  410. ], [enable_intrinsics="no"])
  411. ])
  412. AS_IF([test x"$enable_rtcd" = x"yes"],[
  413. AS_IF([test x"$rtcd_support" != x"no"],[
  414. AC_DEFINE([OPUS_HAVE_RTCD], [1],
  415. [Use run-time CPU capabilities detection])
  416. OPUS_HAVE_RTCD=1
  417. AC_SUBST(OPUS_HAVE_RTCD)
  418. ])
  419. ],[
  420. rtcd_support="disabled"
  421. ])
  422. AC_ARG_ENABLE([assertions],
  423. [AS_HELP_STRING([--enable-assertions],[enable additional software error checking])],,
  424. [enable_assertions=no])
  425. AS_IF([test "$enable_assertions" = "yes"], [
  426. AC_DEFINE([ENABLE_ASSERTIONS], [1], [Assertions])
  427. ])
  428. AC_ARG_ENABLE([fuzzing],
  429. [AS_HELP_STRING([--enable-fuzzing],[causes the encoder to make random decisions])],,
  430. [enable_fuzzing=no])
  431. AS_IF([test "$enable_fuzzing" = "yes"], [
  432. AC_DEFINE([FUZZING], [1], [Fuzzing])
  433. ])
  434. AC_ARG_ENABLE([doc],
  435. [AS_HELP_STRING([--disable-doc], [Do not build API documentation])],,
  436. [enable_doc=yes])
  437. AS_IF([test "$enable_doc" = "yes"], [
  438. AC_CHECK_PROG(HAVE_DOXYGEN, [doxygen], [yes], [no])
  439. ],[
  440. HAVE_DOXYGEN=no
  441. ])
  442. AM_CONDITIONAL([HAVE_DOXYGEN], [test "$HAVE_DOXYGEN" = "yes"])
  443. AC_ARG_ENABLE([extra-programs],
  444. [AS_HELP_STRING([--disable-extra-programs], [Do not build extra programs (demo and tests)])],,
  445. [enable_extra_programs=yes])
  446. AM_CONDITIONAL([EXTRA_PROGRAMS], [test "$enable_extra_programs" = "yes"])
  447. saved_CFLAGS="$CFLAGS"
  448. CFLAGS="$CFLAGS -fvisibility=hidden"
  449. AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
  450. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
  451. [ AC_MSG_RESULT([yes]) ],
  452. [ AC_MSG_RESULT([no])
  453. CFLAGS="$saved_CFLAGS"
  454. ])
  455. CFLAGS="$CFLAGS -W"
  456. warn_CFLAGS="-Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes"
  457. saved_CFLAGS="$CFLAGS"
  458. CFLAGS="$CFLAGS $warn_CFLAGS"
  459. AC_MSG_CHECKING([if ${CC} supports ${warn_CFLAGS}])
  460. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
  461. [ AC_MSG_RESULT([yes]) ],
  462. [ AC_MSG_RESULT([no])
  463. CFLAGS="$saved_CFLAGS"
  464. ])
  465. saved_LIBS="$LIBS"
  466. LIBS="$LIBS $LIBM"
  467. AC_CHECK_FUNCS([lrintf])
  468. AC_CHECK_FUNCS([lrint])
  469. LIBS="$saved_LIBS"
  470. AC_CHECK_FUNCS([__malloc_hook])
  471. AC_SUBST([PC_BUILD])
  472. AC_CONFIG_FILES([
  473. Makefile
  474. opus.pc
  475. opus-uninstalled.pc
  476. celt/arm/armopts.s
  477. doc/Makefile
  478. doc/Doxyfile
  479. ])
  480. AC_CONFIG_HEADERS([config.h])
  481. AC_OUTPUT
  482. AC_MSG_NOTICE([
  483. ------------------------------------------------------------------------
  484. $PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK.
  485. Compiler support:
  486. C99 var arrays: ................ ${has_var_arrays}
  487. C99 lrintf: .................... ${ac_cv_func_lrintf}
  488. Use alloca: .................... ${use_alloca}
  489. General configuration:
  490. Floating point support: ........ ${enable_float}
  491. Fast float approximations: ..... ${enable_float_approx}
  492. Fixed point debugging: ......... ${enable_fixed_point_debug}
  493. Inline Assembly Optimizations: . ${inline_optimization}
  494. External Assembly Optimizations: ${asm_optimization}
  495. Intrinsics Optimizations.......: ${enable_intrinsics}
  496. Run-time CPU detection: ........ ${rtcd_support}
  497. Custom modes: .................. ${enable_custom_modes}
  498. Assertion checking: ............ ${enable_assertions}
  499. Fuzzing: ....................... ${enable_fuzzing}
  500. API documentation: ............. ${enable_doc}
  501. Extra programs: ................ ${enable_extra_programs}
  502. ------------------------------------------------------------------------
  503. Type "make; make install" to compile and install
  504. Type "make check" to run the test suite
  505. ])