diff --git a/src/configure.in b/src/configure.in
index ab0ca94e30b60ef07b4a07b8a3581d2d8987db77..376867421983c61830e20ba367a976d805204692 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -43,8 +43,11 @@ AC_MSG_RESULT($pike_cv_sys_os)
 
 
 WARN=""
-if test x${GCC-} != xyes -a $cflags_is_set = no; then
-  WARN="-g -W -Wformat"
+OPTIMIZE=""
+if test $cflags_is_set = no; then
+ if test "x${GCC-}" = xyes ; then
+  WARN="-W -Wformat"
+ else
   OLD_CFLAGS="$CFLAGS"
   OPTIMIZE="";
   
@@ -85,6 +88,7 @@ if test x${GCC-} != xyes -a $cflags_is_set = no; then
       ;;
     esac
   fi
+ fi
 fi
 
 
@@ -92,15 +96,14 @@ fi
 if test "$GCC" = "yes"; then
   if test $cflags_is_set = no; then
     AC_MSG_CHECKING(-pipe)
+    OLD_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS -pipe"
     AC_CACHE_VAL(pike_cv_option_pipe,
     [
-      CFLAGS="$OLD_CFLAGS -pipe"
       AC_TRY_LINK([],[ exit(0); ],pike_cv_option_pipe=yes,pike_cv_option_pipe=no)
     ])
 
     if test "$pike_cv_option_pipe" = "yes" ; then
-      CFLAGS="$OLD_CFLAGS -pipe"
-      OPTIMIZE="$OPTIMIZE -pipe"
       AC_MSG_RESULT(-pipe found)
     else
       AC_MSG_RESULT(-pipe not found)
@@ -135,6 +138,7 @@ else
   exit 1
 fi
 
+
 #############################################################################
 
 AC_CONFIG_HEADER(machine.h)