41c0782dcff77f5dfbe592881a7f89410a85366f
[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=1
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_CHECK_SIZEOF(short)
92 AC_CHECK_SIZEOF(int)
93 AC_CHECK_SIZEOF(long)
94 AC_CHECK_SIZEOF(long long)
95
96 if test x$has_char16 = "xyes" ; then
97         case 1 in
98                 $ac_cv_sizeof_short) SIZE16="short";;
99                 $ac_cv_sizeof_int) SIZE16="int";;
100         esac
101 else
102         case 2 in
103                 $ac_cv_sizeof_short) SIZE16="short";;
104                 $ac_cv_sizeof_int) SIZE16="int";;
105         esac
106 fi
107
108 if test x$has_char16 = "xyes" ; then
109         case 2 in
110                 $ac_cv_sizeof_int) SIZE32="int";;
111                 $ac_cv_sizeof_long) SIZE32="long";;
112                 $ac_cv_sizeof_short) SIZE32="short";;
113         esac
114 else
115         case 4 in
116                 $ac_cv_sizeof_int) SIZE32="int";;
117                 $ac_cv_sizeof_long) SIZE32="long";;
118                 $ac_cv_sizeof_short) SIZE32="short";;
119         esac
120 fi
121
122 AC_SUBST(SIZE16)
123 AC_SUBST(SIZE32)
124
125 AC_OUTPUT([Makefile libcelt/Makefile tests/Makefile celt.pc tools/Makefile])
126
127 if test "x$tools" = "x"; then 
128 echo "**IMPORTANT**"
129 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)"
130 echo "You can download libogg from http://www.vorbis.com/download.psp"
131 fi
132
133 echo "Type \"make; make install\" to compile and install";