blob: 82f14007639718463c8819e65348f2a5e856f567 [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
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 Valin4c9a0072008-12-23 09:53:36 -0500116saved_CFLAGS="$CFLAGS"
117CFLAGS="$CFLAGS -fvisibility=hidden"
118AC_MSG_CHECKING([if ${CXX} supports -fvisibility=hidden])
119AC_COMPILE_IFELSE([char foo;],
120 [ AC_MSG_RESULT([yes])
121 SYMBOL_VISIBILITY="-fvisibility=hidden" ],
122 AC_MSG_RESULT([no]))
123CFLAGS="$saved_CFLAGS $SYMBOL_VISIBILITY"
124AC_SUBST(SYMBOL_VISIBILITY)
125
Jean-Marc Valin679f5cc2008-03-13 17:39:55 +1100126if test $ac_cv_c_compiler_gnu = yes ; then
Jean-Marc Valin4c9a0072008-12-23 09:53:36 -0500127 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 +1100128fi
Jean-Marc Valin49ca99e2008-02-25 14:05:10 +1100129
Jean-Marc Valind9b95652008-08-31 23:34:47 -0400130AC_C99_FUNC_LRINTF
131AC_C99_FUNC_LRINT
132
Jean-Marc Valin63590892007-11-29 17:01:16 +1100133AC_CHECK_SIZEOF(short)
134AC_CHECK_SIZEOF(int)
135AC_CHECK_SIZEOF(long)
136AC_CHECK_SIZEOF(long long)
137
138if test x$has_char16 = "xyes" ; then
139 case 1 in
140 $ac_cv_sizeof_short) SIZE16="short";;
141 $ac_cv_sizeof_int) SIZE16="int";;
142 esac
143else
144 case 2 in
145 $ac_cv_sizeof_short) SIZE16="short";;
146 $ac_cv_sizeof_int) SIZE16="int";;
147 esac
148fi
149
150if test x$has_char16 = "xyes" ; then
151 case 2 in
152 $ac_cv_sizeof_int) SIZE32="int";;
153 $ac_cv_sizeof_long) SIZE32="long";;
154 $ac_cv_sizeof_short) SIZE32="short";;
155 esac
156else
157 case 4 in
158 $ac_cv_sizeof_int) SIZE32="int";;
159 $ac_cv_sizeof_long) SIZE32="long";;
160 $ac_cv_sizeof_short) SIZE32="short";;
161 esac
162fi
163
164AC_SUBST(SIZE16)
165AC_SUBST(SIZE32)
166
Christopher Montgomery41d819d2009-01-13 13:39:53 -0500167AC_OUTPUT([Makefile libcelt/Makefile tests/Makefile
168 celt.pc tools/Makefile libcelt.spec ])
Jean-Marc Valin63590892007-11-29 17:01:16 +1100169
Jean-Marc Valine6233122008-02-01 16:27:38 +1100170if test "x$tools" = "x"; then
Jean-Marc Valin63590892007-11-29 17:01:16 +1100171echo "**IMPORTANT**"
172echo "You don't seem to have the development package for libogg (libogg-devel) installed. Only the library will be built (no encoder/decoder executable)"
173echo "You can download libogg from http://www.vorbis.com/download.psp"
174fi
175
176echo "Type \"make; make install\" to compile and install";