diff --git a/Makefile.am b/Makefile.am
index 76490f7fa281f60f22886e8bb02d152fa332c8d5..791b19802f6cd8f10f7ccecea6051156781773be 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,5 @@
+AUTOMAKE_OPTIONS = subdir-objects
+
 lib_LTLIBRARIES = libopus.la
 
 INCLUDES = -I$(top_srcdir)/libcelt -I$(top_srcdir)/silk -I$(top_srcdir)/silk/float -I$(top_srcdir)/silk/fixed
diff --git a/autogen.sh b/autogen.sh
index 35cad6789b9f88697aa94df3cd2c97aea07d46c6..60d6ef18fa2c18c3859612f824e75aa2d54d47aa 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -22,10 +22,14 @@ echo "checking for autoconf... "
 
 VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9]*\).*/\1/"
 VERSIONMKINT="sed -e s/[^0-9]//"
-                                                                                
+
 # do we need automake?
 if test -r Makefile.am; then
-  AM_NEEDED=`fgrep AUTOMAKE_OPTIONS Makefile.am | $VERSIONGREP`
+  AM_OPTIONS=`fgrep AUTOMAKE_OPTIONS Makefile.am`
+  AM_NEEDED=`echo $AM_OPTIONS | $VERSIONGREP`
+  if test "$AM_NEEDED" = "$AM_OPTIONS"; then
+    AM_NEEDED=""
+  fi
   if test -z $AM_NEEDED; then
     echo -n "checking for automake... "
     AUTOMAKE=automake
diff --git a/configure.ac b/configure.ac
index 747623dbfe7681c972ebb2a8f44a53a08ae59b1a..5a3077887566abf10357fafa5ed9b64c12a57b7a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,6 +45,7 @@ AM_MAINTAINER_MODE
 
 AC_CANONICAL_HOST
 AM_PROG_LIBTOOL
+AM_PROG_CC_C_O
 
 AC_PROG_CC_C99
 AC_C_BIGENDIAN