Added Erik de Castro Lopo's float_cast.h to use lrintf() when available. Also
[opus.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script. -*-m4-*-
2
3 AC_INIT(libcelt/arch.h)
4
5 AM_CONFIG_HEADER([config.h])
6
7 CELT_MAJOR_VERSION=0
8 CELT_MINOR_VERSION=4
9 CELT_MICRO_VERSION=1
10 CELT_EXTRA_VERSION=
11 CELT_VERSION=$CELT_MAJOR_VERSION.$CELT_MINOR_VERSION.$CELT_MICRO_VERSION$CELT_EXTRA_VERSION
12
13 CELT_LT_CURRENT=0
14 CELT_LT_REVISION=0
15 CELT_LT_AGE=0
16
17 AC_SUBST(CELT_LT_CURRENT)
18 AC_SUBST(CELT_LT_REVISION)
19 AC_SUBST(CELT_LT_AGE)
20
21 # For automake.
22 VERSION=$CELT_VERSION
23 PACKAGE=celt
24
25 AC_SUBST(CELT_VERSION)
26
27 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
28 AM_MAINTAINER_MODE
29
30 AC_CANONICAL_HOST
31 AM_PROG_LIBTOOL
32
33 AC_C_BIGENDIAN
34 AC_C_CONST
35 AC_C_INLINE
36 AC_C_RESTRICT
37
38 AC_DEFINE([CELT_BUILD], [], [This is a build of CELT])
39
40 AC_MSG_CHECKING(for C99 variable-size arrays)
41 AC_TRY_COMPILE( , [
42 int foo=10;
43 int array[foo];
44 ],
45 [has_var_arrays=yes;AC_DEFINE([VAR_ARRAYS], [], [Use C99 variable-size arrays])
46 ],
47 has_var_arrays=no
48 )
49 AC_MSG_RESULT($has_var_arrays)
50
51 AC_CHECK_HEADERS([alloca.h getopt.h])
52 AC_MSG_CHECKING(for alloca)
53 AC_TRY_COMPILE( [#include <alloca.h>], [
54 int foo=10;
55 int *array = alloca(foo);
56 ],
57 [
58 has_alloca=yes;
59 if test x$has_var_arrays = "xno" ; then
60 AC_DEFINE([USE_ALLOCA], [], [Make use of alloca])
61 fi
62 ],
63 has_alloca=no
64 )
65 AC_MSG_RESULT($has_alloca)
66
67 AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h)
68
69 XIPH_PATH_OGG([tools="tools"], [tools=""])
70 AC_SUBST(tools)
71
72 AC_CHECK_LIB(m, sin)
73
74 # Check for getopt_long; if not found, use included source.
75 AC_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.
80 AC_LIBOBJ(getopt)
81 AC_LIBOBJ(getopt1)])])
82
83 AC_CHECK_LIB(winmm, main)
84
85 AC_DEFINE_UNQUOTED(CELT_VERSION, "${CELT_VERSION}", [Complete version string])
86 AC_DEFINE_UNQUOTED(CELT_MAJOR_VERSION, ${CELT_MAJOR_VERSION}, [Version major])
87 AC_DEFINE_UNQUOTED(CELT_MINOR_VERSION, ${CELT_MINOR_VERSION}, [Version minor])
88 AC_DEFINE_UNQUOTED(CELT_MICRO_VERSION, ${CELT_MICRO_VERSION}, [Version micro])
89 AC_DEFINE_UNQUOTED(CELT_EXTRA_VERSION, "${CELT_EXTRA_VERSION}", [Version extra])
90
91 AC_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])
95   AC_DEFINE([MIXED_PRECISION], , [Compile as fixed-point])
96 else
97   AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])
98 fi],
99 AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]))
100
101 AC_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])
104 fi])
105
106 AC_ARG_ENABLE(static-modes, [  --enable-static-modes],
107 [if test "$enableval" = yes; then
108   AC_DEFINE([STATIC_MODES], , [Static modes])
109 fi])
110
111 AC_ARG_ENABLE(assertions, [  --enable-assertions],
112 [if test "$enableval" = yes; then
113   AC_DEFINE([ENABLE_ASSERTIONS], , [Assertions])
114 fi])
115
116 if test $ac_cv_c_compiler_gnu = yes ; then
117         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"
119 fi
120
121 AC_C99_FUNC_LRINTF
122 AC_C99_FUNC_LRINT
123
124 AC_CHECK_SIZEOF(short)
125 AC_CHECK_SIZEOF(int)
126 AC_CHECK_SIZEOF(long)
127 AC_CHECK_SIZEOF(long long)
128
129 if 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
134 else
135         case 2 in
136                 $ac_cv_sizeof_short) SIZE16="short";;
137                 $ac_cv_sizeof_int) SIZE16="int";;
138         esac
139 fi
140
141 if 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
147 else
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
153 fi
154
155 AC_SUBST(SIZE16)
156 AC_SUBST(SIZE32)
157
158 AC_OUTPUT([Makefile libcelt/Makefile tests/Makefile celt.pc tools/Makefile])
159
160 if test "x$tools" = "x"; then 
161 echo "**IMPORTANT**"
162 echo "You don't seem to have the development package for libogg (libogg-devel) installed. Only the library will be built (no encoder/decoder executable)"
163 echo "You can download libogg from http://www.vorbis.com/download.psp"
164 fi
165
166 echo "Type \"make; make install\" to compile and install";