diff --git a/src/configure.in b/src/configure.in
index 1854fe77e2309e9bc6d8e490320727cad273ad35..f30e2e63cfba2569f46ad9b7dd6c9368d1a1cffc 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -1,4 +1,4 @@
-AC_REVISION("$Id: configure.in,v 1.680 2003/02/03 17:25:53 grubba Exp $")
+AC_REVISION("$Id: configure.in,v 1.681 2003/02/08 00:48:52 mast Exp $")
 AC_INIT(interpret.c)
 AC_CONFIG_HEADER(machine.h)
 
@@ -1999,8 +1999,6 @@ fi
 #Restore preprocessor warning sensitivity
 ac_c_preproc_warn_flag="$OLD_ac_c_preproc_warn_flag"
 
-#CPPFLAGS="${CPPFLAGS} -I$srcdir -I`pwd`"
-
 echo Searching for library directories...
 if test $ldflags_is_set = no ; then
   for dd in `echo ${with_lib_path} | sed 's/:/ /g'` \
@@ -2079,9 +2077,14 @@ export EXTRA_PATH
 
 else
   # We are running NT
-  CPPFLAGS="${CPPFLAGS} -I$srcdir -I`pwd`"  
+  :
 fi
 
+# During the configure tests we need some extra includes that
+# shouldn't be there in the final version.
+CONF_CPPFLAGS_EXTRA="-I$srcdir -I`pwd`"
+CPPFLAGS="${CPPFLAGS} ${CONF_CPPFLAGS_EXTRA}"  
+
 #############################################################################
 
 ## At this point we have at last initialized the compiler!
@@ -5269,7 +5272,7 @@ AC_CACHE_VAL(pike_cv_sys_nonblock,
 		  USE_IOCTL_FIONBIO USE_IOCTLSOCKET_FIONBIO; do
       # Make sure we can run configure in a separate directory,
       # and set the method to try.
-      CPPFLAGS="-I$srcdir $OCPPFLAGS -D$method"
+      CPPFLAGS="$OCPPFLAGS -D$method"
       AC_TRY_RUN([
 #define TESTING
 #include "fd_control.c"
@@ -5297,7 +5300,7 @@ AC_CACHE_VAL(pike_cv_sys_nonblock,
 		    USE_IOCTL_FIONBIO USE_IOCTLSOCKET_FIONBIO; do
 	# Make sure we can run configure in a separate directory,
 	# and set the method to try.
-	CPPFLAGS="-I$srcdir $OCPPFLAGS -D$method -DSHORT_TEST"
+	CPPFLAGS="$OCPPFLAGS -D$method -DSHORT_TEST"
 	AC_TRY_RUN([
 #define TESTING
 #include "fd_control.c"
@@ -5333,8 +5336,6 @@ AC_CACHE_VAL(pike_cv_system_oob_working,[
 if test "x$enable_binary" = "xno"; then
   pike_cv_system_oob_working=WORKING
 else
-  OCPPFLAGS="$CPPFLAGS"
-  CPPFLAGS="-I. -I../.. -I$srcdir -I$srcdir/../.."
   AC_TRY_RUN([
 #include <stdio.h>
 #include <sys/types.h>
@@ -5655,7 +5656,6 @@ int main(int argc, char **argv)
 pike_cv_system_oob_working="`cat conftest.out.2`",
 pike_cv_system_oob_working=UNKNOWN,
 pike_cv_system_oob_working=UNKNOWN)
-  CPPFLAGS="$OCPPFLAGS"
   
   rm conftest.out.2 >/dev/null 2>/dev/null || :
 fi
@@ -6002,8 +6002,6 @@ AC_CACHE_VAL(pike_cv_sys_dynamic_loading,
     mv conftest.$SO myconftest.so
 
     OLD_CFLAGS="$CFLAGS"
-    OLD_CPPFLAGS="$CPPFLAGS"
-    CPPFLAGS="-I$srcdir $OLD_CPPFLAGS"
     
     CFLAGS="$CFLAGS $LINKFORSHARED"
     OLD_CC="$CC"
@@ -6018,7 +6016,6 @@ AC_CACHE_VAL(pike_cv_sys_dynamic_loading,
 void testfunc2(void) { exit(0); }
 ], pike_cv_sys_dynamic_loading=yes, pike_cv_sys_dynamic_loading=no, pike_cv_sys_dynamic_loading=no)
     CFLAGS="$OLD_CFLAGS"
-    CPPFLAGS="${OLD_CPPFLAGS}"
     CC="$OLD_CC"
   else    
     pike_cv_sys_dynamic_loading=no
@@ -6196,6 +6193,17 @@ dnl  fi
 
 dnl fi
 
+#############################################################################
+# Remove the extra args temporarily added to CPPFLAGS.
+
+for extra_arg in $CONF_CPPFLAGS_EXTRA; do
+  NEW_CPPFLAGS=""
+  for arg in $CPPFLAGS; do
+    test "$arg" = "$extra_arg" || NEW_CPPFLAGS="$NEW_CPPFLAGS $arg"
+  done
+  CPPFLAGS="$NEW_CPPFLAGS"
+done
+
 #############################################################################
 
 if test x$with_dynamic_modules = xyes ; then