blob: ca526f414cdfe4af519d681895c68fceb7cfaef8 [file] [log] [blame]
Jean-Marc Valin63590892007-11-29 17:01:16 +11001dnl Process this file with autoconf to produce a configure script. -*-m4-*-
2
Jean-Marc Valin842b4452007-11-29 17:19:47 +11003AC_INIT(libcelt/arch.h)
Jean-Marc Valin63590892007-11-29 17:01:16 +11004
5AM_CONFIG_HEADER([config.h])
6
7CELT_MAJOR_VERSION=0
Jean-Marc Valinf080a152010-04-14 17:45:27 -04008CELT_MINOR_VERSION=8
9CELT_MICRO_VERSION=0
10CELT_EXTRA_VERSION=-git
Jean-Marc Valin842b4452007-11-29 17:19:47 +110011CELT_VERSION=$CELT_MAJOR_VERSION.$CELT_MINOR_VERSION.$CELT_MICRO_VERSION$CELT_EXTRA_VERSION
Thorvald Natvigdf726552010-01-16 08:06:41 -050012LIBCELT_SUFFIX=0
Jean-Marc Valin63590892007-11-29 17:01:16 +110013
14CELT_LT_CURRENT=0
15CELT_LT_REVISION=0
16CELT_LT_AGE=0
17
18AC_SUBST(CELT_LT_CURRENT)
19AC_SUBST(CELT_LT_REVISION)
20AC_SUBST(CELT_LT_AGE)
Thorvald Natvigdf726552010-01-16 08:06:41 -050021AC_SUBST(LIBCELT_SUFFIX)
Jean-Marc Valin63590892007-11-29 17:01:16 +110022
23# For automake.
24VERSION=$CELT_VERSION
Jean-Marc Valin842b4452007-11-29 17:19:47 +110025PACKAGE=celt
Jean-Marc Valin63590892007-11-29 17:01:16 +110026
27AC_SUBST(CELT_VERSION)
28
29AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
30AM_MAINTAINER_MODE
31
32AC_CANONICAL_HOST
33AM_PROG_LIBTOOL
34
Jean-Marc Valineafbdd52009-04-27 19:35:09 -040035AC_PROG_CC_C99
Jean-Marc Valin63590892007-11-29 17:01:16 +110036AC_C_BIGENDIAN
37AC_C_CONST
38AC_C_INLINE
39AC_C_RESTRICT
40
Peter Kirk19f9dc92008-06-06 14:38:38 +020041AC_DEFINE([CELT_BUILD], [], [This is a build of CELT])
Jean-Marc Valin63590892007-11-29 17:01:16 +110042
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
Jean-Marc Valine6233122008-02-01 16:27:38 +110054AC_CHECK_HEADERS([alloca.h getopt.h])
Jean-Marc Valin63590892007-11-29 17:01:16 +110055AC_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
Jean-Marc Valin63590892007-11-29 17:01:16 +110070AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h)
71
Gregory Maxwellc8e200b2009-03-11 13:13:19 -040072AS_IF([test "x$with_ogg" != xno],
73 [XIPH_PATH_OGG([tools="tools"], [tools=""])],
74 [tools=""])
Jean-Marc Valine6233122008-02-01 16:27:38 +110075AC_SUBST(tools)
Jean-Marc Valin63590892007-11-29 17:01:16 +110076
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
Jean-Marc Valin842b4452007-11-29 17:19:47 +110090AC_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])
Jean-Marc Valin63590892007-11-29 17:01:16 +110095
Gregory Maxwell065bc152009-06-24 16:43:33 -040096has_float_approx=no
97#case "$host_cpu" in
Gregory Maxwella80958b2009-06-29 12:48:57 -040098#i[[3456]]86 | x86_64 | powerpc64 | powerpc32 | ia64)
Gregory Maxwell065bc152009-06-24 16:43:33 -040099# has_float_approx=yes
100# ;;
101#esac
102
103ac_enable_fixed="no";
104AC_ARG_ENABLE(fixed-point, [ --enable-fixed-point compile as fixed-point],
Jean-Marc Valin49ca99e2008-02-25 14:05:10 +1100105[if test "$enableval" = yes; then
Gregory Maxwell065bc152009-06-24 16:43:33 -0400106 ac_enable_fixed="yes";
Jean-Marc Valin49ca99e2008-02-25 14:05:10 +1100107 AC_DEFINE([FIXED_POINT], , [Compile as fixed-point])
108 AC_DEFINE([DOUBLE_PRECISION], , [Compile as fixed-point])
Jean-Marc Valin980ad382008-03-12 11:47:19 +1100109 AC_DEFINE([MIXED_PRECISION], , [Compile as fixed-point])
Jean-Marc Valin49ca99e2008-02-25 14:05:10 +1100110else
111 AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])
112fi],
113AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]))
114
Gregory Maxwell065bc152009-06-24 16:43:33 -0400115ac_enable_fixed_debug="no"
116AC_ARG_ENABLE(fixed-point-debug, [ --enable-fixed-point-debug debug fixed-point implementation],
Jean-Marc Valin49ca99e2008-02-25 14:05:10 +1100117[if test "$enableval" = yes; then
Gregory Maxwell065bc152009-06-24 16:43:33 -0400118 ac_enable_fixed_debug="yes"
Jean-Marc Valin49ca99e2008-02-25 14:05:10 +1100119 AC_DEFINE([FIXED_DEBUG], , [Debug fixed-point implementation])
120fi])
121
Gregory Maxwell065bc152009-06-24 16:43:33 -0400122float_approx=$has_float_approx
123AC_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
131if test "x${float_approx}" = "xyes"; then
132 AC_DEFINE([FLOAT_APPROX], , [Float approximations])
133fi
134
135ac_enable_static_modes="no"
136AC_ARG_ENABLE(static-modes, [ --enable-static-modes use pre-computed codec configurations],
Jean-Marc Valin980ad382008-03-12 11:47:19 +1100137[if test "$enableval" = yes; then
Gregory Maxwell065bc152009-06-24 16:43:33 -0400138 ac_enable_static_modes="yes"
Jean-Marc Valin980ad382008-03-12 11:47:19 +1100139 AC_DEFINE([STATIC_MODES], , [Static modes])
140fi])
141
Gregory Maxwell065bc152009-06-24 16:43:33 -0400142ac_enable_assertions="no"
143AC_ARG_ENABLE(assertions, [ --enable-assertions enable additional software error checking],
Jean-Marc Valin4ff068e2008-03-15 23:34:39 +1100144[if test "$enableval" = yes; then
Gregory Maxwell065bc152009-06-24 16:43:33 -0400145 ac_enable_assertions="yes"
Jean-Marc Valin4ff068e2008-03-15 23:34:39 +1100146 AC_DEFINE([ENABLE_ASSERTIONS], , [Assertions])
147fi])
148
Gregory Maxwell065bc152009-06-24 16:43:33 -0400149ac_enable_new_plc="no"
150AC_ARG_ENABLE(new-plc, [ --enable-new-plc enable the new loss concealment code],
Jean-Marc Valineafbdd52009-04-27 19:35:09 -0400151[if test "$enableval" = yes; then
Gregory Maxwell065bc152009-06-24 16:43:33 -0400152 ac_enable_new_plc="yes"
Jean-Marc Valineafbdd52009-04-27 19:35:09 -0400153 AC_DEFINE([NEW_PLC], , [Use new PLC code])
154fi])
155
Jean-Marc Valin4c9a0072008-12-23 09:53:36 -0500156saved_CFLAGS="$CFLAGS"
157CFLAGS="$CFLAGS -fvisibility=hidden"
158AC_MSG_CHECKING([if ${CXX} supports -fvisibility=hidden])
159AC_COMPILE_IFELSE([char foo;],
160 [ AC_MSG_RESULT([yes])
161 SYMBOL_VISIBILITY="-fvisibility=hidden" ],
162 AC_MSG_RESULT([no]))
163CFLAGS="$saved_CFLAGS $SYMBOL_VISIBILITY"
164AC_SUBST(SYMBOL_VISIBILITY)
165
Jean-Marc Valin679f5cc2008-03-13 17:39:55 +1100166if test $ac_cv_c_compiler_gnu = yes ; then
Jean-Marc Valin4c9a0072008-12-23 09:53:36 -0500167 CFLAGS="$CFLAGS -W -Wstrict-prototypes -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wno-parentheses -Wno-unused-parameter -Wno-sign-compare"
Jean-Marc Valin679f5cc2008-03-13 17:39:55 +1100168fi
Jean-Marc Valin49ca99e2008-02-25 14:05:10 +1100169
Jean-Marc Valind9b95652008-08-31 23:34:47 -0400170AC_C99_FUNC_LRINTF
171AC_C99_FUNC_LRINT
172
Jean-Marc Valin63590892007-11-29 17:01:16 +1100173AC_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
Christopher Montgomery41d819d2009-01-13 13:39:53 -0500207AC_OUTPUT([Makefile libcelt/Makefile tests/Makefile
208 celt.pc tools/Makefile libcelt.spec ])
Jean-Marc Valin63590892007-11-29 17:01:16 +1100209
Gregory Maxwell065bc152009-06-24 16:43:33 -0400210AC_MSG_RESULT([
211------------------------------------------------------------------------
212 $PACKAGE $VERSION: Automatic configuration OK.
213
214 Compiler support:
215
216 C99 var arrays: ................ ${has_var_arrays}
217 C99 lrintf: .................... ${ac_cv_c99_lrintf}
218 Alloca: ........................ ${has_alloca}
219
220 General configuration:
221
222 Fast float approximations: ..... ${float_approx}
223 Fixed point support: ........... ${ac_enable_fixed}
224 Fixed point debugging: ......... ${ac_enable_fixed_debug}
225 Static modes: .................. ${ac_enable_static_modes}
226 Assertion checking: ............ ${ac_enable_assertions}
227 New PLC: ....................... ${ac_enable_new_plc}
228------------------------------------------------------------------------
229])
230
Jean-Marc Valine6233122008-02-01 16:27:38 +1100231if test "x$tools" = "x"; then
Jean-Marc Valin63590892007-11-29 17:01:16 +1100232echo "**IMPORTANT**"
Gregory Maxwellc8e200b2009-03-11 13:13:19 -0400233echo "You don't seem to have the development package for libogg (libogg-devel) available. Only the library will be built (no encoder/decoder executable)"
Jean-Marc Valin63590892007-11-29 17:01:16 +1100234echo "You can download libogg from http://www.vorbis.com/download.psp"
235fi
236
237echo "Type \"make; make install\" to compile and install";
Gregory Maxwell065bc152009-06-24 16:43:33 -0400238echo "Type \"make check\" to run the test suite";