In my earlier patch to add support for --with-native-system-header-dir,
I messed up the case of a cross-compiler when not using --with-sysroot.
In that case the compiler was incorrectly searching /usr/include. This
patch restores the logic to what it used to be before my patch. As the
patch is straightforward and simply restores the code to what it used to
be before my earlier patch, I plan to go ahead and commit this after
bootstrap and testing passes. Please let me know if you object.
Ian
2011-10-26 Ian Lance Taylor <[email protected]>
* cppdefault.c: Undef NATIVE_SYSTEM_HEADER_DIR if
CROSS_DIRECTORY_STRUCTURE is defined and TARGET_SYSTEM_ROOT is
not.
(cpp_include_defaults): Only use NATIVE_SYSTEM_HEADER_DIR if it is
defined.
Index: gcc/cppdefault.c
===================================================================
--- gcc/cppdefault.c (revision 180530)
+++ gcc/cppdefault.c (working copy)
@@ -32,6 +32,7 @@
#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
# undef LOCAL_INCLUDE_DIR
+# undef NATIVE_SYSTEM_HEADER_DIR
#else
# undef CROSS_INCLUDE_DIR
#endif
@@ -84,8 +85,10 @@ const struct default_include cpp_include
/* Another place the target system's headers might be. */
{ TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 },
#endif
+#ifdef NATIVE_SYSTEM_HEADER_DIR
/* /usr/include comes dead last. */
{ NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
+#endif
{ 0, 0, 0, 0, 0, 0 }
};
#endif /* no INCLUDE_DEFAULTS */