blob: f148b741443e415c4c192fbf4c4aaa8d2b881362 [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 Valin6ca7f102009-06-23 21:23:18 -04008CELT_MINOR_VERSION=6
9CELT_MICRO_VERSION=0
Jean-Marc Valin14f5e7c2008-02-21 23:59:17 +110010CELT_EXTRA_VERSION=
Jean-Marc Valin842b4452007-11-29 17:19:47 +110011CELT_VERSION=$CELT_MAJOR_VERSION.$CELT_MINOR_VERSION.$CELT_MICRO_VERSION$CELT_EXTRA_VERSION
Jean-Marc Valin63590892007-11-29 17:01:16 +110012
13CELT_LT_CURRENT=0
14CELT_LT_REVISION=0
15CELT_LT_AGE=0
16
17AC_SUBST(CELT_LT_CURRENT)
18AC_SUBST(CELT_LT_REVISION)
19AC_SUBST(CELT_LT_AGE)
20
21# For automake.
22VERSION=$CELT_VERSION
Jean-Marc Valin842b4452007-11-29 17:19:47 +110023PACKAGE=celt
Jean-Marc Valin63590892007-11-29 17:01:16 +110024
25AC_SUBST(CELT_VERSION)
26
27AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
28AM_MAINTAINER_MODE
29
30AC_CANONICAL_HOST
31AM_PROG_LIBTOOL
32
Jean-Marc Valineafbdd52009-04-27 19:35:09 -040033AC_PROG_CC_C99
Jean-Marc Valin63590892007-11-29 17:01:16 +110034AC_C_BIGENDIAN
35AC_C_CONST
36AC_C_INLINE
37AC_C_RESTRICT
38
Peter Kirk19f9dc92008-06-06 14:38:38 +020039AC_DEFINE([CELT_BUILD], [], [This is a build of CELT])
Jean-Marc Valin63590892007-11-29 17:01:16 +110040
41AC_MSG_CHECKING(for C99 variable-size arrays)
42AC_TRY_COMPILE( , [
43int foo=10;
44int array[foo];
45],
46[has_var_arrays=yes;AC_DEFINE([VAR_ARRAYS], [], [Use C99 variable-size arrays])
47],
48has_var_arrays=no
49)
50AC_MSG_RESULT($has_var_arrays)
51
Jean-Marc Valine6233122008-02-01 16:27:38 +110052AC_CHECK_HEADERS([alloca.h getopt.h])
Jean-Marc Valin63590892007-11-29 17:01:16 +110053AC_MSG_CHECKING(for alloca)
54AC_TRY_COMPILE( [#include <alloca.h>], [
55int foo=10;
56int *array = alloca(foo);
57],
58[
59has_alloca=yes;
60if test x$has_var_arrays = "xno" ; then
61AC_DEFINE([USE_ALLOCA], [], [Make use of alloca])
62fi
63],
64has_alloca=no
65)
66AC_MSG_RESULT($has_alloca)
67
Jean-Marc Valin63590892007-11-29 17:01:16 +110068AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h)
69
Gregory Maxwellc8e200b2009-03-11 13:13:19 -040070AS_IF([test "x$with_ogg" != xno],
71 [XIPH_PATH_OGG([tools="tools"], [tools=""])],
72 [tools=""])
Jean-Marc Valine6233122008-02-01 16:27:38 +110073AC_SUBST(tools)
Jean-Marc Valin63590892007-11-29 17:01:16 +110074
75AC_CHECK_LIB(m, sin)
76
77# Check for getopt_long; if not found, use included source.
78AC_CHECK_FUNCS([getopt_long],,
79[# FreeBSD has a gnugetopt library.
80 AC_CHECK_LIB([gnugetopt],[getopt_long],
81[AC_DEFINE([HAVE_GETOPT_LONG])],
82[# Use the GNU replacement.
83AC_LIBOBJ(getopt)
84AC_LIBOBJ(getopt1)])])
85
86AC_CHECK_LIB(winmm, main)
87
Jean-Marc Valin842b4452007-11-29 17:19:47 +110088AC_DEFINE_UNQUOTED(CELT_VERSION, "${CELT_VERSION}", [Complete version string])
89AC_DEFINE_UNQUOTED(CELT_MAJOR_VERSION, ${CELT_MAJOR_VERSION}, [Version major])
90AC_DEFINE_UNQUOTED(CELT_MINOR_VERSION, ${CELT_MINOR_VERSION}, [Version minor])
91AC_DEFINE_UNQUOTED(CELT_MICRO_VERSION, ${CELT_MICRO_VERSION}, [Version micro])
92AC_DEFINE_UNQUOTED(CELT_EXTRA_VERSION, "${CELT_EXTRA_VERSION}", [Version extra])
Jean-Marc Valin63590892007-11-29 17:01:16 +110093
Jean-Marc Valin49ca99e2008-02-25 14:05:10 +110094AC_ARG_ENABLE(fixed-point, [ --enable-fixed-point Compile as fixed-point],
95[if test "$enableval" = yes; then
96 AC_DEFINE([FIXED_POINT], , [Compile as fixed-point])
97 AC_DEFINE([DOUBLE_PRECISION], , [Compile as fixed-point])
Jean-Marc Valin980ad382008-03-12 11:47:19 +110098 AC_DEFINE([MIXED_PRECISION], , [Compile as fixed-point])
Jean-Marc Valin49ca99e2008-02-25 14:05:10 +110099else
100 AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])
101fi],
102AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]))
103
104AC_ARG_ENABLE(fixed-point-debug, [ --enable-fixed-point-debug Debug fixed-point implementation],
105[if test "$enableval" = yes; then
106 AC_DEFINE([FIXED_DEBUG], , [Debug fixed-point implementation])
107fi])
108
Jean-Marc Valin980ad382008-03-12 11:47:19 +1100109AC_ARG_ENABLE(static-modes, [ --enable-static-modes],
110[if test "$enableval" = yes; then
111 AC_DEFINE([STATIC_MODES], , [Static modes])
112fi])
113
Jean-Marc Valin4ff068e2008-03-15 23:34:39 +1100114AC_ARG_ENABLE(assertions, [ --enable-assertions],
115[if test "$enableval" = yes; then
116 AC_DEFINE([ENABLE_ASSERTIONS], , [Assertions])
117fi])
118
Jean-Marc Valineafbdd52009-04-27 19:35:09 -0400119AC_ARG_ENABLE(new-plc, [ --enable-new-plc],
120[if test "$enableval" = yes; then
121 AC_DEFINE([NEW_PLC], , [Use new PLC code])
122fi])
123
Jean-Marc Valin4c9a0072008-12-23 09:53:36 -0500124saved_CFLAGS="$CFLAGS"
125CFLAGS="$CFLAGS -fvisibility=hidden"
126AC_MSG_CHECKING([if ${CXX} supports -fvisibility=hidden])
127AC_COMPILE_IFELSE([char foo;],
128 [ AC_MSG_RESULT([yes])
129 SYMBOL_VISIBILITY="-fvisibility=hidden" ],
130 AC_MSG_RESULT([no]))
131CFLAGS="$saved_CFLAGS $SYMBOL_VISIBILITY"
132AC_SUBST(SYMBOL_VISIBILITY)
133
Jean-Marc Valin679f5cc2008-03-13 17:39:55 +1100134if test $ac_cv_c_compiler_gnu = yes ; then
Jean-Marc Valin4c9a0072008-12-23 09:53:36 -0500135 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 +1100136fi
Jean-Marc Valin49ca99e2008-02-25 14:05:10 +1100137
Jean-Marc Valind9b95652008-08-31 23:34:47 -0400138AC_C99_FUNC_LRINTF
139AC_C99_FUNC_LRINT
140
Jean-Marc Valin63590892007-11-29 17:01:16 +1100141AC_CHECK_SIZEOF(short)
142AC_CHECK_SIZEOF(int)
143AC_CHECK_SIZEOF(long)
144AC_CHECK_SIZEOF(long long)
145
146if test x$has_char16 = "xyes" ; then
147 case 1 in
148 $ac_cv_sizeof_short) SIZE16="short";;
149 $ac_cv_sizeof_int) SIZE16="int";;
150 esac
151else
152 case 2 in
153 $ac_cv_sizeof_short) SIZE16="short";;
154 $ac_cv_sizeof_int) SIZE16="int";;
155 esac
156fi
157
158if test x$has_char16 = "xyes" ; then
159 case 2 in
160 $ac_cv_sizeof_int) SIZE32="int";;
161 $ac_cv_sizeof_long) SIZE32="long";;
162 $ac_cv_sizeof_short) SIZE32="short";;
163 esac
164else
165 case 4 in
166 $ac_cv_sizeof_int) SIZE32="int";;
167 $ac_cv_sizeof_long) SIZE32="long";;
168 $ac_cv_sizeof_short) SIZE32="short";;
169 esac
170fi
171
172AC_SUBST(SIZE16)
173AC_SUBST(SIZE32)
174
Christopher Montgomery41d819d2009-01-13 13:39:53 -0500175AC_OUTPUT([Makefile libcelt/Makefile tests/Makefile
176 celt.pc tools/Makefile libcelt.spec ])
Jean-Marc Valin63590892007-11-29 17:01:16 +1100177
Jean-Marc Valine6233122008-02-01 16:27:38 +1100178if test "x$tools" = "x"; then
Jean-Marc Valin63590892007-11-29 17:01:16 +1100179echo "**IMPORTANT**"
Gregory Maxwellc8e200b2009-03-11 13:13:19 -0400180echo "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 +1100181echo "You can download libogg from http://www.vorbis.com/download.psp"
182fi
183
184echo "Type \"make; make install\" to compile and install";