configure.ac 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. dnl Process this file with autoconf to produce a configure script. -*-m4-*-
  2. AC_INIT(src/opus_encoder.c)
  3. AM_CONFIG_HEADER([config.h])
  4. dnl enable silent rules on automake 1.11 and later
  5. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  6. OPUS_MAJOR_VERSION=0
  7. OPUS_MINOR_VERSION=9
  8. OPUS_MICRO_VERSION=6
  9. OPUS_EXTRA_VERSION=
  10. OPUS_VERSION="$OPUS_MAJOR_VERSION.$OPUS_MINOR_VERSION.$OPUS_MICRO_VERSION$OPUS_EXTRA_VERSION"
  11. AC_MSG_CHECKING([git revision])
  12. GIT_VERSION=$(git describe --tags --match 'v*' 2>/dev/null | sed 's/^v//')
  13. if test -z "$GIT_VERSION"; then
  14. AC_MSG_RESULT([no])
  15. else
  16. AC_MSG_RESULT([$GIT_VERSION])
  17. OPUS_VERSION="$GIT_VERSION"
  18. fi
  19. LIBOPUS_SUFFIX=0
  20. OPUS_LT_CURRENT=0
  21. OPUS_LT_REVISION=0
  22. OPUS_LT_AGE=0
  23. AC_SUBST(OPUS_LT_CURRENT)
  24. AC_SUBST(OPUS_LT_REVISION)
  25. AC_SUBST(OPUS_LT_AGE)
  26. AC_SUBST(LIBOPUS_SUFFIX)
  27. # For automake.
  28. VERSION=$OPUS_VERSION
  29. PACKAGE=opus
  30. # For our version string
  31. AC_SUBST(OPUS_VERSION)
  32. AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
  33. AM_MAINTAINER_MODE
  34. AC_CANONICAL_HOST
  35. AM_PROG_LIBTOOL
  36. AM_PROG_CC_C_O
  37. AC_PROG_CC_C99
  38. AC_C_BIGENDIAN
  39. AC_C_CONST
  40. AC_C_INLINE
  41. AC_C_RESTRICT
  42. AC_DEFINE([OPUS_BUILD], [], [This is a build of OPUS])
  43. AC_MSG_CHECKING(for C99 variable-size arrays)
  44. AC_TRY_COMPILE( , [
  45. int foo=10;
  46. int array[foo];
  47. ],
  48. [has_var_arrays=yes;AC_DEFINE([VAR_ARRAYS], [], [Use C99 variable-size arrays])
  49. ],
  50. has_var_arrays=no
  51. )
  52. AC_MSG_RESULT($has_var_arrays)
  53. AC_CHECK_HEADERS([alloca.h getopt.h])
  54. AC_MSG_CHECKING(for alloca)
  55. AC_TRY_COMPILE( [#include <alloca.h>], [
  56. int foo=10;
  57. int *array = alloca(foo);
  58. ],
  59. [
  60. has_alloca=yes;
  61. if test x$has_var_arrays = "xno" ; then
  62. AC_DEFINE([USE_ALLOCA], [], [Make use of alloca])
  63. fi
  64. ],
  65. has_alloca=no
  66. )
  67. AC_MSG_RESULT($has_alloca)
  68. AC_CHECK_LIB(m, sin)
  69. AC_DEFINE_UNQUOTED(OPUS_VERSION, "${OPUS_VERSION}", [Complete version string])
  70. AC_DEFINE_UNQUOTED(OPUS_MAJOR_VERSION, ${OPUS_MAJOR_VERSION}, [Version major])
  71. AC_DEFINE_UNQUOTED(OPUS_MINOR_VERSION, ${OPUS_MINOR_VERSION}, [Version minor])
  72. AC_DEFINE_UNQUOTED(OPUS_MICRO_VERSION, ${OPUS_MICRO_VERSION}, [Version micro])
  73. AC_DEFINE_UNQUOTED(OPUS_EXTRA_VERSION, "${OPUS_EXTRA_VERSION}", [Version extra])
  74. has_float_approx=no
  75. #case "$host_cpu" in
  76. #i[[3456]]86 | x86_64 | powerpc64 | powerpc32 | ia64)
  77. # has_float_approx=yes
  78. # ;;
  79. #esac
  80. ac_enable_fixed="no";
  81. AC_ARG_ENABLE(fixed-point, [ --enable-fixed-point compile as fixed-point],
  82. [if test "$enableval" = yes; then
  83. ac_enable_fixed="yes";
  84. AC_DEFINE([FIXED_POINT], [1], [Compile as fixed-point])
  85. else
  86. AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])
  87. fi],
  88. AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]))
  89. ac_enable_fixed_debug="no"
  90. AC_ARG_ENABLE(fixed-point-debug, [ --enable-fixed-point-debug debug fixed-point implementation],
  91. [if test "$enableval" = yes; then
  92. ac_enable_fixed_debug="yes"
  93. AC_DEFINE([FIXED_DEBUG], , [Debug fixed-point implementation])
  94. fi])
  95. ac_enable_custom_modes="no"
  96. AC_ARG_ENABLE(custom-modes, [ --enable-custom-modes Enable non-Opus modes, like 44.1 kHz and powers of two ],
  97. [if test "$enableval" = yes; then
  98. ac_enable_custom_modes="yes"
  99. AC_DEFINE([CUSTOM_MODES], , [Custom modes])
  100. fi])
  101. float_approx=$has_float_approx
  102. AC_ARG_ENABLE(float-approx, [ --enable-float-approx enable fast approximations for floating point],
  103. [ if test "$enableval" = yes; then
  104. AC_WARN([Floating point approximations are not supported on all platforms.])
  105. float_approx=yes
  106. else
  107. float_approx=no
  108. fi], [ float_approx=$has_float_approx ])
  109. if test "x${float_approx}" = "xyes"; then
  110. AC_DEFINE([FLOAT_APPROX], , [Float approximations])
  111. fi
  112. ac_enable_assertions="no"
  113. AC_ARG_ENABLE(assertions, [ --enable-assertions enable additional software error checking],
  114. [if test "$enableval" = yes; then
  115. ac_enable_assertions="yes"
  116. AC_DEFINE([ENABLE_ASSERTIONS], , [Assertions])
  117. fi])
  118. ac_enable_fuzzing="no"
  119. AC_ARG_ENABLE(fuzzing, [ --enable-fuzzing causes the encoder to make random decisions],
  120. [if test "$enableval" = yes; then
  121. ac_enable_fuzzing="yes"
  122. AC_DEFINE([FUZZING], , [Fuzzing])
  123. fi])
  124. ac_enable_doc="yes"
  125. AC_ARG_ENABLE([doc],
  126. AS_HELP_STRING([--disable-doc], [Do not build API documentation]),
  127. [ac_enable_doc=$enableval])
  128. AC_CHECK_PROG(HAVE_DOXYGEN, [doxygen], [yes], [no])
  129. if test "$HAVE_DOXYGEN" != "yes" -o "$ac_enable_doc" != "yes"; then
  130. HAVE_DOXYGEN="false"
  131. ac_enable_doc="no"
  132. fi
  133. AM_CONDITIONAL(HAVE_DOXYGEN, [test $HAVE_DOXYGEN = yes])
  134. if test "$OPUS_BUILD" != "true" ; then
  135. saved_CFLAGS="$CFLAGS"
  136. CFLAGS="$CFLAGS -fvisibility=hidden"
  137. AC_MSG_CHECKING([if ${CXX} supports -fvisibility=hidden])
  138. AC_COMPILE_IFELSE([char foo;],
  139. [ AC_MSG_RESULT([yes])
  140. SYMBOL_VISIBILITY="-fvisibility=hidden" ],
  141. AC_MSG_RESULT([no]))
  142. CFLAGS="$saved_CFLAGS $SYMBOL_VISIBILITY"
  143. AC_SUBST(SYMBOL_VISIBILITY)
  144. fi
  145. if test $ac_cv_c_compiler_gnu = yes ; then
  146. CFLAGS="$CFLAGS -W -Wstrict-prototypes -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow"
  147. fi
  148. AC_CHECK_FUNCS([lrintf])
  149. AC_CHECK_FUNCS([lrint])
  150. AC_CHECK_SIZEOF(short)
  151. AC_CHECK_SIZEOF(int)
  152. AC_CHECK_SIZEOF(long)
  153. AC_CHECK_SIZEOF(long long)
  154. if test x$has_char16 = "xyes" ; then
  155. case 1 in
  156. $ac_cv_sizeof_short) SIZE16="short";;
  157. $ac_cv_sizeof_int) SIZE16="int";;
  158. esac
  159. else
  160. case 2 in
  161. $ac_cv_sizeof_short) SIZE16="short";;
  162. $ac_cv_sizeof_int) SIZE16="int";;
  163. esac
  164. fi
  165. if test x$has_char16 = "xyes" ; then
  166. case 2 in
  167. $ac_cv_sizeof_int) SIZE32="int";;
  168. $ac_cv_sizeof_long) SIZE32="long";;
  169. $ac_cv_sizeof_short) SIZE32="short";;
  170. esac
  171. else
  172. case 4 in
  173. $ac_cv_sizeof_int) SIZE32="int";;
  174. $ac_cv_sizeof_long) SIZE32="long";;
  175. $ac_cv_sizeof_short) SIZE32="short";;
  176. esac
  177. fi
  178. AC_SUBST(SIZE16)
  179. AC_SUBST(SIZE32)
  180. if test "$OPUS_BUILD" = "true" ; then
  181. AC_DEFINE(OPUS_BUILD, [], [We're part of Opus])
  182. fi
  183. AM_CONDITIONAL([FIXED_POINT], [test x$ac_enable_fixed = xyes])
  184. AM_CONDITIONAL([CUSTOM_MODES], [test x$ac_enable_custom_modes = xyes])
  185. AC_OUTPUT([Makefile celt/tests/Makefile
  186. opus.pc opus-uninstalled.pc
  187. doc/Makefile doc/Doxyfile])
  188. AC_MSG_RESULT([
  189. ------------------------------------------------------------------------
  190. $PACKAGE $VERSION: Automatic configuration OK.
  191. Compiler support:
  192. C99 var arrays: ................ ${has_var_arrays}
  193. C99 lrintf: .................... ${ac_cv_func_lrintf}
  194. Alloca: ........................ ${has_alloca}
  195. General configuration:
  196. Fast float approximations: ..... ${float_approx}
  197. Fixed point support: ........... ${ac_enable_fixed}
  198. Fixed point debugging: ......... ${ac_enable_fixed_debug}
  199. Custom modes: .................. ${ac_enable_custom_modes}
  200. Assertion checking: ............ ${ac_enable_assertions}
  201. Fuzzing: ....................... ${ac_enable_fuzzing}
  202. API documentation: ............. ${ac_enable_doc}
  203. ------------------------------------------------------------------------
  204. ])
  205. echo "Type \"make; make install\" to compile and install";
  206. echo "Type \"make check\" to run the test suite";