Enabling warnings and restricting symbol visibility
[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=3
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   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 if test $ac_cv_c_compiler_gnu = yes ; then
112         CFLAGS="$CFLAGS -fvisibility=hidden -W -Wstrict-prototypes -Wmissing-prototypes -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wno-parentheses"
113 fi
114
115 AC_CHECK_SIZEOF(short)
116 AC_CHECK_SIZEOF(int)
117 AC_CHECK_SIZEOF(long)
118 AC_CHECK_SIZEOF(long long)
119
120 if test x$has_char16 = "xyes" ; then
121         case 1 in
122                 $ac_cv_sizeof_short) SIZE16="short";;
123                 $ac_cv_sizeof_int) SIZE16="int";;
124         esac
125 else
126         case 2 in
127                 $ac_cv_sizeof_short) SIZE16="short";;
128                 $ac_cv_sizeof_int) SIZE16="int";;
129         esac
130 fi
131
132 if test x$has_char16 = "xyes" ; then
133         case 2 in
134                 $ac_cv_sizeof_int) SIZE32="int";;
135                 $ac_cv_sizeof_long) SIZE32="long";;
136                 $ac_cv_sizeof_short) SIZE32="short";;
137         esac
138 else
139         case 4 in
140                 $ac_cv_sizeof_int) SIZE32="int";;
141                 $ac_cv_sizeof_long) SIZE32="long";;
142                 $ac_cv_sizeof_short) SIZE32="short";;
143         esac
144 fi
145
146 AC_SUBST(SIZE16)
147 AC_SUBST(SIZE32)
148
149 AC_OUTPUT([Makefile libcelt/Makefile tests/Makefile celt.pc tools/Makefile])
150
151 if test "x$tools" = "x"; then 
152 echo "**IMPORTANT**"
153 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)"
154 echo "You can download libogg from http://www.vorbis.com/download.psp"
155 fi
156
157 echo "Type \"make; make install\" to compile and install";