blob: bb51298f98aea8baa0f3e192d0af42d41eaefd86 [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 Valin763abd02008-12-17 20:00:35 -05009CELT_MICRO_VERSION=1
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
Jean-Marc Valine6233122008-02-01 16:27:38 +110069XIPH_PATH_OGG([tools="tools"], [tools=""])
70AC_SUBST(tools)
Jean-Marc Valin63590892007-11-29 17:01:16 +110071
72AC_CHECK_LIB(m, sin)
73
74# Check for getopt_long; if not found, use included source.
75AC_CHECK_FUNCS([getopt_long],,
76[# FreeBSD has a gnugetopt library.
77 AC_CHECK_LIB([gnugetopt],[getopt_long],
78[AC_DEFINE([HAVE_GETOPT_LONG])],
79[# Use the GNU replacement.
80AC_LIBOBJ(getopt)
81AC_LIBOBJ(getopt1)])])
82
83AC_CHECK_LIB(winmm, main)
84
Jean-Marc Valin842b4452007-11-29 17:19:47 +110085AC_DEFINE_UNQUOTED(CELT_VERSION, "${CELT_VERSION}", [Complete version string])
86AC_DEFINE_UNQUOTED(CELT_MAJOR_VERSION, ${CELT_MAJOR_VERSION}, [Version major])
87AC_DEFINE_UNQUOTED(CELT_MINOR_VERSION, ${CELT_MINOR_VERSION}, [Version minor])
88AC_DEFINE_UNQUOTED(CELT_MICRO_VERSION, ${CELT_MICRO_VERSION}, [Version micro])
89AC_DEFINE_UNQUOTED(CELT_EXTRA_VERSION, "${CELT_EXTRA_VERSION}", [Version extra])
Jean-Marc Valin63590892007-11-29 17:01:16 +110090
Jean-Marc Valin49ca99e2008-02-25 14:05:10 +110091AC_ARG_ENABLE(fixed-point, [ --enable-fixed-point Compile as fixed-point],
92[if test "$enableval" = yes; then
93 AC_DEFINE([FIXED_POINT], , [Compile as fixed-point])
94 AC_DEFINE([DOUBLE_PRECISION], , [Compile as fixed-point])
Jean-Marc Valin980ad382008-03-12 11:47:19 +110095 AC_DEFINE([MIXED_PRECISION], , [Compile as fixed-point])
Jean-Marc Valin49ca99e2008-02-25 14:05:10 +110096else
97 AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])
98fi],
99AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]))
100
101AC_ARG_ENABLE(fixed-point-debug, [ --enable-fixed-point-debug Debug fixed-point implementation],
102[if test "$enableval" = yes; then
103 AC_DEFINE([FIXED_DEBUG], , [Debug fixed-point implementation])
104fi])
105
Jean-Marc Valin980ad382008-03-12 11:47:19 +1100106AC_ARG_ENABLE(static-modes, [ --enable-static-modes],
107[if test "$enableval" = yes; then
108 AC_DEFINE([STATIC_MODES], , [Static modes])
109fi])
110
Jean-Marc Valin4ff068e2008-03-15 23:34:39 +1100111AC_ARG_ENABLE(assertions, [ --enable-assertions],
112[if test "$enableval" = yes; then
113 AC_DEFINE([ENABLE_ASSERTIONS], , [Assertions])
114fi])
115
Jean-Marc Valin679f5cc2008-03-13 17:39:55 +1100116if test $ac_cv_c_compiler_gnu = yes ; then
Jean-Marc Valina82dfdd2008-03-13 23:01:55 +1100117 CFLAGS="$CFLAGS -fvisibility=hidden -W -Wstrict-prototypes -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wno-parentheses -Wno-unused-parameter -Wno-sign-compare"
118 #CFLAGS="$CFLAGS -fvisibility=hidden -W -Wstrict-prototypes -Wmissing-prototypes -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wno-parentheses"
Jean-Marc Valin679f5cc2008-03-13 17:39:55 +1100119fi
Jean-Marc Valin49ca99e2008-02-25 14:05:10 +1100120
Jean-Marc Valind9b95652008-08-31 23:34:47 -0400121AC_C99_FUNC_LRINTF
122AC_C99_FUNC_LRINT
123
Jean-Marc Valin63590892007-11-29 17:01:16 +1100124AC_CHECK_SIZEOF(short)
125AC_CHECK_SIZEOF(int)
126AC_CHECK_SIZEOF(long)
127AC_CHECK_SIZEOF(long long)
128
129if test x$has_char16 = "xyes" ; then
130 case 1 in
131 $ac_cv_sizeof_short) SIZE16="short";;
132 $ac_cv_sizeof_int) SIZE16="int";;
133 esac
134else
135 case 2 in
136 $ac_cv_sizeof_short) SIZE16="short";;
137 $ac_cv_sizeof_int) SIZE16="int";;
138 esac
139fi
140
141if test x$has_char16 = "xyes" ; then
142 case 2 in
143 $ac_cv_sizeof_int) SIZE32="int";;
144 $ac_cv_sizeof_long) SIZE32="long";;
145 $ac_cv_sizeof_short) SIZE32="short";;
146 esac
147else
148 case 4 in
149 $ac_cv_sizeof_int) SIZE32="int";;
150 $ac_cv_sizeof_long) SIZE32="long";;
151 $ac_cv_sizeof_short) SIZE32="short";;
152 esac
153fi
154
155AC_SUBST(SIZE16)
156AC_SUBST(SIZE32)
157
Jean-Marc Valine6233122008-02-01 16:27:38 +1100158AC_OUTPUT([Makefile libcelt/Makefile tests/Makefile celt.pc tools/Makefile])
Jean-Marc Valin63590892007-11-29 17:01:16 +1100159
Jean-Marc Valine6233122008-02-01 16:27:38 +1100160if test "x$tools" = "x"; then
Jean-Marc Valin63590892007-11-29 17:01:16 +1100161echo "**IMPORTANT**"
162echo "You don't seem to have the development package for libogg (libogg-devel) installed. Only the library will be built (no encoder/decoder executable)"
163echo "You can download libogg from http://www.vorbis.com/download.psp"
164fi
165
166echo "Type \"make; make install\" to compile and install";