You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

363 lines
9.1KB

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