[xiph-commits] r13366 - in trunk/speex: . libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Wed Jul 25 18:59:33 PDT 2007
Author: jm
Date: 2007-07-25 18:59:32 -0700 (Wed, 25 Jul 2007)
New Revision: 13366
Modified:
trunk/speex/configure.ac
trunk/speex/libspeex/stack_alloc.h
trunk/speex/libspeex/testecho.c
Log:
Patch by moritz (ticket #1213) that fixes three build issues:
* Compile on systems with C99 variable-size arrays that do not support C99
variable declarations. Achieve this by making the check deliberately use
C99 variable declarations.
* Add missing check for alloca.h. At least on OpenBSD, alloc() is declared in
stdlib.h and alloc.h does not exist. Adjust libspeex/stack_alloc.h to cope.
* Declare 'int tmp;' at the beginning of the code block in libspeex/testecho.c.
Modified: trunk/speex/configure.ac
===================================================================
--- trunk/speex/configure.ac 2007-07-25 19:52:30 UTC (rev 13365)
+++ trunk/speex/configure.ac 2007-07-26 01:59:32 UTC (rev 13366)
@@ -40,7 +40,8 @@
AC_MSG_CHECKING(for C99 variable-size arrays)
AC_TRY_COMPILE( , [
-int foo=10;
+int foo;
+foo = 10;
int array[foo];
],
[has_var_arrays=yes;AC_DEFINE([VAR_ARRAYS], [], [Use C99 variable-size arrays])
@@ -49,8 +50,14 @@
)
AC_MSG_RESULT($has_var_arrays)
+AC_CHECK_HEADERS(alloca.h)
AC_MSG_CHECKING(for alloca)
-AC_TRY_COMPILE( [#include <alloca.h>], [
+AC_TRY_COMPILE( [
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#endif
+#include <stdlib.h>
+], [
int foo=10;
int *array = alloca(foo);
],
Modified: trunk/speex/libspeex/stack_alloc.h
===================================================================
--- trunk/speex/libspeex/stack_alloc.h 2007-07-25 19:52:30 UTC (rev 13365)
+++ trunk/speex/libspeex/stack_alloc.h 2007-07-26 01:59:32 UTC (rev 13366)
@@ -36,12 +36,16 @@
#define STACK_ALLOC_H
#ifdef USE_ALLOCA
-#ifdef WIN32
-#include <malloc.h>
-#else
-#include <alloca.h>
+# ifdef WIN32
+# include <malloc.h>
+# else
+# ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# include <stdlib.h>
+# endif
+# endif
#endif
-#endif
/**
* @def ALIGN(stack, size)
Modified: trunk/speex/libspeex/testecho.c
===================================================================
--- trunk/speex/libspeex/testecho.c 2007-07-25 19:52:30 UTC (rev 13365)
+++ trunk/speex/libspeex/testecho.c 2007-07-26 01:59:32 UTC (rev 13366)
@@ -17,7 +17,7 @@
int main(int argc, char **argv)
{
- int echo_fd, ref_fd, e_fd;
+ int echo_fd, ref_fd, e_fd, tmp;
short echo_buf[NN], ref_buf[NN], e_buf[NN];
SpeexEchoState *st;
SpeexPreprocessState *den;
@@ -33,7 +33,7 @@
st = speex_echo_state_init(NN, TAIL);
den = speex_preprocess_state_init(NN, 8000);
- int tmp = 8000;
+ tmp = 8000;
speex_echo_ctl(st, SPEEX_ECHO_SET_SAMPLING_RATE, &tmp);
speex_preprocess_ctl(den, SPEEX_PREPROCESS_SET_ECHO_STATE, st);
More information about the commits
mailing list