blob: 981fbf8a765795cdeac449bf17d345b1f2e94ecc [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 Valin5ac6d422008-10-09 07:27:10 -04008CELT_MINOR_VERSION=5
Jean-Marc Valin28f0f652009-02-16 07:32:44 -05009CELT_MICRO_VERSION=2
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
33AC_C_BIGENDIAN
34AC_C_CONST
35AC_C_INLINE
36AC_C_RESTRICT
37
Peter Kirk19f9dc92008-06-06 14:38:38 +020038AC_DEFINE([CELT_BUILD], [], [This is a build of CELT])
Jean-Marc Valin63590892007-11-29 17:01:16 +110039
40AC_MSG_CHECKING(for C99 variable-size arrays)
41AC_TRY_COMPILE( , [
42int foo=10;
43int array[foo];
44],
45[has_var_arrays=yes;AC_DEFINE([VAR_ARRAYS], [], [Use C99 variable-size arrays])
46],
47has_var_arrays=no
48)
49AC_MSG_RESULT($has_var_arrays)
50
Jean-Marc Valine6233122008-02-01 16:27:38 +110051AC_CHECK_HEADERS([alloca.h getopt.h])
Jean-Marc Valin63590892007-11-29 17:01:16 +110052AC_MSG_CHECKING(for alloca)
53AC_TRY_COMPILE( [#include <alloca.h>], [
54int foo=10;
55int *array = alloca(foo);
56],
57[
58has_alloca=yes;
59if test x$has_var_arrays = "xno" ; then
60AC_DEFINE([USE_ALLOCA], [], [Make use of alloca])
61fi
62],
63has_alloca=no
64)
65AC_MSG_RESULT($has_alloca)
66
Jean-Marc Valin63590892007-11-29 17:01:16 +110067AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h)
68
Gregory Maxwellc8e200b2009-03-11 13:13:19 -040069AS_IF([test "x$with_ogg" != xno],
70 [XIPH_PATH_OGG([tools="tools"], [tools=""])],
71 [tools=""])
Jean-Marc Valine6233122008-02-01 16:27:38 +110072AC_SUBST(tools)
Jean-Marc Valin63590892007-11-29 17:01:16 +110073
74AC_CHECK_LIB(m, sin)
75
76# Check for getopt_long; if not found, use included source.
77AC_CHECK_FUNCS([getopt_long],,
78[# FreeBSD has a gnugetopt library.
79 AC_CHECK_LIB([gnugetopt],[getopt_long],
80[AC_DEFINE([HAVE_GETOPT_LONG])],
81[# Use the GNU replacement.
82AC_LIBOBJ(getopt)
83AC_LIBOBJ(getopt1)])])
84
85AC_CHECK_LIB(winmm, main)
86
Jean-Marc Valin842b4452007-11-29 17:19:47 +110087AC_DEFINE_UNQUOTED(CELT_VERSION, "${CELT_VERSION}", [Complete version string])
88AC_DEFINE_UNQUOTED(CELT_MAJOR_VERSION, ${CELT_MAJOR_VERSION}, [Version major])
89AC_DEFINE_UNQUOTED(CELT_MINOR_VERSION, ${CELT_MINOR_VERSION}, [Version minor])
90AC_DEFINE_UNQUOTED(CELT_MICRO_VERSION, ${CELT_MICRO_VERSION}, [Version micro])
91AC_DEFINE_UNQUOTED(CELT_EXTRA_VERSION, "${CELT_EXTRA_VERSION}", [Version extra])
Jean-Marc Valin63590892007-11-29 17:01:16 +110092
Jean-Marc Valin49ca99e2008-02-25 14:05:10 +110093AC_ARG_ENABLE(fixed-point, [ --enable-fixed-point Compile as fixed-point],
94[if test "$enableval" = yes; then
95 AC_DEFINE([FIXED_POINT], , [Compile as fixed-point])
96 AC_DEFINE([DOUBLE_PRECISION], , [Compile as fixed-point])
Jean-Marc Valin980ad382008-03-12 11:47:19 +110097 AC_DEFINE([MIXED_PRECISION], , [Compile as fixed-point])
Jean-Marc Valin49ca99e2008-02-25 14:05:10 +110098else
99 AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])
100fi],
101AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]))
102
103AC_ARG_ENABLE(fixed-point-debug, [ --enable-fixed-point-debug Debug fixed-point implementation],
104[if test "$enableval" = yes; then
105 AC_DEFINE([FIXED_DEBUG], , [Debug fixed-point implementation])
106fi])
107
Jean-Marc Valin980ad382008-03-12 11:47:19 +1100108AC_ARG_ENABLE(static-modes, [ --enable-static-modes],
109[if test "$enableval" = yes; then
110 AC_DEFINE([STATIC_MODES], , [Static modes])
111fi])
112
Jean-Marc Valin4ff068e2008-03-15 23:34:39 +1100113AC_ARG_ENABLE(assertions, [ --enable-assertions],
114[if test "$enableval" = yes; then
115 AC_DEFINE([ENABLE_ASSERTIONS], , [Assertions])
116fi])
117
Jean-Marc Valin4c9a0072008-12-23 09:53:36 -0500118saved_CFLAGS="$CFLAGS"
119CFLAGS="$CFLAGS -fvisibility=hidden"
120AC_MSG_CHECKING([if ${CXX} supports -fvisibility=hidden])
121AC_COMPILE_IFELSE([char foo;],
122 [ AC_MSG_RESULT([yes])
123 SYMBOL_VISIBILITY="-fvisibility=hidden" ],
124 AC_MSG_RESULT([no]))
125CFLAGS="$saved_CFLAGS $SYMBOL_VISIBILITY"
126AC_SUBST(SYMBOL_VISIBILITY)
127
Jean-Marc Valin679f5cc2008-03-13 17:39:55 +1100128if test $ac_cv_c_compiler_gnu = yes ; then
Jean-Marc Valin4c9a0072008-12-23 09:53:36 -0500129 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 +1100130fi
Jean-Marc Valin49ca99e2008-02-25 14:05:10 +1100131
Jean-Marc Valind9b95652008-08-31 23:34:47 -0400132AC_C99_FUNC_LRINTF
133AC_C99_FUNC_LRINT
134
Jean-Marc Valin63590892007-11-29 17:01:16 +1100135AC_CHECK_SIZEOF(short)
136AC_CHECK_SIZEOF(int)
137AC_CHECK_SIZEOF(long)
138AC_CHECK_SIZEOF(long long)
139
140if test x$has_char16 = "xyes" ; then
141 case 1 in
142 $ac_cv_sizeof_short) SIZE16="short";;
143 $ac_cv_sizeof_int) SIZE16="int";;
144 esac
145else
146 case 2 in
147 $ac_cv_sizeof_short) SIZE16="short";;
148 $ac_cv_sizeof_int) SIZE16="int";;
149 esac
150fi
151
152if test x$has_char16 = "xyes" ; then
153 case 2 in
154 $ac_cv_sizeof_int) SIZE32="int";;
155 $ac_cv_sizeof_long) SIZE32="long";;
156 $ac_cv_sizeof_short) SIZE32="short";;
157 esac
158else
159 case 4 in
160 $ac_cv_sizeof_int) SIZE32="int";;
161 $ac_cv_sizeof_long) SIZE32="long";;
162 $ac_cv_sizeof_short) SIZE32="short";;
163 esac
164fi
165
166AC_SUBST(SIZE16)
167AC_SUBST(SIZE32)
168
Christopher Montgomery41d819d2009-01-13 13:39:53 -0500169AC_OUTPUT([Makefile libcelt/Makefile tests/Makefile
170 celt.pc tools/Makefile libcelt.spec ])
Jean-Marc Valin63590892007-11-29 17:01:16 +1100171
Jean-Marc Valine6233122008-02-01 16:27:38 +1100172if test "x$tools" = "x"; then
Jean-Marc Valin63590892007-11-29 17:01:16 +1100173echo "**IMPORTANT**"
Gregory Maxwellc8e200b2009-03-11 13:13:19 -0400174echo "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 +1100175echo "You can download libogg from http://www.vorbis.com/download.psp"
176fi
177
178echo "Type \"make; make install\" to compile and install";