Home | History | Annotate | Download | only in speex
      1 dnl Process this file with autoconf to produce a configure script. -*-m4-*-
      2 
      3 AC_INIT([speexdsp],[1.2rc3],[speex-dev (a] xiph.org])
      4 
      5 AC_CONFIG_SRCDIR([libspeexdsp/preprocess.c])
      6 AC_CONFIG_MACRO_DIR([m4])
      7 
      8 dnl enable silent rules on automake 1.11 and later
      9 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
     10 
     11 
     12 SPEEXDSP_LT_CURRENT=6
     13 SPEEXDSP_LT_REVISION=0
     14 SPEEXDSP_LT_AGE=5
     15 
     16 
     17 AC_SUBST(SPEEXDSP_LT_CURRENT)
     18 AC_SUBST(SPEEXDSP_LT_REVISION)
     19 AC_SUBST(SPEEXDSP_LT_AGE)
     20 
     21 AM_INIT_AUTOMAKE([foreign no-define])
     22 AM_MAINTAINER_MODE([enable])
     23 
     24 AC_CANONICAL_HOST
     25 AC_LIBTOOL_WIN32_DLL
     26 AM_PROG_LIBTOOL
     27 
     28 AC_C_BIGENDIAN
     29 AC_C_CONST
     30 AC_C_INLINE
     31 AC_C_RESTRICT
     32 
     33 
     34 AC_MSG_CHECKING(for C99 variable-size arrays)
     35 AC_TRY_COMPILE( , [
     36 int foo;
     37 foo = 10;
     38 int array[foo];
     39 ],
     40 [has_var_arrays=yes;AC_DEFINE([VAR_ARRAYS], [], [Use C99 variable-size arrays])
     41 ],
     42 has_var_arrays=no
     43 )
     44 AC_MSG_RESULT($has_var_arrays)
     45 
     46 AC_CHECK_HEADERS([alloca.h getopt.h])
     47 AC_MSG_CHECKING(for alloca)
     48 AC_TRY_COMPILE( [
     49 #ifdef HAVE_ALLOCA_H
     50 # include <alloca.h>
     51 #endif
     52 #include <stdlib.h>
     53 ], [
     54 int foo=10;
     55 int *array = alloca(foo);
     56 ],
     57 [
     58 has_alloca=yes;
     59 if test x$has_var_arrays = "xno" ; then
     60 AC_DEFINE([USE_ALLOCA], [], [Make use of alloca])
     61 fi
     62 ],
     63 has_alloca=no
     64 )
     65 AC_MSG_RESULT($has_alloca)
     66 
     67 AC_MSG_CHECKING(for SSE in current arch/CFLAGS)
     68 AC_LINK_IFELSE([
     69 AC_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 [
     76 has_sse=yes
     77 ],
     78 [
     79 has_sse=no
     80 ]
     81 )
     82 AC_MSG_RESULT($has_sse)
     83 
     84 AC_MSG_CHECKING(for SSE2 in current arch/CFLAGS)
     85 AC_LINK_IFELSE([
     86 AC_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 [
     93 has_sse2=yes
     94 ],
     95 [
     96 has_sse2=no
     97 ]
     98 )
     99 AC_MSG_RESULT($has_sse2)
    100 
    101 AC_MSG_CHECKING(for NEON in current arch/CFLAGS)
    102 AC_LINK_IFELSE([
    103 AC_LANG_PROGRAM([[
    104 #include <arm_neon.h>
    105 int32x4_t testfunc(int16_t *a, int16_t *b) {
    106       return vmull_s16(vld1_s16(a), vld1_s16(b));
    107 }
    108 ]])],
    109 [
    110 has_neon=yes
    111 ],
    112 [
    113 has_neon=no
    114 ]
    115 )
    116 AC_MSG_RESULT($has_neon)
    117 
    118 SAVE_CFLAGS="$CFLAGS"
    119 CFLAGS="$CFLAGS -fvisibility=hidden"
    120 AC_MSG_CHECKING(for ELF visibility)
    121 AC_COMPILE_IFELSE([
    122 AC_LANG_PROGRAM([[
    123 #pragma GCC visibility push(hidden)
    124 __attribute__((visibility("default")))
    125 int var=10;
    126 ]])],
    127 [
    128 has_visibility=yes
    129 AC_DEFINE([EXPORT], [__attribute__((visibility("default")))], [Symbol visibility prefix])
    130 ],
    131 [
    132 has_visibility=no
    133 AC_DEFINE([EXPORT], [], [Symbol visibility prefix])
    134 CFLAGS="$SAVE_CFLAGS"
    135 ]
    136 )
    137 AC_MSG_RESULT($has_visibility)
    138 
    139 AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h)
    140 
    141 AC_SUBST(src)
    142 
    143 LT_LIB_M
    144 
    145 
    146 AC_ARG_ENABLE(valgrind, [  --enable-valgrind       Enable valgrind extra checks],
    147 [if test "$enableval" = yes; then
    148   AC_DEFINE([ENABLE_VALGRIND], , [Enable valgrind extra checks])
    149 fi])
    150 
    151 AC_ARG_ENABLE(sse, [  --enable-sse            Enable SSE support], [
    152 if test "x$enableval" != xno; then
    153 has_sse=yes
    154 has_sse2=yes
    155 CFLAGS="$CFLAGS -O3 -msse -msse2"
    156 else
    157 has_sse=no
    158 has_sse2=no
    159 fi
    160 ])
    161 
    162 AC_ARG_ENABLE(neon, [  --enable-neon           Enable NEON support], [
    163 if test "x$enableval" != xno; then
    164 has_neon=yes
    165 CFLAGS="$CFLAGS -O3 -march=armv7-a -mfpu=neon"
    166 else
    167 has_neon=no
    168 fi
    169 ])
    170 
    171 
    172 FFT=smallft
    173 
    174 AC_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])
    179 else
    180   AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])
    181 fi],
    182 AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]))
    183 
    184 if test "$has_sse" = yes; then
    185   AC_DEFINE([_USE_SSE], , [Enable SSE support])
    186 fi
    187 
    188 if test "$has_neon" = yes; then
    189   AC_DEFINE([_USE_NEON], , [Enable NEON support])
    190 fi
    191 
    192 if test "$has_sse2" = yes; then
    193   AC_DEFINE([_USE_SSE2], , [Enable SSE2 support])
    194 fi
    195 
    196 AC_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])
    199 fi])
    200 
    201 AC_ARG_ENABLE(examples, [  --disable-examples      Do not build example programs, only the library])
    202 if test "$enableval" != no; then
    203   AM_CONDITIONAL([BUILD_EXAMPLES], true)
    204 else
    205   AM_CONDITIONAL([BUILD_EXAMPLES], false)
    206 fi
    207 
    208 AC_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])
    211 fi])
    212 
    213 AC_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])
    216 fi])
    217 
    218 AC_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])
    221 fi])
    222 case $host_os in
    223   uclinux) LDFLAGS="-Wl,-elf2flt=-s100000 $LDFLAGS";;
    224 esac
    225 
    226 AC_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])
    229 fi])
    230 
    231 AC_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)])
    234 fi])
    235 
    236 AC_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])
    240 fi])
    241 
    242 AC_ARG_WITH([fft], [AS_HELP_STRING([--with-fft=choice],[use an alternate FFT implementation. The available choices are
    243 kiss (default fixed point), smallft (default floating point), gpl-fftw3 and proprietary-intel-mkl])],
    244 [FFT=$withval]
    245 )
    246 
    247 FFT_PKGCONFIG=
    248 AS_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>
    265 void 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 )
    275 AM_CONDITIONAL(BUILD_KISS_FFT, [test "$FFT" = "kiss"])
    276 AM_CONDITIONAL(BUILD_SMALLFT, [test "$FFT" = "smallft"])
    277 AC_SUBST(FFT_PKGCONFIG)
    278 
    279 
    280 AC_CHECK_SIZEOF([int16_t])
    281 AC_CHECK_SIZEOF([uint16_t])
    282 AC_CHECK_SIZEOF([u_int16_t])
    283 AC_CHECK_SIZEOF([int32_t])
    284 AC_CHECK_SIZEOF([uint32_t])
    285 AC_CHECK_SIZEOF([u_int32_t])
    286 AC_CHECK_SIZEOF([short])
    287 AC_CHECK_SIZEOF([int])
    288 AC_CHECK_SIZEOF([long])
    289 
    290 AS_IF([test "$has_char16" = "yes"],
    291   [
    292    SIZEOF16=1
    293    SIZEOF32=2
    294   ],[
    295    SIZEOF16=2
    296    SIZEOF32=4
    297   ])
    298 
    299 case $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";;
    303 esac
    304 
    305 case $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";;
    310 esac
    311 
    312 case $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";;
    317 esac
    318 
    319 case $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";;
    325 esac
    326 
    327 AS_IF([test -z "$SIZE16"],[AC_MSG_ERROR([No 16 bit type found on this platform!])])
    328 AS_IF([test -z "$SIZE32"],[AC_MSG_ERROR([No 32 bit type found on this platform!])])
    329 AS_IF([test -z "$USIZE16"],[AC_MSG_ERROR([No unsigned 16 bit type found on this platform!])])
    330 AS_IF([test -z "$USIZE32"],[AC_MSG_ERROR([No unsigned 32 bit type found on this platform!])])
    331 
    332 AC_SUBST([SIZE16])
    333 AC_SUBST([USIZE16])
    334 AC_SUBST([SIZE32])
    335 AC_SUBST([USIZE32])
    336 
    337 AC_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 
    358 AC_CONFIG_HEADERS([config.h])
    359 
    360 AC_OUTPUT
    361 
    362 echo "Type \"make; make install\" to compile and install Speex";
    363