--- a/gdb/configure
+++ b/gdb/configure
@@ -309,7 +309,7 @@
 # include <unistd.h>
 #endif"
 
-ac_subdirs_all="$ac_subdirs_all doc testsuite"
+ac_subdirs_all="$ac_subdirs_all doc"
 ac_subdirs_all="$ac_subdirs_all gdbtk"
 ac_subdirs_all="$ac_subdirs_all multi-ice"
 ac_subdirs_all="$ac_subdirs_all gdbserver"
@@ -5939,7 +5939,7 @@
 
 
 
-subdirs="$subdirs doc testsuite"
+subdirs="$subdirs doc"
 
 
 # Provide defaults for some variables set by the per-host and per-target
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -1239,7 +1239,7 @@
       ac_cache_corrupted=: ;;
     ,);;
     *)
-      if test "x$ac_old_val" != "x$ac_new_val"; then
+      if test "`echo $ac_old_val`" != "`echo $ac_new_val`"; then
 	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
 	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
--- a/gdb/testsuite/configure
+++ b/gdb/testsuite/configure
@@ -1248,7 +1248,7 @@
       ac_cache_corrupted=: ;;
     ,);;
     *)
-      if test "x$ac_old_val" != "x$ac_new_val"; then
+      if test "`echo $ac_old_val" != "`echo $ac_new_val"; then
 	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
 	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
--- a/Makefile.in
+++ b/Makefile.in
@@ -329,7 +329,7 @@
 # CFLAGS will be just -g.  We want to ensure that TARGET libraries
 # (which we know are built with gcc) are built with optimizations so
 # prepend -O2 when setting CFLAGS_FOR_TARGET.
-CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
+CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET))
 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
 CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -332,7 +332,7 @@
 # CFLAGS will be just -g.  We want to ensure that TARGET libraries
 # (which we know are built with gcc) are built with optimizations so
 # prepend -O2 when setting CFLAGS_FOR_TARGET.
-CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
+CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET))
 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
 CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
