fixed-point: initial support for using the fixed-point MDCT (rest is still all
[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=2
9 CELT_MICRO_VERSION=0
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
39 AC_MSG_CHECKING(for C99 variable-size arrays)
40 AC_TRY_COMPILE( , [
41 int foo=10;
42 int array[foo];
43 ],
44 [has_var_arrays=yes;AC_DEFINE([VAR_ARRAYS], [], [Use C99 variable-size arrays])
45 ],
46 has_var_arrays=no
47 )
48 AC_MSG_RESULT($has_var_arrays)
49
50 AC_CHECK_HEADERS([alloca.h getopt.h])
51 AC_MSG_CHECKING(for alloca)
52 AC_TRY_COMPILE( [#include <alloca.h>], [
53 int foo=10;
54 int *array = alloca(foo);
55 ],
56 [
57 has_alloca=yes;
58 if test x$has_var_arrays = "xno" ; then
59 AC_DEFINE([USE_ALLOCA], [], [Make use of alloca])
60 fi
61 ],
62 has_alloca=no
63 )
64 AC_MSG_RESULT($has_alloca)
65
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 else
96   AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])
97 fi],
98 AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]))
99
100 AC_ARG_ENABLE(fixed-point-debug, [  --enable-fixed-point-debug  Debug fixed-point implementation],
101 [if test "$enableval" = yes; then
102   AC_DEFINE([FIXED_DEBUG], , [Debug fixed-point implementation])
103 fi])
104
105
106 AC_CHECK_SIZEOF(short)
107 AC_CHECK_SIZEOF(int)
108 AC_CHECK_SIZEOF(long)
109 AC_CHECK_SIZEOF(long long)
110
111 if test x$has_char16 = "xyes" ; then
112         case 1 in
113                 $ac_cv_sizeof_short) SIZE16="short";;
114                 $ac_cv_sizeof_int) SIZE16="int";;
115         esac
116 else
117         case 2 in
118                 $ac_cv_sizeof_short) SIZE16="short";;
119                 $ac_cv_sizeof_int) SIZE16="int";;
120         esac
121 fi
122
123 if test x$has_char16 = "xyes" ; then
124         case 2 in
125                 $ac_cv_sizeof_int) SIZE32="int";;
126                 $ac_cv_sizeof_long) SIZE32="long";;
127                 $ac_cv_sizeof_short) SIZE32="short";;
128         esac
129 else
130         case 4 in
131                 $ac_cv_sizeof_int) SIZE32="int";;
132                 $ac_cv_sizeof_long) SIZE32="long";;
133                 $ac_cv_sizeof_short) SIZE32="short";;
134         esac
135 fi
136
137 AC_SUBST(SIZE16)
138 AC_SUBST(SIZE32)
139
140 AC_OUTPUT([Makefile libcelt/Makefile tests/Makefile celt.pc tools/Makefile])
141
142 if test "x$tools" = "x"; then 
143 echo "**IMPORTANT**"
144 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)"
145 echo "You can download libogg from http://www.vorbis.com/download.psp"
146 fi
147
148 echo "Type \"make; make install\" to compile and install";