configure.ac 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. dnl Process this file with autoconf to produce a configure script. -*-m4-*-
  2. AC_INIT([speex],[1.2.1],[speex-dev@xiph.org])
  3. AC_CONFIG_SRCDIR([libspeex/speex.c])
  4. AC_CONFIG_MACRO_DIR([m4])
  5. dnl enable silent rules on automake 1.11 and later
  6. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  7. SPEEX_MAJOR_VERSION=1
  8. SPEEX_MINOR_VERSION=2
  9. SPEEX_MICRO_VERSION=1
  10. SPEEX_EXTRA_VERSION=
  11. SPEEX_LT_CURRENT=6
  12. SPEEX_LT_REVISION=2
  13. SPEEX_LT_AGE=5
  14. AC_SUBST(SPEEX_LT_CURRENT)
  15. AC_SUBST(SPEEX_LT_REVISION)
  16. AC_SUBST(SPEEX_LT_AGE)
  17. AM_INIT_AUTOMAKE([foreign no-define])
  18. AM_MAINTAINER_MODE([enable])
  19. AC_CANONICAL_HOST
  20. LT_INIT
  21. AC_C_BIGENDIAN
  22. AC_C_CONST
  23. AC_C_INLINE
  24. AC_C_RESTRICT
  25. AC_MSG_CHECKING(for C99 variable-size arrays)
  26. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
  27. int foo;
  28. foo = 10;
  29. int array[foo];
  30. ]])],[has_var_arrays=yes;AC_DEFINE([VAR_ARRAYS], [], [Use C99 variable-size arrays])
  31. ],[has_var_arrays=no
  32. ])
  33. AC_MSG_RESULT($has_var_arrays)
  34. AC_CHECK_HEADERS([alloca.h getopt.h])
  35. AC_MSG_CHECKING(for alloca)
  36. AC_TRY_COMPILE( [
  37. #ifdef HAVE_ALLOCA_H
  38. # include <alloca.h>
  39. #endif
  40. #include <stdlib.h>
  41. ], [
  42. int foo=10;
  43. int *array = alloca(foo);
  44. ],
  45. [
  46. has_alloca=yes;
  47. if test x$has_var_arrays = "xno" ; then
  48. AC_DEFINE([USE_ALLOCA], [], [Make use of alloca])
  49. fi
  50. ],
  51. has_alloca=no
  52. )
  53. AC_MSG_RESULT($has_alloca)
  54. AC_MSG_CHECKING(for SSE in current arch/CFLAGS)
  55. AC_LINK_IFELSE([
  56. AC_LANG_PROGRAM([[
  57. #include <xmmintrin.h>
  58. __m128 testfunc(float *a, float *b) {
  59. return _mm_add_ps(_mm_loadu_ps(a), _mm_loadu_ps(b));
  60. }
  61. ]])],
  62. [
  63. has_sse=yes
  64. ],
  65. [
  66. has_sse=no
  67. ]
  68. )
  69. AC_MSG_RESULT($has_sse)
  70. SAVE_CFLAGS="$CFLAGS"
  71. CFLAGS="$CFLAGS -fvisibility=hidden"
  72. AC_MSG_CHECKING(for ELF visibility)
  73. AC_COMPILE_IFELSE([
  74. AC_LANG_PROGRAM([[
  75. #pragma GCC visibility push(hidden)
  76. __attribute__((visibility("default")))
  77. int var=10;
  78. ]])],
  79. [
  80. has_visibility=yes
  81. AC_DEFINE([EXPORT], [__attribute__((visibility("default")))], [Symbol visibility prefix])
  82. ],
  83. [
  84. has_visibility=no
  85. AC_DEFINE([EXPORT], [], [Symbol visibility prefix])
  86. CFLAGS="$SAVE_CFLAGS"
  87. ]
  88. )
  89. AC_MSG_RESULT($has_visibility)
  90. AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h)
  91. LT_LIB_M
  92. # Check for getopt_long; if not found, use included source.
  93. AC_CHECK_FUNCS([getopt_long],,
  94. [# FreeBSD has a gnugetopt library.
  95. AC_CHECK_LIB([gnugetopt],[getopt_long],
  96. [AC_DEFINE([HAVE_GETOPT_LONG])],
  97. [# Use the GNU replacement.
  98. AC_LIBOBJ(getopt)
  99. AC_LIBOBJ(getopt1)])])
  100. SPEEX_VERSION=$PACKAGE_VERSION
  101. AC_SUBST(SPEEX_VERSION)
  102. AC_DEFINE_UNQUOTED(SPEEX_VERSION, "${PACKAGE_VERSION}", [Complete version string])
  103. AC_DEFINE_UNQUOTED(SPEEX_MAJOR_VERSION, ${SPEEX_MAJOR_VERSION}, [Version major])
  104. AC_DEFINE_UNQUOTED(SPEEX_MINOR_VERSION, ${SPEEX_MINOR_VERSION}, [Version minor])
  105. AC_DEFINE_UNQUOTED(SPEEX_MICRO_VERSION, ${SPEEX_MICRO_VERSION}, [Version micro])
  106. AC_DEFINE_UNQUOTED(SPEEX_EXTRA_VERSION, "${SPEEX_EXTRA_VERSION}", [Version extra])
  107. AC_ARG_ENABLE(valgrind, [ --enable-valgrind Enable valgrind extra checks],
  108. [if test "$enableval" = yes; then
  109. AC_DEFINE([ENABLE_VALGRIND], , [Enable valgrind extra checks])
  110. fi])
  111. AC_ARG_ENABLE(sse, [ --enable-sse Enable SSE support], [
  112. if test "x$enableval" != xno; then
  113. has_sse=yes
  114. CFLAGS="$CFLAGS -O3 -msse"
  115. else
  116. has_sse=no
  117. fi
  118. ])
  119. FFT=smallft
  120. AC_ARG_ENABLE(fixed-point, [ --enable-fixed-point Compile as fixed-point],
  121. [if test "$enableval" = yes; then
  122. FFT=kiss
  123. has_sse=no
  124. AC_DEFINE([FIXED_POINT], , [Compile as fixed-point])
  125. else
  126. AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])
  127. fi],
  128. AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]))
  129. if test "$has_sse" = yes; then
  130. AC_DEFINE([_USE_SSE], , [Enable SSE support])
  131. fi
  132. AC_ARG_ENABLE(float-api, [ --disable-float-api Disable the floating-point API],
  133. [if test "$enableval" = no; then
  134. AC_DEFINE([DISABLE_FLOAT_API], , [Disable all parts of the API that are using floats])
  135. fi])
  136. AC_ARG_ENABLE(binaries, [ --disable-binaries Do not build the encoder and decoder programs, only the library])
  137. AS_IF([test "x$enable_binaries" != "xno"], [
  138. PKG_CHECK_MODULES([OGG], [ogg],
  139. AM_CONDITIONAL([BUILD_BINARIES], true),
  140. [AC_MSG_WARN([Ogg not found, not building example programs])
  141. AM_CONDITIONAL([BUILD_BINARIES], false)])],
  142. [AM_CONDITIONAL([BUILD_BINARIES], false)])
  143. AC_ARG_ENABLE(vbr, [ --disable-vbr Disable VBR and VAD from the codec],
  144. [if test "$enableval" = no; then
  145. AC_DEFINE([DISABLE_VBR], , [Disable VBR and VAD from the codec])
  146. fi])
  147. AC_ARG_ENABLE(arm4-asm, [ --enable-arm4-asm Make use of ARM4 assembly optimizations],
  148. [if test "$enableval" = yes; then
  149. AC_DEFINE([ARM4_ASM], , [Make use of ARM4 assembly optimizations])
  150. fi])
  151. AC_ARG_ENABLE(arm5e-asm, [ --enable-arm5e-asm Make use of ARM5E assembly optimizations],
  152. [if test "$enableval" = yes; then
  153. AC_DEFINE([ARM5E_ASM], , [Make use of ARM5E assembly optimizations])
  154. fi])
  155. AC_ARG_ENABLE(blackfin-asm, [ --enable-blackfin-asm Make use of Blackfin assembly optimizations],
  156. [if test "$enableval" = yes; then
  157. AC_DEFINE([BFIN_ASM], , [Make use of Blackfin assembly optimizations])
  158. fi])
  159. WINMM_LIBS=""
  160. case $host_os in
  161. uclinux) LDFLAGS="-Wl,-elf2flt=-s100000 $LDFLAGS";;
  162. *mingw*) WINMM_LIBS="-lwinmm";;
  163. esac
  164. AC_SUBST(WINMM_LIBS)
  165. AC_ARG_ENABLE(fixed-point-debug, [ --enable-fixed-point-debug Debug fixed-point implementation],
  166. [if test "$enableval" = yes; then
  167. AC_DEFINE([FIXED_DEBUG], , [Debug fixed-point implementation])
  168. fi])
  169. AC_ARG_ENABLE(ti-c55x, [ --enable-ti-c55x Enable support for TI C55X DSP],
  170. [if test "$enableval" = yes; then
  171. has_char16=yes;
  172. AC_DEFINE([TI_C55X], , [Enable support for TI C55X DSP])
  173. fi])
  174. AC_ARG_ENABLE(vorbis-psy, [ --enable-vorbis-psy Enable the Vorbis psy model],
  175. [if test "$enableval" = yes; then
  176. vorbis_psy=yes;
  177. AC_DEFINE([VORBIS_PSYCHO], , [Enable support for the Vorbis psy model])
  178. fi])
  179. AC_ARG_WITH([fft], [AS_HELP_STRING([--with-fft=choice],[use an alternate FFT implementation. The available choices are
  180. kiss (default fixed point), smallft (default floating point), gpl-fftw3 and proprietary-intel-mkl])],
  181. [FFT=$withval]
  182. )
  183. FFT_PKGCONFIG=
  184. AS_CASE([$FFT],
  185. [kiss], [
  186. AC_DEFINE([USE_KISS_FFT], [], [Use KISS Fast Fourier Transform])
  187. ],
  188. [smallft], [
  189. AC_DEFINE([USE_SMALLFT], [], [Use FFT from OggVorbis])
  190. ],
  191. [gpl-fftw3], [
  192. AC_DEFINE([USE_GPL_FFTW3], [], [Use FFTW3 for FFT])
  193. PKG_CHECK_MODULES([FFT], [fftw3f])
  194. ],
  195. [proprietary-intel-mkl], [
  196. AC_DEFINE([USE_INTEL_MKL], [], [Use Intel Math Kernel Library for FFT])
  197. AC_MSG_CHECKING(for valid MKL)
  198. AC_LINK_IFELSE([
  199. AC_LANG_PROGRAM([[
  200. #include <mkl.h>
  201. void func() {
  202. DFTI_DESCRIPTOR_HANDLE h;
  203. MKL_LONG result=DftiCreateDescriptor(&h, DFTI_SINGLE, DFTI_REAL, 0);
  204. }]])],
  205. [AC_MSG_RESULT(yes)],
  206. [AC_MSG_FAILURE([Failed to compile MKL test program. Make sure you set CFLAGS to include the include directory and set LDFLAGS to include the library directory and all necessary libraries.])]
  207. )
  208. ],
  209. [AC_MSG_FAILURE([Unknown FFT $FFT specified for --with-fft])]
  210. )
  211. AM_CONDITIONAL(BUILD_KISS_FFT, [test "$FFT" = "kiss"])
  212. AM_CONDITIONAL(BUILD_SMALLFT, [test "$FFT" = "smallft"])
  213. AC_SUBST(FFT_PKGCONFIG)
  214. AM_CONDITIONAL(BUILD_VORBIS_PSY, [test "x$vorbis_psy" = "xyes"])
  215. PKG_CHECK_MODULES([SPEEXDSP], [speexdsp], [AC_DEFINE([USE_SPEEXDSP], [], [Use SpeexDSP library])], [speexdsp_failed=yes])
  216. AC_CHECK_SIZEOF([int16_t])
  217. AC_CHECK_SIZEOF([uint16_t])
  218. AC_CHECK_SIZEOF([u_int16_t])
  219. AC_CHECK_SIZEOF([int32_t])
  220. AC_CHECK_SIZEOF([uint32_t])
  221. AC_CHECK_SIZEOF([u_int32_t])
  222. AC_CHECK_SIZEOF([short])
  223. AC_CHECK_SIZEOF([int])
  224. AC_CHECK_SIZEOF([long])
  225. AS_IF([test "$has_char16" = "yes"],
  226. [
  227. SIZEOF16=1
  228. SIZEOF32=2
  229. ],[
  230. SIZEOF16=2
  231. SIZEOF32=4
  232. ])
  233. case $SIZEOF16 in
  234. $ac_cv_sizeof_int16_t) SIZE16="int16_t";;
  235. $ac_cv_sizeof_short) SIZE16="short";;
  236. $ac_cv_sizeof_int) SIZE16="int";;
  237. esac
  238. case $SIZEOF16 in
  239. $ac_cv_sizeof_uint16_t) USIZE16="uint16_t";;
  240. $ac_cv_sizeof_u_int16_t) USIZE16="u_int16_t";;
  241. $ac_cv_sizeof_short) USIZE16="unsigned short";;
  242. $ac_cv_sizeof_int) USIZE16="unsigned int";;
  243. esac
  244. case $SIZEOF32 in
  245. $ac_cv_sizeof_int32_t) SIZE32="int32_t";;
  246. $ac_cv_sizeof_int) SIZE32="int";;
  247. $ac_cv_sizeof_long) SIZE32="long";;
  248. $ac_cv_sizeof_short) SIZE32="short";;
  249. esac
  250. case $SIZEOF32 in
  251. $ac_cv_sizeof_uint32_t) USIZE32="uint32_t";;
  252. $ac_cv_sizeof_u_int32_t) USIZE32="u_int32_t";;
  253. $ac_cv_sizeof_short) USIZE32="unsigned short";;
  254. $ac_cv_sizeof_int) USIZE32="unsigned int";;
  255. $ac_cv_sizeof_long) USIZE32="unsigned long";;
  256. esac
  257. XIPH_ADD_CFLAGS([-Wall])
  258. AS_IF([test -z "$SIZE16"],[AC_MSG_ERROR([No 16 bit type found on this platform!])])
  259. AS_IF([test -z "$SIZE32"],[AC_MSG_ERROR([No 32 bit type found on this platform!])])
  260. AS_IF([test -z "$USIZE16"],[AC_MSG_ERROR([No unsigned 16 bit type found on this platform!])])
  261. AS_IF([test -z "$USIZE32"],[AC_MSG_ERROR([No unsigned 32 bit type found on this platform!])])
  262. AC_SUBST([SIZE16])
  263. AC_SUBST([USIZE16])
  264. AC_SUBST([SIZE32])
  265. AC_SUBST([USIZE32])
  266. AS_IF([test "$ac_cv_header_stdint_h" = "yes"], [INCLUDE_STDINT="#include <stdint.h>"],
  267. [test "$ac_cv_header_inttypes_h" = "yes"], [INCLUDE_STDINT="#include <inttypes.h>"],
  268. [test "$ac_cv_header_sys_types_h" = "yes"], [INCLUDE_STDINT="#include <sys/types.h>"])
  269. AC_SUBST([INCLUDE_STDINT])
  270. AC_CONFIG_FILES([
  271. Makefile libspeex/Makefile src/Makefile doc/Makefile Speex.spec
  272. include/Makefile include/speex/Makefile speex.pc
  273. win32/Makefile win32/libspeex/Makefile win32/speexenc/Makefile
  274. win32/speexdec/Makefile symbian/Makefile
  275. win32/VS2003/Makefile
  276. win32/VS2003/tests/Makefile
  277. win32/VS2003/libspeex/Makefile
  278. win32/VS2003/speexdec/Makefile
  279. win32/VS2003/speexenc/Makefile
  280. win32/VS2005/Makefile
  281. win32/VS2005/libspeex/Makefile
  282. win32/VS2005/speexdec/Makefile
  283. win32/VS2005/speexenc/Makefile
  284. win32/VS2005/tests/Makefile
  285. win32/VS2008/Makefile
  286. win32/VS2008/speexdec/Makefile
  287. win32/VS2008/tests/Makefile
  288. win32/VS2008/libspeex/Makefile
  289. win32/VS2008/speexenc/Makefile
  290. include/speex/speex_config_types.h ti/Makefile
  291. ti/speex_C54_test/Makefile ti/speex_C55_test/Makefile
  292. ti/speex_C64_test/Makefile
  293. ])
  294. AC_CONFIG_HEADERS([config.h])
  295. AC_OUTPUT
  296. echo "Type \"make; make install\" to compile and install Speex";