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