diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 61abdeb8ffad44ef4a76c365862e2c5f546eaeb5..0a566ff5432dcf8bed2793130d5a236c77b78bf3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2010-07-23  Kai Tietz  <kai.tietz@onevision.com>
+
+	PR target/41943
+	* Makefile.in (USER_H_INC_NEXT_PRE,
+	USER_H_INC_NEXT_POST): New.
+	(stmp-int-hdrs): Prefix/postfix headers by include_next.
+	* config.gcc (user_headers_inc_next_pre): New.
+	(user_headers_inc_next_post): Likewise.
+	(*-w64-mingw*): Use for float.h post-fixing, and for
+	stddef.h/stdarg.h pre-fixing by include_next.
+	* configure.ac (user_headers_inc_next_post): New.
+	(user_headers_inc_next_pre): New.
+	* configure: Regenerated.
+
 2010-07-23  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
 	* configure.ac: Don't disable TLS on Solaris 8/9 by default
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 22e4ee80fe24cc7f8c65e2a05b2e50baa8daf317..d66b905633e9920e041ea1662f86dd73974496ba 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -366,6 +366,9 @@ USER_H = $(srcdir)/ginclude/float.h \
 	 $(srcdir)/ginclude/stdfix.h \
 	 $(EXTRA_HEADERS)
 
+USER_H_INC_NEXT_PRE = @user_headers_inc_next_pre@
+USER_H_INC_NEXT_POST = @user_headers_inc_next_post@
+
 UNWIND_H = $(srcdir)/unwind-generic.h
 
 # The GCC to use for compiling crt*.o.
@@ -4014,6 +4017,21 @@ stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) $(UNWIND_H) fixinc_list
 	    chmod a+r include/$$realfile; \
 	  fi; \
 	done
+	for file in .. $(USER_H_INC_NEXT_PRE); do \
+	  if [ X$$file != X.. ]; then \
+            mv include/$$file include/x_$$file; \
+            echo "#include_next <$$file>" >include/$$file; \
+            cat include/x_$$file >>include/$$file; \
+            rm -f include/x_$$file; \
+	    chmod a+r include/$$file; \
+	  fi; \
+	done
+	for file in .. $(USER_H_INC_NEXT_POST); do \
+	  if [ X$$file != X.. ]; then \
+	    echo "#include_next <$$file>" >>include/$$file; \
+	    chmod a+r include/$$file; \
+	  fi; \
+	done
 	rm -f include/unwind.h
 	cp $(UNWIND_H) include/unwind.h
 	chmod a+r include/unwind.h
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 12b245d219d930939428c7047ebbb9d94e88b4c1..eef0942c53209df4d29acd68e9f6a45e0bfb288d 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -101,6 +101,12 @@
 #  extra_headers	List of used header files from the directory
 #			config/${cpu_type}.
 #
+#  user_headers_inc_next_pre
+#			List of header file names of internal gcc header
+#			files, which should be prefixed by an include_next.
+#  user_headers_inc_next_post
+#			List of header file names of internal gcc header
+#			files, which should be postfixed by an include_next.
 #  use_gcc_tgmath	If set, add tgmath.h to the list of used header
 #			files.
 #
@@ -171,6 +177,8 @@
 out_file=
 tmake_file=
 extra_headers=
+user_headers_inc_next_pre=
+user_headers_inc_next_post=
 use_gcc_tgmath=yes
 use_gcc_stdint=none
 extra_passes=
@@ -1379,6 +1387,8 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
 	# This makes the logic if mingw's or the w64 feature set has to be used
 	case ${target} in
 		*-w64-*)
+			user_headers_inc_next_post="${user_headers_inc_next_post} float.h"
+			user_headers_inc_next_pre="${user_headers_inc_next_pre} stddef.h stdarg.h"
 			tm_file="${tm_file} i386/mingw-w64.h"
 			if test x$enable_targets = xall; then
 				tm_defines="${tm_defines} TARGET_BI_ARCH=1"
diff --git a/gcc/configure b/gcc/configure
index fedfaa7f090cac2b5d6d988315d45dd276ec803d..aa61cd6589ce2df937cee791ee856c43d0efa796 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -646,6 +646,8 @@ extra_passes
 extra_parts
 extra_objs
 extra_headers_list
+user_headers_inc_next_post
+user_headers_inc_next_pre
 extra_gcc_objs
 TM_MULTILIB_EXCEPTIONS_CONFIG
 TM_MULTILIB_CONFIG
@@ -17107,7 +17109,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17110 "configure"
+#line 17112 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17213,7 +17215,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17216 "configure"
+#line 17218 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -25570,6 +25572,8 @@ fi
 
 
 
+
+
 
 
 
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 143db7e3940f3059f67b36c8d1d2014dca634b44..24d38aa73c30fc9655bf0e8101c184b37d27e74f 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -4550,6 +4550,8 @@ AC_SUBST(TM_ENDIAN_CONFIG)
 AC_SUBST(TM_MULTILIB_CONFIG)
 AC_SUBST(TM_MULTILIB_EXCEPTIONS_CONFIG)
 AC_SUBST(extra_gcc_objs)
+AC_SUBST(user_headers_inc_next_pre)
+AC_SUBST(user_headers_inc_next_post)
 AC_SUBST(extra_headers_list)
 AC_SUBST(extra_objs)
 AC_SUBST(extra_parts)