| Jean-Marc Valin | 6359089 | 2007-11-29 17:01:16 +1100 | [diff] [blame] | 1 | dnl Process this file with autoconf to produce a configure script. -*-m4-*- |
| 2 | |
| Jean-Marc Valin | 842b445 | 2007-11-29 17:19:47 +1100 | [diff] [blame] | 3 | AC_INIT(libcelt/arch.h) |
| Jean-Marc Valin | 6359089 | 2007-11-29 17:01:16 +1100 | [diff] [blame] | 4 | |
| 5 | AM_CONFIG_HEADER([config.h]) |
| 6 | |
| 7 | CELT_MAJOR_VERSION=0 |
| Jean-Marc Valin | 4213a72 | 2009-10-01 19:42:18 -0400 | [diff] [blame] | 8 | CELT_MINOR_VERSION=7 |
| 9 | CELT_MICRO_VERSION=0 |
| Jean-Marc Valin | 14f5e7c | 2008-02-21 23:59:17 +1100 | [diff] [blame] | 10 | CELT_EXTRA_VERSION= |
| Jean-Marc Valin | 842b445 | 2007-11-29 17:19:47 +1100 | [diff] [blame] | 11 | CELT_VERSION=$CELT_MAJOR_VERSION.$CELT_MINOR_VERSION.$CELT_MICRO_VERSION$CELT_EXTRA_VERSION |
| Jean-Marc Valin | 6359089 | 2007-11-29 17:01:16 +1100 | [diff] [blame] | 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 |
| Jean-Marc Valin | 842b445 | 2007-11-29 17:19:47 +1100 | [diff] [blame] | 23 | PACKAGE=celt |
| Jean-Marc Valin | 6359089 | 2007-11-29 17:01:16 +1100 | [diff] [blame] | 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 | |
| Jean-Marc Valin | eafbdd5 | 2009-04-27 19:35:09 -0400 | [diff] [blame] | 33 | AC_PROG_CC_C99 |
| Jean-Marc Valin | 6359089 | 2007-11-29 17:01:16 +1100 | [diff] [blame] | 34 | AC_C_BIGENDIAN |
| 35 | AC_C_CONST |
| 36 | AC_C_INLINE |
| 37 | AC_C_RESTRICT |
| 38 | |
| Peter Kirk | 19f9dc9 | 2008-06-06 14:38:38 +0200 | [diff] [blame] | 39 | AC_DEFINE([CELT_BUILD], [], [This is a build of CELT]) |
| Jean-Marc Valin | 6359089 | 2007-11-29 17:01:16 +1100 | [diff] [blame] | 40 | |
| 41 | AC_MSG_CHECKING(for C99 variable-size arrays) |
| 42 | AC_TRY_COMPILE( , [ |
| 43 | int foo=10; |
| 44 | int array[foo]; |
| 45 | ], |
| 46 | [has_var_arrays=yes;AC_DEFINE([VAR_ARRAYS], [], [Use C99 variable-size arrays]) |
| 47 | ], |
| 48 | has_var_arrays=no |
| 49 | ) |
| 50 | AC_MSG_RESULT($has_var_arrays) |
| 51 | |
| Jean-Marc Valin | e623312 | 2008-02-01 16:27:38 +1100 | [diff] [blame] | 52 | AC_CHECK_HEADERS([alloca.h getopt.h]) |
| Jean-Marc Valin | 6359089 | 2007-11-29 17:01:16 +1100 | [diff] [blame] | 53 | AC_MSG_CHECKING(for alloca) |
| 54 | AC_TRY_COMPILE( [#include <alloca.h>], [ |
| 55 | int foo=10; |
| 56 | int *array = alloca(foo); |
| 57 | ], |
| 58 | [ |
| 59 | has_alloca=yes; |
| 60 | if test x$has_var_arrays = "xno" ; then |
| 61 | AC_DEFINE([USE_ALLOCA], [], [Make use of alloca]) |
| 62 | fi |
| 63 | ], |
| 64 | has_alloca=no |
| 65 | ) |
| 66 | AC_MSG_RESULT($has_alloca) |
| 67 | |
| Jean-Marc Valin | 6359089 | 2007-11-29 17:01:16 +1100 | [diff] [blame] | 68 | AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h) |
| 69 | |
| Gregory Maxwell | c8e200b | 2009-03-11 13:13:19 -0400 | [diff] [blame] | 70 | AS_IF([test "x$with_ogg" != xno], |
| 71 | [XIPH_PATH_OGG([tools="tools"], [tools=""])], |
| 72 | [tools=""]) |
| Jean-Marc Valin | e623312 | 2008-02-01 16:27:38 +1100 | [diff] [blame] | 73 | AC_SUBST(tools) |
| Jean-Marc Valin | 6359089 | 2007-11-29 17:01:16 +1100 | [diff] [blame] | 74 | |
| 75 | AC_CHECK_LIB(m, sin) |
| 76 | |
| 77 | # Check for getopt_long; if not found, use included source. |
| 78 | AC_CHECK_FUNCS([getopt_long],, |
| 79 | [# FreeBSD has a gnugetopt library. |
| 80 | AC_CHECK_LIB([gnugetopt],[getopt_long], |
| 81 | [AC_DEFINE([HAVE_GETOPT_LONG])], |
| 82 | [# Use the GNU replacement. |
| 83 | AC_LIBOBJ(getopt) |
| 84 | AC_LIBOBJ(getopt1)])]) |
| 85 | |
| 86 | AC_CHECK_LIB(winmm, main) |
| 87 | |
| Jean-Marc Valin | 842b445 | 2007-11-29 17:19:47 +1100 | [diff] [blame] | 88 | AC_DEFINE_UNQUOTED(CELT_VERSION, "${CELT_VERSION}", [Complete version string]) |
| 89 | AC_DEFINE_UNQUOTED(CELT_MAJOR_VERSION, ${CELT_MAJOR_VERSION}, [Version major]) |
| 90 | AC_DEFINE_UNQUOTED(CELT_MINOR_VERSION, ${CELT_MINOR_VERSION}, [Version minor]) |
| 91 | AC_DEFINE_UNQUOTED(CELT_MICRO_VERSION, ${CELT_MICRO_VERSION}, [Version micro]) |
| 92 | AC_DEFINE_UNQUOTED(CELT_EXTRA_VERSION, "${CELT_EXTRA_VERSION}", [Version extra]) |
| Jean-Marc Valin | 6359089 | 2007-11-29 17:01:16 +1100 | [diff] [blame] | 93 | |
| Gregory Maxwell | 065bc15 | 2009-06-24 16:43:33 -0400 | [diff] [blame] | 94 | has_float_approx=no |
| 95 | #case "$host_cpu" in |
| Gregory Maxwell | a80958b | 2009-06-29 12:48:57 -0400 | [diff] [blame] | 96 | #i[[3456]]86 | x86_64 | powerpc64 | powerpc32 | ia64) |
| Gregory Maxwell | 065bc15 | 2009-06-24 16:43:33 -0400 | [diff] [blame] | 97 | # has_float_approx=yes |
| 98 | # ;; |
| 99 | #esac |
| 100 | |
| 101 | ac_enable_fixed="no"; |
| 102 | AC_ARG_ENABLE(fixed-point, [ --enable-fixed-point compile as fixed-point], |
| Jean-Marc Valin | 49ca99e | 2008-02-25 14:05:10 +1100 | [diff] [blame] | 103 | [if test "$enableval" = yes; then |
| Gregory Maxwell | 065bc15 | 2009-06-24 16:43:33 -0400 | [diff] [blame] | 104 | ac_enable_fixed="yes"; |
| Jean-Marc Valin | 49ca99e | 2008-02-25 14:05:10 +1100 | [diff] [blame] | 105 | AC_DEFINE([FIXED_POINT], , [Compile as fixed-point]) |
| 106 | AC_DEFINE([DOUBLE_PRECISION], , [Compile as fixed-point]) |
| Jean-Marc Valin | 980ad38 | 2008-03-12 11:47:19 +1100 | [diff] [blame] | 107 | AC_DEFINE([MIXED_PRECISION], , [Compile as fixed-point]) |
| Jean-Marc Valin | 49ca99e | 2008-02-25 14:05:10 +1100 | [diff] [blame] | 108 | else |
| 109 | AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]) |
| 110 | fi], |
| 111 | AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])) |
| 112 | |
| Gregory Maxwell | 065bc15 | 2009-06-24 16:43:33 -0400 | [diff] [blame] | 113 | ac_enable_fixed_debug="no" |
| 114 | AC_ARG_ENABLE(fixed-point-debug, [ --enable-fixed-point-debug debug fixed-point implementation], |
| Jean-Marc Valin | 49ca99e | 2008-02-25 14:05:10 +1100 | [diff] [blame] | 115 | [if test "$enableval" = yes; then |
| Gregory Maxwell | 065bc15 | 2009-06-24 16:43:33 -0400 | [diff] [blame] | 116 | ac_enable_fixed_debug="yes" |
| Jean-Marc Valin | 49ca99e | 2008-02-25 14:05:10 +1100 | [diff] [blame] | 117 | AC_DEFINE([FIXED_DEBUG], , [Debug fixed-point implementation]) |
| 118 | fi]) |
| 119 | |
| Gregory Maxwell | 065bc15 | 2009-06-24 16:43:33 -0400 | [diff] [blame] | 120 | float_approx=$has_float_approx |
| 121 | AC_ARG_ENABLE(float-approx, [ --disable-float-approx do not use fast approximations for floating point], |
| 122 | [ if test "$enableval" = yes; then |
| 123 | AC_WARN([Floating point approximations are not supported on all platforms.]) |
| 124 | float_approx=yes |
| 125 | else |
| 126 | float_approx=no |
| 127 | fi], [ float_approx=$has_float_approx ]) |
| 128 | |
| 129 | if test "x${float_approx}" = "xyes"; then |
| 130 | AC_DEFINE([FLOAT_APPROX], , [Float approximations]) |
| 131 | fi |
| 132 | |
| 133 | ac_enable_static_modes="no" |
| 134 | AC_ARG_ENABLE(static-modes, [ --enable-static-modes use pre-computed codec configurations], |
| Jean-Marc Valin | 980ad38 | 2008-03-12 11:47:19 +1100 | [diff] [blame] | 135 | [if test "$enableval" = yes; then |
| Gregory Maxwell | 065bc15 | 2009-06-24 16:43:33 -0400 | [diff] [blame] | 136 | ac_enable_static_modes="yes" |
| Jean-Marc Valin | 980ad38 | 2008-03-12 11:47:19 +1100 | [diff] [blame] | 137 | AC_DEFINE([STATIC_MODES], , [Static modes]) |
| 138 | fi]) |
| 139 | |
| Gregory Maxwell | 065bc15 | 2009-06-24 16:43:33 -0400 | [diff] [blame] | 140 | ac_enable_assertions="no" |
| 141 | AC_ARG_ENABLE(assertions, [ --enable-assertions enable additional software error checking], |
| Jean-Marc Valin | 4ff068e | 2008-03-15 23:34:39 +1100 | [diff] [blame] | 142 | [if test "$enableval" = yes; then |
| Gregory Maxwell | 065bc15 | 2009-06-24 16:43:33 -0400 | [diff] [blame] | 143 | ac_enable_assertions="yes" |
| Jean-Marc Valin | 4ff068e | 2008-03-15 23:34:39 +1100 | [diff] [blame] | 144 | AC_DEFINE([ENABLE_ASSERTIONS], , [Assertions]) |
| 145 | fi]) |
| 146 | |
| Gregory Maxwell | 065bc15 | 2009-06-24 16:43:33 -0400 | [diff] [blame] | 147 | ac_enable_new_plc="no" |
| 148 | AC_ARG_ENABLE(new-plc, [ --enable-new-plc enable the new loss concealment code], |
| Jean-Marc Valin | eafbdd5 | 2009-04-27 19:35:09 -0400 | [diff] [blame] | 149 | [if test "$enableval" = yes; then |
| Gregory Maxwell | 065bc15 | 2009-06-24 16:43:33 -0400 | [diff] [blame] | 150 | ac_enable_new_plc="yes" |
| Jean-Marc Valin | eafbdd5 | 2009-04-27 19:35:09 -0400 | [diff] [blame] | 151 | AC_DEFINE([NEW_PLC], , [Use new PLC code]) |
| 152 | fi]) |
| 153 | |
| Jean-Marc Valin | 4c9a007 | 2008-12-23 09:53:36 -0500 | [diff] [blame] | 154 | saved_CFLAGS="$CFLAGS" |
| 155 | CFLAGS="$CFLAGS -fvisibility=hidden" |
| 156 | AC_MSG_CHECKING([if ${CXX} supports -fvisibility=hidden]) |
| 157 | AC_COMPILE_IFELSE([char foo;], |
| 158 | [ AC_MSG_RESULT([yes]) |
| 159 | SYMBOL_VISIBILITY="-fvisibility=hidden" ], |
| 160 | AC_MSG_RESULT([no])) |
| 161 | CFLAGS="$saved_CFLAGS $SYMBOL_VISIBILITY" |
| 162 | AC_SUBST(SYMBOL_VISIBILITY) |
| 163 | |
| Jean-Marc Valin | 679f5cc | 2008-03-13 17:39:55 +1100 | [diff] [blame] | 164 | if test $ac_cv_c_compiler_gnu = yes ; then |
| Jean-Marc Valin | 4c9a007 | 2008-12-23 09:53:36 -0500 | [diff] [blame] | 165 | CFLAGS="$CFLAGS -W -Wstrict-prototypes -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wno-parentheses -Wno-unused-parameter -Wno-sign-compare" |
| Jean-Marc Valin | 679f5cc | 2008-03-13 17:39:55 +1100 | [diff] [blame] | 166 | fi |
| Jean-Marc Valin | 49ca99e | 2008-02-25 14:05:10 +1100 | [diff] [blame] | 167 | |
| Jean-Marc Valin | d9b9565 | 2008-08-31 23:34:47 -0400 | [diff] [blame] | 168 | AC_C99_FUNC_LRINTF |
| 169 | AC_C99_FUNC_LRINT |
| 170 | |
| Jean-Marc Valin | 6359089 | 2007-11-29 17:01:16 +1100 | [diff] [blame] | 171 | AC_CHECK_SIZEOF(short) |
| 172 | AC_CHECK_SIZEOF(int) |
| 173 | AC_CHECK_SIZEOF(long) |
| 174 | AC_CHECK_SIZEOF(long long) |
| 175 | |
| 176 | if test x$has_char16 = "xyes" ; then |
| 177 | case 1 in |
| 178 | $ac_cv_sizeof_short) SIZE16="short";; |
| 179 | $ac_cv_sizeof_int) SIZE16="int";; |
| 180 | esac |
| 181 | else |
| 182 | case 2 in |
| 183 | $ac_cv_sizeof_short) SIZE16="short";; |
| 184 | $ac_cv_sizeof_int) SIZE16="int";; |
| 185 | esac |
| 186 | fi |
| 187 | |
| 188 | if test x$has_char16 = "xyes" ; then |
| 189 | case 2 in |
| 190 | $ac_cv_sizeof_int) SIZE32="int";; |
| 191 | $ac_cv_sizeof_long) SIZE32="long";; |
| 192 | $ac_cv_sizeof_short) SIZE32="short";; |
| 193 | esac |
| 194 | else |
| 195 | case 4 in |
| 196 | $ac_cv_sizeof_int) SIZE32="int";; |
| 197 | $ac_cv_sizeof_long) SIZE32="long";; |
| 198 | $ac_cv_sizeof_short) SIZE32="short";; |
| 199 | esac |
| 200 | fi |
| 201 | |
| 202 | AC_SUBST(SIZE16) |
| 203 | AC_SUBST(SIZE32) |
| 204 | |
| Christopher Montgomery | 41d819d | 2009-01-13 13:39:53 -0500 | [diff] [blame] | 205 | AC_OUTPUT([Makefile libcelt/Makefile tests/Makefile |
| 206 | celt.pc tools/Makefile libcelt.spec ]) |
| Jean-Marc Valin | 6359089 | 2007-11-29 17:01:16 +1100 | [diff] [blame] | 207 | |
| Gregory Maxwell | 065bc15 | 2009-06-24 16:43:33 -0400 | [diff] [blame] | 208 | AC_MSG_RESULT([ |
| 209 | ------------------------------------------------------------------------ |
| 210 | $PACKAGE $VERSION: Automatic configuration OK. |
| 211 | |
| 212 | Compiler support: |
| 213 | |
| 214 | C99 var arrays: ................ ${has_var_arrays} |
| 215 | C99 lrintf: .................... ${ac_cv_c99_lrintf} |
| 216 | Alloca: ........................ ${has_alloca} |
| 217 | |
| 218 | General configuration: |
| 219 | |
| 220 | Fast float approximations: ..... ${float_approx} |
| 221 | Fixed point support: ........... ${ac_enable_fixed} |
| 222 | Fixed point debugging: ......... ${ac_enable_fixed_debug} |
| 223 | Static modes: .................. ${ac_enable_static_modes} |
| 224 | Assertion checking: ............ ${ac_enable_assertions} |
| 225 | New PLC: ....................... ${ac_enable_new_plc} |
| 226 | ------------------------------------------------------------------------ |
| 227 | ]) |
| 228 | |
| Jean-Marc Valin | e623312 | 2008-02-01 16:27:38 +1100 | [diff] [blame] | 229 | if test "x$tools" = "x"; then |
| Jean-Marc Valin | 6359089 | 2007-11-29 17:01:16 +1100 | [diff] [blame] | 230 | echo "**IMPORTANT**" |
| Gregory Maxwell | c8e200b | 2009-03-11 13:13:19 -0400 | [diff] [blame] | 231 | 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)" |
| Jean-Marc Valin | 6359089 | 2007-11-29 17:01:16 +1100 | [diff] [blame] | 232 | echo "You can download libogg from http://www.vorbis.com/download.psp" |
| 233 | fi |
| 234 | |
| 235 | echo "Type \"make; make install\" to compile and install"; |
| Gregory Maxwell | 065bc15 | 2009-06-24 16:43:33 -0400 | [diff] [blame] | 236 | echo "Type \"make check\" to run the test suite"; |