diff --git a/libcelt/bitrdec.c b/libcelt/bitrdec.c
index d5bb2e15c705fd04b0dbda84a5f387ba7ebe55d9..9db568ad180bb04608f662ec161f07abeb8a2114 100644
--- a/libcelt/bitrdec.c
+++ b/libcelt/bitrdec.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "bitree.h"
 
 int ec_bitree_find_and_update(unsigned *_this,int _sz,int _split,
diff --git a/libcelt/bitree.c b/libcelt/bitree.c
index e76174865d7547d69759cb9b429578d05331351c..a84ffd3ba4a5974a483a444d0e016ae02e1fb201 100644
--- a/libcelt/bitree.c
+++ b/libcelt/bitree.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "bitree.h"
 
 void ec_bitree_to_counts(unsigned *_this,int _sz,int _split){
diff --git a/libcelt/bitrenc.c b/libcelt/bitrenc.c
index c65eb2969bb15634916476bd7dce6dddf8dd8e27..e0ca1154df833db93c634b6e832d10f4a528f40a 100644
--- a/libcelt/bitrenc.c
+++ b/libcelt/bitrenc.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "bitrenc.h"
 
 void ec_bitree_update(unsigned *_this,int _sz,int _sym,int _val){
diff --git a/libcelt/celt.c b/libcelt/celt.c
index 572f8569cf219c1ece563e56434818d6486a3ff3..8365276a47d959de67b405338e60625913670fde 100644
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -29,6 +29,10 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "os_support.h"
 #include "mdct.h"
 #include <math.h>
@@ -82,10 +86,11 @@ struct CELTEncoder {
 CELTEncoder *celt_encoder_new(const CELTMode *mode)
 {
    int i, N, B, C, N4;
+   CELTEncoder *st;
    N = mode->mdctSize;
    B = mode->nbMdctBlocks;
    C = mode->nbChannels;
-   CELTEncoder *st = celt_alloc(sizeof(CELTEncoder));
+   st = celt_alloc(sizeof(CELTEncoder));
    
    st->mode = mode;
    st->frame_size = B*N;
@@ -153,13 +158,15 @@ static float compute_mdcts(mdct_lookup *mdct_lookup, float *window, float *in, f
 {
    int i, c;
    float E = 1e-15;
+   VARDECL(float *x);
+   VARDECL(float *tmp);
+   ALLOC(x, 2*N, float);
+   ALLOC(tmp, N, float);
    for (c=0;c<C;c++)
    {
       for (i=0;i<B;i++)
       {
          int j;
-         float x[2*N];
-         float tmp[N];
          for (j=0;j<2*N;j++)
          {
             x[j] = window[j]*in[C*i*N+C*j+c];
@@ -177,14 +184,16 @@ static float compute_mdcts(mdct_lookup *mdct_lookup, float *window, float *in, f
 static void compute_inv_mdcts(mdct_lookup *mdct_lookup, float *window, float *X, float *out_mem, float *mdct_overlap, int N, int overlap, int B, int C)
 {
    int i, c, N4;
+   VARDECL(float *x);
+   VARDECL(float *tmp);
+   ALLOC(x, 2*N, float);
+   ALLOC(tmp, N, float);
    N4 = (N-overlap)/2;
    for (c=0;c<C;c++)
    {
       for (i=0;i<B;i++)
       {
          int j;
-         float x[2*N];
-         float tmp[N];
          /* De-interleaving the sub-frames */
          for (j=0;j<N;j++)
             tmp[j] = X[C*B*j+C*i+c];
diff --git a/libcelt/cwrs.c b/libcelt/cwrs.c
index af20945c2917b95914c1597007ed4ffb7c592f6e..dc28805846d8daa0f6f661bfaf1f65ad1e348c5b 100644
--- a/libcelt/cwrs.c
+++ b/libcelt/cwrs.c
@@ -32,6 +32,11 @@
 /* Functions for encoding and decoding pulse vectors. For more details, see:
    http://people.xiph.org/~tterribe/notes/cwrs.html
 */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdlib.h>
 #include "cwrs.h"
 
diff --git a/libcelt/entcode.c b/libcelt/entcode.c
index e1ca492d50f48845e123b4a795985e27b1118cc2..fe3560610162c7f577ff3a4a5755dd7d285622c7 100644
--- a/libcelt/entcode.c
+++ b/libcelt/entcode.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "entcode.h"
 
 
diff --git a/libcelt/entdec.c b/libcelt/entdec.c
index e5617ba0267d731de5810ff704f6259bb59ab10a..c6d4314b299dc5e6762524fb5be840f4dfce879d 100644
--- a/libcelt/entdec.c
+++ b/libcelt/entdec.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stddef.h>
 #include "entdec.h"
 
diff --git a/libcelt/entenc.c b/libcelt/entenc.c
index 62ef8844fa2fef701d9acfaa2ca66c854933dc9e..99f7fbbe16c55029e3b0c085fcd9f2799a907f9a 100644
--- a/libcelt/entenc.c
+++ b/libcelt/entenc.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdlib.h>
 #include <string.h>
 #include "entenc.h"
diff --git a/libcelt/laplace.c b/libcelt/laplace.c
index 3abed2a623be75453afeb0238c955de75f0bf2bd..087c05c0bce48ffa6e8fff0b8816da6d64cfd12c 100644
--- a/libcelt/laplace.c
+++ b/libcelt/laplace.c
@@ -29,6 +29,10 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "entenc.h"
 #include "entdec.h"
 
diff --git a/libcelt/mdct.c b/libcelt/mdct.c
index 5dfd548cf2b07af3a2f1e3401417b2b248cea6fe..cbbfc875bf8721c7ead1659f934086bd77d965bc 100644
--- a/libcelt/mdct.c
+++ b/libcelt/mdct.c
@@ -42,6 +42,10 @@
    and scaling in many places. 
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "mdct.h"
 #include "kiss_fft.h"
 #include <math.h>
diff --git a/libcelt/modes.c b/libcelt/modes.c
index b4d0b8f1803f77578959828615a34213dad388c8..496f242c8fbc738e99870b697a494dfa1c80d422 100644
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -29,6 +29,10 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "celt.h"
 #include "modes.h"
 #include "rate.h"
diff --git a/libcelt/pitch.c b/libcelt/pitch.c
index 6f0e245cd9c2366a5e307201a1e5f0bf1643d885..8a2e572cda999c688f3e6da858f86e8363293e6d 100644
--- a/libcelt/pitch.c
+++ b/libcelt/pitch.c
@@ -20,6 +20,9 @@
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <stdio.h>
 #include <math.h>
diff --git a/libcelt/psy.c b/libcelt/psy.c
index 9b8762dd1646ce62a5210d8e76569e7503a0072d..0dec6cceb0b5eec1edf6c4a4d3970b73203e7cf3 100644
--- a/libcelt/psy.c
+++ b/libcelt/psy.c
@@ -29,6 +29,10 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "psy.h"
 #include <math.h>
 #include "os_support.h"
diff --git a/libcelt/quant_bands.c b/libcelt/quant_bands.c
index 34480068836ce8f97e5817ba5b9422589c1e8e6b..5ea71c94aaf920159b1604e78b7ac30424e9dfa4 100644
--- a/libcelt/quant_bands.c
+++ b/libcelt/quant_bands.c
@@ -29,6 +29,9 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include "quant_bands.h"
 #include "laplace.h"
diff --git a/libcelt/quant_pitch.c b/libcelt/quant_pitch.c
index 6b6adfd4e6a253f04c4c511f290ab9f347fcc60f..2935ba74dacc8f2ff41894b8fdfbe2ad39511adb 100644
--- a/libcelt/quant_pitch.c
+++ b/libcelt/quant_pitch.c
@@ -29,6 +29,10 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "quant_pitch.h"
 #include <math.h>
 #include "pgain_table.h"
diff --git a/libcelt/rangedec.c b/libcelt/rangedec.c
index 84726f364ca05c4bedc83ae83606fbb44fd95648..4ff10d8fbee91be2159215e4dfe9d14cfe5babb5 100644
--- a/libcelt/rangedec.c
+++ b/libcelt/rangedec.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stddef.h>
 #include "entdec.h"
 #include "mfrngcod.h"
diff --git a/libcelt/rangeenc.c b/libcelt/rangeenc.c
index f8ff3e36de74bc3ec0cc2915c00dc8a7635e82bb..885854f7ca4be0f021169f1d08b2bc509396dc02 100644
--- a/libcelt/rangeenc.c
+++ b/libcelt/rangeenc.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stddef.h>
 #include "entenc.h"
 #include "mfrngcod.h"
diff --git a/libcelt/rate.c b/libcelt/rate.c
index 6b5a59019bbbb792c6be85dc8594228c817fb29e..06358fc59491e561b6b6eea60fb52d30a68e2038 100644
--- a/libcelt/rate.c
+++ b/libcelt/rate.c
@@ -29,6 +29,10 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <math.h>
 #include "modes.h"
 #include "cwrs.h"
diff --git a/libcelt/vq.c b/libcelt/vq.c
index d463892786cdf4a88d70a5d1dccf0c358e9dd9f1..5f6e4d806670c15f598881a3454a02ac66ba65f9 100644
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -29,6 +29,10 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <math.h>
 #include <stdlib.h>
 #include "cwrs.h"