No need for --enable-new-plc anymore (always on)
[opus.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script. -*-m4-*-
2
3 AC_INIT(libcelt/arch.h)
4
5 AM_CONFIG_HEADER([config.h])
6
7 CELT_MAJOR_VERSION=0
8 CELT_MINOR_VERSION=8
9 CELT_MICRO_VERSION=0
10 CELT_EXTRA_VERSION=
11 CELT_VERSION=$CELT_MAJOR_VERSION.$CELT_MINOR_VERSION.$CELT_MICRO_VERSION$CELT_EXTRA_VERSION
12 LIBCELT_SUFFIX=0
13
14 CELT_LT_CURRENT=1
15 CELT_LT_REVISION=0
16 CELT_LT_AGE=0
17
18 AC_SUBST(CELT_LT_CURRENT)
19 AC_SUBST(CELT_LT_REVISION)
20 AC_SUBST(CELT_LT_AGE)
21 AC_SUBST(LIBCELT_SUFFIX)
22
23 # For automake.
24 VERSION=$CELT_VERSION
25 PACKAGE=celt
26
27 AC_SUBST(CELT_VERSION)
28
29 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
30 AM_MAINTAINER_MODE
31
32 AC_CANONICAL_HOST
33 AM_PROG_LIBTOOL
34
35 AC_PROG_CC_C99
36 AC_C_BIGENDIAN
37 AC_C_CONST
38 AC_C_INLINE
39 AC_C_RESTRICT
40
41 AC_DEFINE([CELT_BUILD], [], [This is a build of CELT])
42
43 AC_MSG_CHECKING(for C99 variable-size arrays)
44 AC_TRY_COMPILE( , [
45 int 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( [#include <alloca.h>], [
57 int foo=10;
58 int *array = alloca(foo);
59 ],
60 [
61 has_alloca=yes;
62 if test x$has_var_arrays = "xno" ; then
63 AC_DEFINE([USE_ALLOCA], [], [Make use of alloca])
64 fi
65 ],
66 has_alloca=no
67 )
68 AC_MSG_RESULT($has_alloca)
69
70 AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h)
71
72 AS_IF([test "x$with_ogg" != xno],
73  [XIPH_PATH_OGG([tools="tools"], [tools=""])],
74  [tools=""])
75 AC_SUBST(tools)
76
77 AC_CHECK_LIB(m, sin)
78
79 # Check for getopt_long; if not found, use included source.
80 AC_CHECK_FUNCS([getopt_long],,
81 [# FreeBSD has a gnugetopt library.
82   AC_CHECK_LIB([gnugetopt],[getopt_long],
83 [AC_DEFINE([HAVE_GETOPT_LONG])],
84 [# Use the GNU replacement.
85 AC_LIBOBJ(getopt)
86 AC_LIBOBJ(getopt1)])])
87
88 AC_CHECK_LIB(winmm, main)
89
90 AC_DEFINE_UNQUOTED(CELT_VERSION, "${CELT_VERSION}", [Complete version string])
91 AC_DEFINE_UNQUOTED(CELT_MAJOR_VERSION, ${CELT_MAJOR_VERSION}, [Version major])
92 AC_DEFINE_UNQUOTED(CELT_MINOR_VERSION, ${CELT_MINOR_VERSION}, [Version minor])
93 AC_DEFINE_UNQUOTED(CELT_MICRO_VERSION, ${CELT_MICRO_VERSION}, [Version micro])
94 AC_DEFINE_UNQUOTED(CELT_EXTRA_VERSION, "${CELT_EXTRA_VERSION}", [Version extra])
95
96 has_float_approx=no
97 #case "$host_cpu" in
98 #i[[3456]]86 | x86_64 | powerpc64 | powerpc32 | ia64)
99 #  has_float_approx=yes
100 #  ;;
101 #esac    
102
103 ac_enable_fixed="no";
104 AC_ARG_ENABLE(fixed-point, [  --enable-fixed-point    compile as fixed-point],
105 [if test "$enableval" = yes; then
106   ac_enable_fixed="yes";
107   AC_DEFINE([FIXED_POINT], , [Compile as fixed-point])
108   AC_DEFINE([DOUBLE_PRECISION], , [Compile as fixed-point])
109   AC_DEFINE([MIXED_PRECISION], , [Compile as fixed-point])
110 else
111   AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])
112 fi],
113 AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]))
114
115 ac_enable_fixed_debug="no"
116 AC_ARG_ENABLE(fixed-point-debug, [  --enable-fixed-point-debug  debug fixed-point implementation],
117 [if test "$enableval" = yes; then
118   ac_enable_fixed_debug="yes"
119   AC_DEFINE([FIXED_DEBUG], , [Debug fixed-point implementation])
120 fi])
121
122 float_approx=$has_float_approx
123 AC_ARG_ENABLE(float-approx, [  --disable-float-approx  do not use fast approximations for floating point],
124     [ if test "$enableval" = yes; then
125     AC_WARN([Floating point approximations are not supported on all platforms.])
126     float_approx=yes
127     else
128     float_approx=no
129     fi], [ float_approx=$has_float_approx ])
130
131 if test "x${float_approx}" = "xyes"; then
132     AC_DEFINE([FLOAT_APPROX], , [Float approximations])
133 fi
134
135 ac_enable_static_modes="no"
136 AC_ARG_ENABLE(static-modes, [  --enable-static-modes   use pre-computed codec configurations],
137 [if test "$enableval" = yes; then
138   ac_enable_static_modes="yes"
139   AC_DEFINE([STATIC_MODES], , [Static modes])
140 fi])
141
142 ac_enable_assertions="no"
143 AC_ARG_ENABLE(assertions, [  --enable-assertions     enable additional software error checking],
144 [if test "$enableval" = yes; then
145   ac_enable_assertions="yes"
146   AC_DEFINE([ENABLE_ASSERTIONS], , [Assertions])
147 fi])
148
149 saved_CFLAGS="$CFLAGS"
150 CFLAGS="$CFLAGS -fvisibility=hidden"
151 AC_MSG_CHECKING([if ${CXX} supports -fvisibility=hidden])
152 AC_COMPILE_IFELSE([char foo;],
153       [ AC_MSG_RESULT([yes])
154         SYMBOL_VISIBILITY="-fvisibility=hidden" ],
155         AC_MSG_RESULT([no]))
156 CFLAGS="$saved_CFLAGS $SYMBOL_VISIBILITY"
157 AC_SUBST(SYMBOL_VISIBILITY)
158
159 if test $ac_cv_c_compiler_gnu = yes ; then
160         CFLAGS="$CFLAGS -W -Wstrict-prototypes -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wno-parentheses -Wno-unused-parameter -Wno-sign-compare"
161 fi
162
163 AC_C99_FUNC_LRINTF
164 AC_C99_FUNC_LRINT
165
166 AC_CHECK_SIZEOF(short)
167 AC_CHECK_SIZEOF(int)
168 AC_CHECK_SIZEOF(long)
169 AC_CHECK_SIZEOF(long long)
170
171 if test x$has_char16 = "xyes" ; then
172         case 1 in
173                 $ac_cv_sizeof_short) SIZE16="short";;
174                 $ac_cv_sizeof_int) SIZE16="int";;
175         esac
176 else
177         case 2 in
178                 $ac_cv_sizeof_short) SIZE16="short";;
179                 $ac_cv_sizeof_int) SIZE16="int";;
180         esac
181 fi
182
183 if test x$has_char16 = "xyes" ; then
184         case 2 in
185                 $ac_cv_sizeof_int) SIZE32="int";;
186                 $ac_cv_sizeof_long) SIZE32="long";;
187                 $ac_cv_sizeof_short) SIZE32="short";;
188         esac
189 else
190         case 4 in
191                 $ac_cv_sizeof_int) SIZE32="int";;
192                 $ac_cv_sizeof_long) SIZE32="long";;
193                 $ac_cv_sizeof_short) SIZE32="short";;
194         esac
195 fi
196
197 AC_SUBST(SIZE16)
198 AC_SUBST(SIZE32)
199
200 AC_OUTPUT([Makefile libcelt/Makefile tests/Makefile 
201            celt.pc tools/Makefile libcelt.spec ])
202
203 AC_MSG_RESULT([
204 ------------------------------------------------------------------------
205   $PACKAGE $VERSION:  Automatic configuration OK.
206   
207     Compiler support:
208
209       C99 var arrays: ................ ${has_var_arrays}
210       C99 lrintf: .................... ${ac_cv_c99_lrintf}
211       Alloca: ........................ ${has_alloca}
212     
213     General configuration:
214     
215       Fast float approximations: ..... ${float_approx}
216       Fixed point support: ........... ${ac_enable_fixed}
217       Fixed point debugging: ......... ${ac_enable_fixed_debug}
218       Static modes: .................. ${ac_enable_static_modes}
219       Assertion checking: ............ ${ac_enable_assertions}
220 ------------------------------------------------------------------------
221 ])
222
223 if test "x$tools" = "x"; then 
224 echo "**IMPORTANT**"
225 echo "You don't seem to have the development package for libogg (libogg-devel) available. Only the library will be built (no encoder/decoder executable)"
226 echo "You can download libogg from http://www.vorbis.com/download.psp"
227 fi
228
229 echo "Type \"make; make install\" to compile and install";
230 echo "Type \"make check\" to run the test suite";