VS2008 project files.
[xiph/unicode.git] / speex / configure.ac
blob36a2e6c9e2c33e501fe96eb681b4853ebfe05c11
1 dnl Process this file with autoconf to produce a configure script. -*-m4-*-
3 AC_INIT(libspeex/speex.c)
5 AM_CONFIG_HEADER([config.h])
7 SPEEX_MAJOR_VERSION=1
8 SPEEX_MINOR_VERSION=1
9 SPEEX_MICRO_VERSION=16
10 SPEEX_EXTRA_VERSION=-git
11 #SPEEX_VERSION=
12 #SPEEX_VERSION=$SPEEX_MAJOR_VERSION.$SPEEX_MINOR_VERSION.$SPEEX_MICRO_VERSION$SPEEX_EXTRA_VERSION
13 SPEEX_VERSION="1.2rc1"
15 SPEEX_LT_CURRENT=5
16 SPEEX_LT_REVISION=0
17 SPEEX_LT_AGE=4
19 AC_SUBST(SPEEX_LT_CURRENT)
20 AC_SUBST(SPEEX_LT_REVISION)
21 AC_SUBST(SPEEX_LT_AGE)
23 # For automake.
24 VERSION=$SPEEX_VERSION
25 PACKAGE=speex
27 AC_SUBST(SPEEX_VERSION)
29 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
30 AM_MAINTAINER_MODE
32 AC_CANONICAL_HOST
33 AC_LIBTOOL_WIN32_DLL
34 AM_PROG_LIBTOOL
36 AC_C_BIGENDIAN
37 AC_C_CONST
38 AC_C_INLINE
39 AC_C_RESTRICT
42 AC_MSG_CHECKING(for C99 variable-size arrays)
43 AC_TRY_COMPILE( , [
44 int foo;
45 foo = 10;
46 int array[foo];
48 [has_var_arrays=yes;AC_DEFINE([VAR_ARRAYS], [], [Use C99 variable-size arrays])
50 has_var_arrays=no
52 AC_MSG_RESULT($has_var_arrays)
54 AC_CHECK_HEADERS([alloca.h getopt.h])
55 AC_MSG_CHECKING(for alloca)
56 AC_TRY_COMPILE( [
57 #ifdef HAVE_ALLOCA_H
58 # include <alloca.h>
59 #endif
60 #include <stdlib.h>
61 ], [
62 int foo=10;
63 int *array = alloca(foo);
66 has_alloca=yes;
67 if test x$has_var_arrays = "xno" ; then
68 AC_DEFINE([USE_ALLOCA], [], [Make use of alloca])
71 has_alloca=no
73 AC_MSG_RESULT($has_alloca)
75 AC_MSG_CHECKING(for SSE in current arch/CFLAGS)
76 AC_LINK_IFELSE([
77 AC_LANG_PROGRAM([[
78 #include <xmmintrin.h>
79 __m128 testfunc(float *a, float *b) {
80   return _mm_add_ps(_mm_loadu_ps(a), _mm_loadu_ps(b));
82 ]])],
84 has_sse=yes
87 has_sse=no
90 AC_MSG_RESULT($has_sse)  
92 SAVE_CFLAGS="$CFLAGS"
93 CFLAGS="$CFLAGS -fvisibility=hidden"
94 AC_MSG_CHECKING(for ELF visibility)
95 AC_COMPILE_IFELSE([
96 AC_LANG_PROGRAM([[
97 #pragma GCC visibility push(hidden)
98 __attribute__((visibility("default")))
99 int var=10;
100 ]])],
102 has_visibility=yes
103 AC_DEFINE([EXPORT], [__attribute__((visibility("default")))], [Symbol visibility prefix])
106 has_visibility=no
107 AC_DEFINE([EXPORT], [], [Symbol visibility prefix])
108 CFLAGS="$SAVE_CFLAGS"
111 AC_MSG_RESULT($has_visibility)
113 AC_ARG_WITH([gpl-fftw3], [AS_HELP_STRING([--with-gpl-fftw3@<:@=PATH@:>@],[enable experimental support for FFTW3 library for FFT. @<:@default=no@:>@])],[],[with_gpl_fftw3=no])
115 AS_IF([test "x$with_gpl_fftw3" != "xno"],
116   [if test "x$with_gpl_fftw3" != "xyes"; then
117      export PKG_CONFIG_PATH=$with_gpl_fftw3:$with_gpl_fftw3/lib/pkgconfig:$PKG_CONFIG_PATH
118    fi
119    PKG_CHECK_MODULES(FFTW3, fftw3f, [
120    AC_DEFINE([USE_GPL_FFTW3], [], [Use FFTW3 for FFT])
121    AC_SUBST([FFTW3_PKGCONFIG], [fftw3f])
122   ]])
125 AC_ARG_WITH([intel-mkl], [AS_HELP_STRING([--with-intel-mkl],[enable experimental support for Intel Math Kernel Library for FFT])],[],[with_intel_mkl=no])
126 AS_IF([test "x$with_intel_mkl" != "xno"],[
127  AC_MSG_CHECKING(for valid MKL)
128  AC_LINK_IFELSE([
129  AC_LANG_PROGRAM([[
130 #include <mkl.h>
131 void func() {
132   DFTI_DESCRIPTOR_HANDLE h;
133   MKL_LONG result=DftiCreateDescriptor(&h, DFTI_SINGLE, DFTI_REAL, 0);
135  ]])],
136   [
137    AC_DEFINE([USE_INTEL_MKL], [], [Use Intel Math Kernel Library for FFT])
138    AC_MSG_RESULT(yes)
139   ],
140   [
141    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.])
142   ]
146 AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h)
148 XIPH_PATH_OGG([src="src"], [src=""])
149 AC_SUBST(src)
151 AC_CHECK_LIB(m, sin)
153 # Check for getopt_long; if not found, use included source.
154 AC_CHECK_FUNCS([getopt_long],,
155 [# FreeBSD has a gnugetopt library.
156   AC_CHECK_LIB([gnugetopt],[getopt_long],
157 [AC_DEFINE([HAVE_GETOPT_LONG])],
158 [# Use the GNU replacement.
159 AC_LIBOBJ(getopt)
160 AC_LIBOBJ(getopt1)])])
162 AC_CHECK_LIB(winmm, main)
164 AC_DEFINE_UNQUOTED(SPEEX_VERSION, "${SPEEX_VERSION}", [Complete version string])
165 AC_DEFINE_UNQUOTED(SPEEX_MAJOR_VERSION, ${SPEEX_MAJOR_VERSION}, [Version major])
166 AC_DEFINE_UNQUOTED(SPEEX_MINOR_VERSION, ${SPEEX_MINOR_VERSION}, [Version minor])
167 AC_DEFINE_UNQUOTED(SPEEX_MICRO_VERSION, ${SPEEX_MICRO_VERSION}, [Version micro])
168 AC_DEFINE_UNQUOTED(SPEEX_EXTRA_VERSION, "${SPEEX_EXTRA_VERSION}", [Version extra])
170 AC_ARG_ENABLE(valgrind, [  --enable-valgrind       Enable valgrind extra checks],
171 [if test "$enableval" = yes; then
172   AC_DEFINE([ENABLE_VALGRIND], , [Enable valgrind extra checks])
173 fi])
175 AC_ARG_ENABLE(sse, [  --enable-sse            Enable SSE support], [
176 if test "x$enableval" != xno; then
177 has_sse=yes
178 CFLAGS="$CFLAGS -O3 -msse"
179 else
180 has_sse=no
184 if test "$has_sse" = yes; then
185   AC_DEFINE([_USE_SSE], , [Enable SSE support])
188 AC_ARG_ENABLE(fixed-point, [  --enable-fixed-point    Compile as fixed-point],
189 [if test "$enableval" = yes; then
190   AC_DEFINE([FIXED_POINT], , [Compile as fixed-point])
191 else
192   AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])
193 fi],
194 AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]))
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])
201 AC_ARG_ENABLE(vbr, [  --disable-vbr           Disable VBR and VAD from the codec],
202 [if test "$enableval" = no; then
203   AC_DEFINE([DISABLE_VBR], , [Disable VBR and VAD from the codec])
204 fi])
206 AC_ARG_ENABLE(arm4-asm, [  --enable-arm4-asm       Make use of ARM4 assembly optimizations],
207 [if test "$enableval" = yes; then
208   AC_DEFINE([ARM4_ASM], , [Make use of ARM4 assembly optimizations])
209 fi])
211 AC_ARG_ENABLE(arm5e-asm, [  --enable-arm5e-asm      Make use of ARM5E assembly optimizations],
212 [if test "$enableval" = yes; then
213   AC_DEFINE([ARM5E_ASM], , [Make use of ARM5E assembly optimizations])
214 fi])
216 AC_ARG_ENABLE(blackfin-asm, [  --enable-blackfin-asm   Make use of Blackfin assembly optimizations],
217 [if test "$enableval" = yes; then
218   AC_DEFINE([BFIN_ASM], , [Make use of Blackfin assembly optimizations])
219   LDFLAGS="-Wl,-elf2flt=-s100000"
220 fi])
222 AC_ARG_ENABLE(fixed-point-debug, [  --enable-fixed-point-debug  Debug fixed-point implementation],
223 [if test "$enableval" = yes; then
224   AC_DEFINE([FIXED_DEBUG], , [Debug fixed-point implementation])
225 fi])
227 AC_ARG_ENABLE(ti-c55x, [  --enable-ti-c55x        Enable support for TI C55X DSP],
228 [if test "$enableval" = yes; then
229   has_char16=yes;
230   AC_DEFINE([TI_C55X], , [Enable support for TI C55X DSP])
231 fi])
233 AC_CHECK_SIZEOF(short)
234 AC_CHECK_SIZEOF(int)
235 AC_CHECK_SIZEOF(long)
237 if test x$has_char16 = "xyes" ; then
238         case 1 in
239                 $ac_cv_sizeof_short) SIZE16="short";;
240                 $ac_cv_sizeof_int) SIZE16="int";;
241         esac
242 else
243         case 2 in
244                 $ac_cv_sizeof_short) SIZE16="short";;
245                 $ac_cv_sizeof_int) SIZE16="int";;
246         esac
249 if test x$has_char16 = "xyes" ; then
250         case 2 in
251                 $ac_cv_sizeof_int) SIZE32="int";;
252                 $ac_cv_sizeof_long) SIZE32="long";;
253                 $ac_cv_sizeof_short) SIZE32="short";;
254         esac
255 else
256         case 4 in
257                 $ac_cv_sizeof_int) SIZE32="int";;
258                 $ac_cv_sizeof_long) SIZE32="long";;
259                 $ac_cv_sizeof_short) SIZE32="short";;
260         esac
263 AC_SUBST(SIZE16)
264 AC_SUBST(SIZE32)
266 AC_OUTPUT([Makefile libspeex/Makefile src/Makefile doc/Makefile Speex.spec
267            include/Makefile include/speex/Makefile speex.pc speexdsp.pc
268            win32/Makefile win32/libspeex/Makefile win32/speexenc/Makefile
269            win32/speexdec/Makefile symbian/Makefile 
270            win32/VS2003/Makefile
271            win32/VS2003/tests/Makefile
272            win32/VS2003/libspeex/Makefile
273            win32/VS2003/libspeexdsp/Makefile
274            win32/VS2003/speexdec/Makefile
275            win32/VS2003/speexenc/Makefile
276            win32/VS2005/Makefile
277            win32/VS2005/libspeex/Makefile
278            win32/VS2005/speexdec/Makefile
279            win32/VS2005/speexenc/Makefile
280            win32/VS2005/libspeexdsp/Makefile
281            win32/VS2005/tests/Makefile
282            win32/VS2008/libspeexdsp/Makefile
283            win32/VS2008/Makefile
284            win32/VS2008/speexdec/Makefile
285            win32/VS2008/tests/Makefile
286            win32/VS2008/libspeex/Makefile
287            win32/VS2008/speexenc/Makefile
288            include/speex/speex_config_types.h ti/Makefile 
289            ti/speex_C54_test/Makefile ti/speex_C55_test/Makefile
290            ti/speex_C64_test/Makefile ])
292 if test "x$src" = "x"; then 
293 echo "**IMPORTANT**"
294 echo "You don't seem to have the development package for libogg (libogg-devel) installed. Only the Speex library (libspeex) will be built (no encoder/decoder executable)"
295 echo "You can download libogg from http://downloads.xiph.org/releases/ogg/"
298 echo "Type \"make; make install\" to compile and install Speex";