configure.ac 10 KB

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