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