diff --git a/gcc/fix-header.c b/gcc/fix-header.c
index f6cc5e8d6d974e2e937466a106f3e454826a32d6..979cde3fb544c3e3d5bfa58c9aaeff0349dab79d 100644
--- a/gcc/fix-header.c
+++ b/gcc/fix-header.c
@@ -127,9 +127,21 @@ char *inf_ptr;
 enum special_file
 {
   no_special,
+#ifdef errno_h
+#undef errno_h
+#endif
   errno_h,
+#ifdef stdio_h
+#undef stdio_h
+#endif
   stdio_h,
+#ifdef stdlib_h
+#undef stdlib_h
+#endif
   stdlib_h,
+#ifdef sys_stat_h
+#undef sys_stat_h
+#endif
   sys_stat_h
 };