1dnl Process this file with autoconf to produce a configure script. -*-m4-*- 2 3AC_INIT([speexdsp],[1.2rc3],[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=0 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 165CFLAGS="$CFLAGS -O3 -march=armv7-a -mfpu=neon" 166else 167has_neon=no 168fi 169]) 170 171 172FFT=smallft 173 174AC_ARG_ENABLE(fixed-point, [ --enable-fixed-point Compile as fixed-point], 175[if test "$enableval" = yes; then 176 FFT=kiss 177 has_sse=no 178 AC_DEFINE([FIXED_POINT], , [Compile as fixed-point]) 179else 180 AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]) 181fi], 182AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])) 183 184if test "$has_sse" = yes; then 185 AC_DEFINE([_USE_SSE], , [Enable SSE support]) 186fi 187 188if test "$has_neon" = yes; then 189 AC_DEFINE([_USE_NEON], , [Enable NEON support]) 190fi 191 192if test "$has_sse2" = yes; then 193 AC_DEFINE([_USE_SSE2], , [Enable SSE2 support]) 194fi 195 196AC_ARG_ENABLE(float-api, [ --disable-float-api Disable the floating-point API], 197[if test "$enableval" = no; then 198 AC_DEFINE([DISABLE_FLOAT_API], , [Disable all parts of the API that are using floats]) 199fi]) 200 201AC_ARG_ENABLE(examples, [ --disable-examples Do not build example programs, only the library]) 202if test "$enableval" != no; then 203 AM_CONDITIONAL([BUILD_EXAMPLES], true) 204else 205 AM_CONDITIONAL([BUILD_EXAMPLES], false) 206fi 207 208AC_ARG_ENABLE(arm4-asm, [ --enable-arm4-asm Make use of ARM4 assembly optimizations], 209[if test "$enableval" = yes; then 210 AC_DEFINE([ARM4_ASM], , [Make use of ARM4 assembly optimizations]) 211fi]) 212 213AC_ARG_ENABLE(arm5e-asm, [ --enable-arm5e-asm Make use of ARM5E assembly optimizations], 214[if test "$enableval" = yes; then 215 AC_DEFINE([ARM5E_ASM], , [Make use of ARM5E assembly optimizations]) 216fi]) 217 218AC_ARG_ENABLE(blackfin-asm, [ --enable-blackfin-asm Make use of Blackfin assembly optimizations], 219[if test "$enableval" = yes; then 220 AC_DEFINE([BFIN_ASM], , [Make use of Blackfin assembly optimizations]) 221fi]) 222case $host_os in 223 uclinux) LDFLAGS="-Wl,-elf2flt=-s100000 $LDFLAGS";; 224esac 225 226AC_ARG_ENABLE(fixed-point-debug, [ --enable-fixed-point-debug Debug fixed-point implementation], 227[if test "$enableval" = yes; then 228 AC_DEFINE([FIXED_DEBUG], , [Debug fixed-point implementation]) 229fi]) 230 231AC_ARG_ENABLE(resample-full-sinc-table, [ --enable-resample-full-sinc-table Resample full SINC table (no interpolation)], 232[if test "$enableval" = yes; then 233 AC_DEFINE([RESAMPLE_FULL_SINC_TABLE], , [Resample with full SINC table (no interpolation)]) 234fi]) 235 236AC_ARG_ENABLE(ti-c55x, [ --enable-ti-c55x Enable support for TI C55X DSP], 237[if test "$enableval" = yes; then 238 has_char16=yes; 239 AC_DEFINE([TI_C55X], , [Enable support for TI C55X DSP]) 240fi]) 241 242AC_ARG_WITH([fft], [AS_HELP_STRING([--with-fft=choice],[use an alternate FFT implementation. The available choices are 243kiss (default fixed point), smallft (default floating point), gpl-fftw3 and proprietary-intel-mkl])], 244[FFT=$withval] 245) 246 247FFT_PKGCONFIG= 248AS_CASE([$FFT], 249 [kiss], [ 250 AC_DEFINE([USE_KISS_FFT], [], [Use KISS Fast Fourier Transform]) 251 ], 252 [smallft], [ 253 AC_DEFINE([USE_SMALLFT], [], [Use FFT from OggVorbis]) 254 ], 255 [gpl-fftw3], [ 256 AC_DEFINE([USE_GPL_FFTW3], [], [Use FFTW3 for FFT]) 257 PKG_CHECK_MODULES([FFT], [fftw3f]) 258 ], 259 [proprietary-intel-mkl], [ 260 AC_DEFINE([USE_INTEL_MKL], [], [Use Intel Math Kernel Library for FFT]) 261 AC_MSG_CHECKING(for valid MKL) 262 AC_LINK_IFELSE([ 263 AC_LANG_PROGRAM([[ 264#include <mkl.h> 265void func() { 266 DFTI_DESCRIPTOR_HANDLE h; 267 MKL_LONG result=DftiCreateDescriptor(&h, DFTI_SINGLE, DFTI_REAL, 0); 268}]])], 269 [AC_MSG_RESULT(yes)], 270 [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.])] 271 ) 272 ], 273 [AC_MSG_FAILURE([Unknown FFT $FFT specified for --with-fft])] 274) 275AM_CONDITIONAL(BUILD_KISS_FFT, [test "$FFT" = "kiss"]) 276AM_CONDITIONAL(BUILD_SMALLFT, [test "$FFT" = "smallft"]) 277AC_SUBST(FFT_PKGCONFIG) 278 279 280AC_CHECK_SIZEOF([int16_t]) 281AC_CHECK_SIZEOF([uint16_t]) 282AC_CHECK_SIZEOF([u_int16_t]) 283AC_CHECK_SIZEOF([int32_t]) 284AC_CHECK_SIZEOF([uint32_t]) 285AC_CHECK_SIZEOF([u_int32_t]) 286AC_CHECK_SIZEOF([short]) 287AC_CHECK_SIZEOF([int]) 288AC_CHECK_SIZEOF([long]) 289 290AS_IF([test "$has_char16" = "yes"], 291 [ 292 SIZEOF16=1 293 SIZEOF32=2 294 ],[ 295 SIZEOF16=2 296 SIZEOF32=4 297 ]) 298 299case $SIZEOF16 in 300 $ac_cv_sizeof_int16_t) SIZE16="int16_t";; 301 $ac_cv_sizeof_short) SIZE16="short";; 302 $ac_cv_sizeof_int) SIZE16="int";; 303esac 304 305case $SIZEOF16 in 306 $ac_cv_sizeof_uint16_t) USIZE16="uint16_t";; 307 $ac_cv_sizeof_u_int16_t) USIZE16="u_int16_t";; 308 $ac_cv_sizeof_short) USIZE16="unsigned short";; 309 $ac_cv_sizeof_int) USIZE16="unsigned int";; 310esac 311 312case $SIZEOF32 in 313 $ac_cv_sizeof_int32_t) SIZE32="int32_t";; 314 $ac_cv_sizeof_int) SIZE32="int";; 315 $ac_cv_sizeof_long) SIZE32="long";; 316 $ac_cv_sizeof_short) SIZE32="short";; 317esac 318 319case $SIZEOF32 in 320 $ac_cv_sizeof_uint32_t) USIZE32="uint32_t";; 321 $ac_cv_sizeof_u_int32_t) USIZE32="u_int32_t";; 322 $ac_cv_sizeof_short) USIZE32="unsigned short";; 323 $ac_cv_sizeof_int) USIZE32="unsigned int";; 324 $ac_cv_sizeof_long) USIZE32="unsigned long";; 325esac 326 327AS_IF([test -z "$SIZE16"],[AC_MSG_ERROR([No 16 bit type found on this platform!])]) 328AS_IF([test -z "$SIZE32"],[AC_MSG_ERROR([No 32 bit type found on this platform!])]) 329AS_IF([test -z "$USIZE16"],[AC_MSG_ERROR([No unsigned 16 bit type found on this platform!])]) 330AS_IF([test -z "$USIZE32"],[AC_MSG_ERROR([No unsigned 32 bit type found on this platform!])]) 331 332AC_SUBST([SIZE16]) 333AC_SUBST([USIZE16]) 334AC_SUBST([SIZE32]) 335AC_SUBST([USIZE32]) 336 337AC_CONFIG_FILES([ 338 Makefile libspeexdsp/Makefile doc/Makefile SpeexDSP.spec 339 include/Makefile include/speex/Makefile speexdsp.pc 340 win32/Makefile win32/libspeexdsp/Makefile 341 symbian/Makefile 342 343 win32/VS2003/Makefile 344 win32/VS2003/libspeexdsp/Makefile 345 win32/VS2003/tests/Makefile 346 347 win32/VS2005/Makefile 348 win32/VS2005/libspeexdsp/Makefile 349 win32/VS2005/tests/Makefile 350 351 win32/VS2008/Makefile 352 win32/VS2008/libspeexdsp/Makefile 353 win32/VS2008/tests/Makefile 354 include/speex/speexdsp_config_types.h ti/Makefile 355 ti/speex_C54_test/Makefile ti/speex_C55_test/Makefile 356 ti/speex_C64_test/Makefile ]) 357 358AC_CONFIG_HEADERS([config.h]) 359 360AC_OUTPUT 361 362echo "Type \"make; make install\" to compile and install Speex"; 363