Allow --without-ogg to address issue raised by Ian Davidson.
[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=5
9 CELT_MICRO_VERSION=2
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 AS_IF([test "x$with_ogg" != xno],
70  [XIPH_PATH_OGG([tools="tools"], [tools=""])],
71  [tools=""])
72 AC_SUBST(tools)
73
74 AC_CHECK_LIB(m, sin)
75
76 # Check for getopt_long; if not found, use included source.
77 AC_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.
82 AC_LIBOBJ(getopt)
83 AC_LIBOBJ(getopt1)])])
84
85 AC_CHECK_LIB(winmm, main)
86
87 AC_DEFINE_UNQUOTED(CELT_VERSION, "${CELT_VERSION}", [Complete version string])
88 AC_DEFINE_UNQUOTED(CELT_MAJOR_VERSION, ${CELT_MAJOR_VERSION}, [Version major])
89 AC_DEFINE_UNQUOTED(CELT_MINOR_VERSION, ${CELT_MINOR_VERSION}, [Version minor])
90 AC_DEFINE_UNQUOTED(CELT_MICRO_VERSION, ${CELT_MICRO_VERSION}, [Version micro])
91 AC_DEFINE_UNQUOTED(CELT_EXTRA_VERSION, "${CELT_EXTRA_VERSION}", [Version extra])
92
93 AC_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])
97   AC_DEFINE([MIXED_PRECISION], , [Compile as fixed-point])
98 else
99   AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])
100 fi],
101 AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]))
102
103 AC_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])
106 fi])
107
108 AC_ARG_ENABLE(static-modes, [  --enable-static-modes],
109 [if test "$enableval" = yes; then
110   AC_DEFINE([STATIC_MODES], , [Static modes])
111 fi])
112
113 AC_ARG_ENABLE(assertions, [  --enable-assertions],
114 [if test "$enableval" = yes; then
115   AC_DEFINE([ENABLE_ASSERTIONS], , [Assertions])
116 fi])
117
118 saved_CFLAGS="$CFLAGS"
119 CFLAGS="$CFLAGS -fvisibility=hidden"
120 AC_MSG_CHECKING([if ${CXX} supports -fvisibility=hidden])
121 AC_COMPILE_IFELSE([char foo;],
122       [ AC_MSG_RESULT([yes])
123         SYMBOL_VISIBILITY="-fvisibility=hidden" ],
124         AC_MSG_RESULT([no]))
125 CFLAGS="$saved_CFLAGS $SYMBOL_VISIBILITY"
126 AC_SUBST(SYMBOL_VISIBILITY)
127
128 if test $ac_cv_c_compiler_gnu = yes ; then
129         CFLAGS="$CFLAGS -W -Wstrict-prototypes -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wno-parentheses -Wno-unused-parameter -Wno-sign-compare"
130 fi
131
132 AC_C99_FUNC_LRINTF
133 AC_C99_FUNC_LRINT
134
135 AC_CHECK_SIZEOF(short)
136 AC_CHECK_SIZEOF(int)
137 AC_CHECK_SIZEOF(long)
138 AC_CHECK_SIZEOF(long long)
139
140 if 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
145 else
146         case 2 in
147                 $ac_cv_sizeof_short) SIZE16="short";;
148                 $ac_cv_sizeof_int) SIZE16="int";;
149         esac
150 fi
151
152 if 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
158 else
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
164 fi
165
166 AC_SUBST(SIZE16)
167 AC_SUBST(SIZE32)
168
169 AC_OUTPUT([Makefile libcelt/Makefile tests/Makefile 
170            celt.pc tools/Makefile libcelt.spec ])
171
172 if test "x$tools" = "x"; then 
173 echo "**IMPORTANT**"
174 echo "You don't seem to have the development package for libogg (libogg-devel) available. Only the library will be built (no encoder/decoder executable)"
175 echo "You can download libogg from http://www.vorbis.com/download.psp"
176 fi
177
178 echo "Type \"make; make install\" to compile and install";