Update tizen 2.0 beta source
[external/speex.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script. -*-m4-*-
2
3 AC_INIT(libspeex/speex.c)
4
5 AM_CONFIG_HEADER([config.h])
6
7 SPEEX_MAJOR_VERSION=1
8 SPEEX_MINOR_VERSION=1
9 SPEEX_MICRO_VERSION=16
10 SPEEX_EXTRA_VERSION=
11 #SPEEX_VERSION=
12 #SPEEX_VERSION=$SPEEX_MAJOR_VERSION.$SPEEX_MINOR_VERSION.$SPEEX_MICRO_VERSION$SPEEX_EXTRA_VERSION
13 SPEEX_VERSION="1.2rc1"
14
15 SPEEX_LT_CURRENT=6
16 SPEEX_LT_REVISION=0
17 SPEEX_LT_AGE=5
18
19 AC_SUBST(SPEEX_LT_CURRENT)
20 AC_SUBST(SPEEX_LT_REVISION)
21 AC_SUBST(SPEEX_LT_AGE)
22
23 # For automake.
24 VERSION=$SPEEX_VERSION
25 PACKAGE=speex
26
27 AC_SUBST(SPEEX_VERSION)
28
29 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
30 AM_MAINTAINER_MODE
31
32 AC_CANONICAL_HOST
33 AC_LIBTOOL_WIN32_DLL
34 AM_PROG_LIBTOOL
35
36 AC_C_BIGENDIAN
37 AC_C_CONST
38 AC_C_INLINE
39 AC_C_RESTRICT
40
41
42 AC_MSG_CHECKING(for C99 variable-size arrays)
43 AC_TRY_COMPILE( , [
44 int foo;
45 foo = 10;
46 int array[foo];
47 ],
48 [has_var_arrays=yes;AC_DEFINE([VAR_ARRAYS], [], [Use C99 variable-size arrays])
49 ],
50 has_var_arrays=no
51 )
52 AC_MSG_RESULT($has_var_arrays)
53
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);
64 ],
65 [
66 has_alloca=yes;
67 if test x$has_var_arrays = "xno" ; then
68 AC_DEFINE([USE_ALLOCA], [], [Make use of alloca])
69 fi
70 ],
71 has_alloca=no
72 )
73 AC_MSG_RESULT($has_alloca)
74
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));
81 }
82 ]])],
83 [
84 has_sse=yes
85 ],
86 [
87 has_sse=no
88 ]
89 )
90 AC_MSG_RESULT($has_sse)  
91
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 ]])],
101 [
102 has_visibility=yes
103 AC_DEFINE([EXPORT], [__attribute__((visibility("default")))], [Symbol visibility prefix])
104 ],
105 [
106 has_visibility=no
107 AC_DEFINE([EXPORT], [], [Symbol visibility prefix])
108 CFLAGS="$SAVE_CFLAGS"
109 ]
110 )
111 AC_MSG_RESULT($has_visibility)
112
113 AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h)
114
115 XIPH_PATH_OGG([src="src"], [src=""])
116 AC_SUBST(src)
117
118 AC_CHECK_LIB(m, sin)
119
120 # Check for getopt_long; if not found, use included source.
121 AC_CHECK_FUNCS([getopt_long],,
122 [# FreeBSD has a gnugetopt library.
123   AC_CHECK_LIB([gnugetopt],[getopt_long],
124 [AC_DEFINE([HAVE_GETOPT_LONG])],
125 [# Use the GNU replacement.
126 AC_LIBOBJ(getopt)
127 AC_LIBOBJ(getopt1)])])
128
129 AC_CHECK_LIB(winmm, main)
130
131 AC_DEFINE_UNQUOTED(SPEEX_VERSION, "${SPEEX_VERSION}", [Complete version string])
132 AC_DEFINE_UNQUOTED(SPEEX_MAJOR_VERSION, ${SPEEX_MAJOR_VERSION}, [Version major])
133 AC_DEFINE_UNQUOTED(SPEEX_MINOR_VERSION, ${SPEEX_MINOR_VERSION}, [Version minor])
134 AC_DEFINE_UNQUOTED(SPEEX_MICRO_VERSION, ${SPEEX_MICRO_VERSION}, [Version micro])
135 AC_DEFINE_UNQUOTED(SPEEX_EXTRA_VERSION, "${SPEEX_EXTRA_VERSION}", [Version extra])
136
137 AC_ARG_ENABLE(valgrind, [  --enable-valgrind       Enable valgrind extra checks],
138 [if test "$enableval" = yes; then
139   AC_DEFINE([ENABLE_VALGRIND], , [Enable valgrind extra checks])
140 fi])
141
142 AC_ARG_ENABLE(sse, [  --enable-sse            Enable SSE support], [
143 if test "x$enableval" != xno; then
144 has_sse=yes
145 CFLAGS="$CFLAGS -O3 -msse"
146 else
147 has_sse=no
148 fi
149 ])
150
151
152 FFT=smallft
153
154 AC_ARG_ENABLE(fixed-point, [  --enable-fixed-point    Compile as fixed-point],
155 [if test "$enableval" = yes; then
156   FFT=kiss
157   has_sse=no
158   AC_DEFINE([FIXED_POINT], , [Compile as fixed-point])
159 else
160   AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])
161 fi],
162 AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]))
163
164 if test "$has_sse" = yes; then
165   AC_DEFINE([_USE_SSE], , [Enable SSE support])
166 fi
167
168 AC_ARG_ENABLE(float-api, [  --disable-float-api     Disable the floating-point API],
169 [if test "$enableval" = no; then
170   AC_DEFINE([DISABLE_FLOAT_API], , [Disable all parts of the API that are using floats])
171 fi])
172
173 AC_ARG_ENABLE(vbr, [  --disable-vbr           Disable VBR and VAD from the codec],
174 [if test "$enableval" = no; then
175   AC_DEFINE([DISABLE_VBR], , [Disable VBR and VAD from the codec])
176 fi])
177
178 AC_ARG_ENABLE(arm4-asm, [  --enable-arm4-asm       Make use of ARM4 assembly optimizations],
179 [if test "$enableval" = yes; then
180   AC_DEFINE([ARM4_ASM], , [Make use of ARM4 assembly optimizations])
181 fi])
182
183 AC_ARG_ENABLE(arm5e-asm, [  --enable-arm5e-asm      Make use of ARM5E assembly optimizations],
184 [if test "$enableval" = yes; then
185   AC_DEFINE([ARM5E_ASM], , [Make use of ARM5E assembly optimizations])
186 fi])
187
188 AC_ARG_ENABLE(blackfin-asm, [  --enable-blackfin-asm   Make use of Blackfin assembly optimizations],
189 [if test "$enableval" = yes; then
190   AC_DEFINE([BFIN_ASM], , [Make use of Blackfin assembly optimizations])
191   LDFLAGS="-Wl,-elf2flt=-s100000"
192 fi])
193
194 AC_ARG_ENABLE(fixed-point-debug, [  --enable-fixed-point-debug  Debug fixed-point implementation],
195 [if test "$enableval" = yes; then
196   AC_DEFINE([FIXED_DEBUG], , [Debug fixed-point implementation])
197 fi])
198
199 AC_ARG_ENABLE(ti-c55x, [  --enable-ti-c55x        Enable support for TI C55X DSP],
200 [if test "$enableval" = yes; then
201   has_char16=yes;
202   AC_DEFINE([TI_C55X], , [Enable support for TI C55X DSP])
203 fi])
204
205 AC_ARG_WITH([fft], [AS_HELP_STRING([--with-fft=choice],[use an alternate FFT implementation. The available choices are
206 kiss (default fixed point), smallft (default floating point), gpl-fftw3 and proprietary-intel-mkl])],
207 [FFT=$withval]
208 )
209
210 FFT_PKGCONFIG=
211 AS_CASE([$FFT],
212  [kiss], [
213   AC_DEFINE([USE_KISS_FFT], [], [Use KISS Fast Fourier Transform])
214  ],
215  [smallft], [
216   AC_DEFINE([USE_SMALLFT], [], [Use FFT from OggVorbis])
217  ],
218  [gpl-fftw3], [
219   AC_DEFINE([USE_GPL_FFTW3], [], [Use FFTW3 for FFT])
220   PKG_CHECK_MODULES(FFT, fftw3f)
221  ],
222  [proprietary-intel-mkl], [
223   AC_DEFINE([USE_INTEL_MKL], [], [Use Intel Math Kernel Library for FFT])
224   AC_MSG_CHECKING(for valid MKL)
225   AC_LINK_IFELSE([
226    AC_LANG_PROGRAM([[
227 #include <mkl.h>
228 void func() {
229   DFTI_DESCRIPTOR_HANDLE h;
230   MKL_LONG result=DftiCreateDescriptor(&h, DFTI_SINGLE, DFTI_REAL, 0);
231 }]])],
232    [AC_MSG_RESULT(yes)],
233    [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.])]
234   )
235  ],
236  [AC_MSG_FAILURE([Unknown FFT $FFT specified for --with-fft])]
237 )
238 AM_CONDITIONAL(BUILD_KISS_FFT, [test "$FFT" = "kiss"])
239 AM_CONDITIONAL(BUILD_SMALLFT, [test "$FFT" = "smallft"])
240 AC_SUBST(FFT_PKGCONFIG)
241
242
243 AC_CHECK_SIZEOF(short)
244 AC_CHECK_SIZEOF(int)
245 AC_CHECK_SIZEOF(long)
246
247 if test x$has_char16 = "xyes" ; then
248         case 1 in
249                 $ac_cv_sizeof_short) SIZE16="short";;
250                 $ac_cv_sizeof_int) SIZE16="int";;
251         esac
252 else
253         case 2 in
254                 $ac_cv_sizeof_short) SIZE16="short";;
255                 $ac_cv_sizeof_int) SIZE16="int";;
256         esac
257 fi
258
259 if test x$has_char16 = "xyes" ; then
260         case 2 in
261                 $ac_cv_sizeof_int) SIZE32="int";;
262                 $ac_cv_sizeof_long) SIZE32="long";;
263                 $ac_cv_sizeof_short) SIZE32="short";;
264         esac
265 else
266         case 4 in
267                 $ac_cv_sizeof_int) SIZE32="int";;
268                 $ac_cv_sizeof_long) SIZE32="long";;
269                 $ac_cv_sizeof_short) SIZE32="short";;
270         esac
271 fi
272
273 AC_SUBST(SIZE16)
274 AC_SUBST(SIZE32)
275
276 AC_OUTPUT([Makefile libspeex/Makefile src/Makefile doc/Makefile
277            include/Makefile include/speex/Makefile speex.pc speexdsp.pc
278            win32/Makefile win32/libspeex/Makefile win32/speexenc/Makefile
279            win32/speexdec/Makefile symbian/Makefile 
280            win32/VS2003/Makefile
281            win32/VS2003/tests/Makefile
282            win32/VS2003/libspeex/Makefile
283            win32/VS2003/libspeexdsp/Makefile
284            win32/VS2003/speexdec/Makefile
285            win32/VS2003/speexenc/Makefile
286            win32/VS2005/Makefile
287            win32/VS2005/libspeex/Makefile
288            win32/VS2005/speexdec/Makefile
289            win32/VS2005/speexenc/Makefile
290            win32/VS2005/libspeexdsp/Makefile
291            win32/VS2005/tests/Makefile
292            win32/VS2008/libspeexdsp/Makefile
293            win32/VS2008/Makefile
294            win32/VS2008/speexdec/Makefile
295            win32/VS2008/tests/Makefile
296            win32/VS2008/libspeex/Makefile
297            win32/VS2008/speexenc/Makefile
298            include/speex/speex_config_types.h ti/Makefile 
299            ti/speex_C54_test/Makefile ti/speex_C55_test/Makefile
300            ti/speex_C64_test/Makefile ])
301
302 if test "x$src" = "x"; then 
303 echo "**IMPORTANT**"
304 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)"
305 echo "You can download libogg from http://downloads.xiph.org/releases/ogg/"
306 fi
307
308 echo "Type \"make; make install\" to compile and install Speex";