Swap code/variable declaration to be pre-C99 compliant.
[xiph/unicode.git] / speex / configure.ac
blobc0e7523225e0e1cc8701bf1285f66865ec1c3b57
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=13
10 SPEEX_EXTRA_VERSION=-svn
11 #SPEEX_VERSION=
12 SPEEX_VERSION=$SPEEX_MAJOR_VERSION.$SPEEX_MINOR_VERSION.$SPEEX_MICRO_VERSION$SPEEX_EXTRA_VERSION
14 SPEEX_LT_CURRENT=3
15 SPEEX_LT_REVISION=0
16 SPEEX_LT_AGE=2
18 AC_SUBST(SPEEX_LT_CURRENT)
19 AC_SUBST(SPEEX_LT_REVISION)
20 AC_SUBST(SPEEX_LT_AGE)
22 # For automake.
23 VERSION=$SPEEX_VERSION
24 PACKAGE=speex
26 AC_SUBST(SPEEX_VERSION)
28 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
29 AM_MAINTAINER_MODE
31 AC_CANONICAL_HOST
32 AM_PROG_LIBTOOL
34 AC_C_BIGENDIAN
35 AC_C_CONST
36 AC_C_INLINE
37 AC_C_RESTRICT
40 AC_MSG_CHECKING(for C99 variable-size arrays)
41 AC_TRY_COMPILE( , [
42 int foo=10;
43 int array[foo];
45 [has_var_arrays=yes;AC_DEFINE([VAR_ARRAYS], [], [Use C99 variable-size arrays])
47 has_var_arrays=no
49 AC_MSG_RESULT($has_var_arrays)
51 AC_MSG_CHECKING(for alloca)
52 AC_TRY_COMPILE( [#include <alloca.h>], [
53 int foo=10;
54 int *array = alloca(foo);
57 has_alloca=yes;
58 if test x$has_var_arrays = "xno" ; then
59 AC_DEFINE([USE_ALLOCA], [], [Make use of alloca])
62 has_alloca=no
64 AC_MSG_RESULT($has_alloca)
67 AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h)
69 XIPH_PATH_OGG([src="src"], [src=""])
70 AC_SUBST(src)
72 AC_CHECK_LIB(m, sin)
74 # Check for getopt_long; if not found, use included source.
75 AC_CHECK_FUNCS([getopt_long],,
76 [# FreeBSD has a gnugetopt library.
77   AC_CHECK_LIB([gnugetopt],[getopt_long],
78 [AC_DEFINE([HAVE_GETOPT_LONG])],
79 [# Use the GNU replacement.
80 AC_LIBOBJ(getopt)
81 AC_LIBOBJ(getopt1)])])
83 AC_CHECK_LIB(winmm, main)
85 AC_DEFINE_UNQUOTED(SPEEX_VERSION, "${SPEEX_VERSION}", [Complete version string])
86 AC_DEFINE_UNQUOTED(SPEEX_MAJOR_VERSION, ${SPEEX_MAJOR_VERSION}, [Version major])
87 AC_DEFINE_UNQUOTED(SPEEX_MINOR_VERSION, ${SPEEX_MINOR_VERSION}, [Version minor])
88 AC_DEFINE_UNQUOTED(SPEEX_MICRO_VERSION, ${SPEEX_MICRO_VERSION}, [Version micro])
89 AC_DEFINE_UNQUOTED(SPEEX_EXTRA_VERSION, "${SPEEX_EXTRA_VERSION}", [Version extra])
91 AC_ARG_ENABLE(wideband, [  --disable-wideband      Disable wideband codec],
92 [if test "$enableval" = no; then
93   AC_DEFINE([DISABLE_WIDEBAND], , [Disable wideband codec])
94 fi])
96 AC_ARG_ENABLE(vorbis-psy, [  --enable-vorbis-psy       Enable Vorbis-style psychoacoustics],
97 [if test "$enableval" = yes; then
98   AC_DEFINE([VORBIS_PSYCHO], , [Enable Vorbis-style psychoacoustics])
99 fi])
101 AC_ARG_ENABLE(valgrind, [  --enable-valgrind       Enable valgrind extra checks],
102 [if test "$enableval" = yes; then
103   AC_DEFINE([ENABLE_VALGRIND], , [Enable valgrind extra checks])
104 fi])
106 AC_ARG_ENABLE(sse, [  --enable-sse            Enable SSE support], [if test "$enableval" = yes; then
107 AC_DEFINE([_USE_SSE], , [Enable SSE support])
108 CFLAGS="$CFLAGS -O3 -msse"
112 AC_ARG_ENABLE(fixed-point, [  --enable-fixed-point    Compile as fixed-point],
113 [if test "$enableval" = yes; then
114   AC_DEFINE([FIXED_POINT], , [Compile as fixed-point])
115 fi])
117 AC_ARG_ENABLE(arm4-asm, [  --enable-arm4-asm       Make use of ARM4 assembly optimizations],
118 [if test "$enableval" = yes; then
119   AC_DEFINE([ARM4_ASM], , [Make use of ARM4 assembly optimizations])
120 fi])
122 AC_ARG_ENABLE(arm5e-asm, [  --enable-arm5e-asm      Make use of ARM5E assembly optimizations],
123 [if test "$enableval" = yes; then
124   AC_DEFINE([ARM5E_ASM], , [Make use of ARM5E assembly optimizations])
125 fi])
127 AC_ARG_ENABLE(blackfin-asm, [  --enable-blackfin-asm      Make use of Blackfin assembly optimizations],
128 [if test "$enableval" = yes; then
129   AC_DEFINE([BFIN_ASM], , [Make use of Blackfin assembly optimizations])
130   LDFLAGS="-Wl,-elf2flt=-s100000"
131 fi])
133 AC_ARG_ENABLE(fixed-point-debug, [  --enable-fixed-point-debug  Debug fixed-point implementation],
134 [if test "$enableval" = yes; then
135   AC_DEFINE([FIXED_DEBUG], , [Debug fixed-point implementation])
136 fi])
138 AC_ARG_ENABLE(epic-48k, [  --enable-epic-48k       Enable support for Epic 4.8 kbps mode],
139 [if test "$enableval" = yes; then
140   AC_DEFINE([EPIC_48K], , [Enable support for Epic 4.8 kbps mode])
141 fi])
143 AC_ARG_ENABLE(ti-c55x, [  --enable-ti-c55x        Enable support for TI C55X DSP],
144 [if test "$enableval" = yes; then
145   has_char16=yes;
146   AC_DEFINE([TI_C55X], , [Enable support for TI C55X DSP])
147 fi])
149 AC_ARG_ENABLE(16bit-precision, [  --enable-16bit-precision Reduce precision to 16 bits (EXPERIMENTAL)],
150 [if test "$enableval" = yes; then
151   AC_DEFINE([PRECISION16], , [Reduce precision to 16 bits (EXPERIMENTAL)])
152 fi])
154 AC_CHECK_SIZEOF(short)
155 AC_CHECK_SIZEOF(int)
156 AC_CHECK_SIZEOF(long)
158 if test x$has_char16 = "xyes" ; then
159         case 1 in
160                 $ac_cv_sizeof_short) SIZE16="short";;
161                 $ac_cv_sizeof_int) SIZE16="int";;
162         esac
163 else
164         case 2 in
165                 $ac_cv_sizeof_short) SIZE16="short";;
166                 $ac_cv_sizeof_int) SIZE16="int";;
167         esac
170 if test x$has_char16 = "xyes" ; then
171         case 2 in
172                 $ac_cv_sizeof_int) SIZE32="int";;
173                 $ac_cv_sizeof_long) SIZE32="long";;
174                 $ac_cv_sizeof_short) SIZE32="short";;
175         esac
176 else
177         case 4 in
178                 $ac_cv_sizeof_int) SIZE32="int";;
179                 $ac_cv_sizeof_long) SIZE32="long";;
180                 $ac_cv_sizeof_short) SIZE32="short";;
181         esac
184 AC_SUBST(SIZE16)
185 AC_SUBST(SIZE32)
187 AC_OUTPUT([Makefile libspeex/Makefile src/Makefile doc/Makefile Speex.spec
188            include/Makefile include/speex/Makefile speex.pc
189            win32/Makefile win32/libspeex/Makefile win32/speexenc/Makefile
190            win32/speexdec/Makefile symbian/Makefile 
191            win32/VS2003/Makefile win32/VS2005/Makefile
192            win32/VS2003/libspeex/Makefile
193            win32/VS2003/speexdec/Makefile
194            win32/VS2003/speexenc/Makefile
195            win32/VS2005/libspeex/Makefile
196            win32/VS2005/speexdec/Makefile
197            win32/VS2005/speexenc/Makefile
198            include/speex/speex_config_types.h ti/Makefile 
199            ti/speex_C54_test/Makefile ti/speex_C55_test/Makefile
200            ti/speex_C64_test/Makefile ])
202 if test "x$src" = "x"; then 
203 echo "**IMPORTANT**"
204 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)"
205 echo "You can download libogg from http://downloads.xiph.org/releases/ogg/"
208 echo "Type \"make; make install\" to compile and install Speex";