"Joseph S. Myers" <jos...@codesourcery.com> writes: > On Fri, 7 Oct 2011, Ian Lance Taylor wrote: > >> 2011-10-07 Simon Baldwin <sim...@google.com> >> >> * configure.ac: Add --with-native-system-header-dir option. >> * configure: Rebuild from configure.ac. >> * Makefile.in: Support --with-native-system-header-dir. >> * doc/install.texi: Document --with-native-system-header-dir. > > How does this end up affecting the paths in cppdefault.c, and which of the > macros there does it affect? (I don't see how STANDARD_INCLUDE_DIR, the > normal /usr/include path, gets affected by this patch; I can only see how > it affects the paths used to find inputs to fixincludes.)
Hmmm, you're quite right. Simon's patch works because of a subsequent patch of his, which adds a --with-runtime-root-prefix configure option. It looks like we currently have NATIVE_SYSTEM_HEADER_DIR in Makefile fragments and STANDARD_INCLUDE_DIR and SYSTEM_INCLUDE_DIR in tm.h files. The documentation for NATIVE_SYSTEM_HEADER_DIR says that it should match SYSTEM_INCLUDE_DIR. However, in fact, nothing in the tree defines SYSTEM_INCLUDE_DIR. NATIVE_SYSTEM_HEADER_DIR is defined by five Makefile fragments: config/i386/t-djgpp config/i386/t-mingw-w64 config/i386/t-mingw-w32 config/i386/t-mingw32 config/t-gnu config/spu/t-spu-elf STANDARD_INCLUDE_DIR is defined by: config/i386/djgpp.h config/i386/mingw32.h config/spu/spu-elf.h config/gnu.h config/vms/xm-vms.h The uses in DJGPP and Mingw support all match. config/gnu.h is only used on i[34567]86-*-gnu* while config/t-gnu is used on *-*-gnu*; this mismatch appears to be an error. The use of STANDARD_INCLUDE_DIR in config/vms/xm-vms.h without defining NATIVE_SYSTEM_HEADER_DIR appears to be an error. The configure script uses "/usr/include" when setting target_header_dir. This is incorrect when NATIVE_SYSTEM_HEADER_DIR is defined by a Makefile fragment. So, it seems to me that we should: * Remove SYSTEM_INCLUDE_DIR, which is undefined and unnecessary. * Move the definition of NATIVE_SYSTEM_HEADER_DIR into config.gcc (named native_system_header_dir). The default is /usr/include. This appears to be necessary since the configure script itself needs to know this value. * Have the configure script use NATIVE_SYSTEM_HEADER_DIR when setting target_header_dir. * Arrange for Makefile to define NATIVE_SYSTEM_HEADER_DIR when compiling cppdefault.c (i.e., add it to PREPROCESSOR_DEFINES in Makefile.in). * Replace STANDARD_INCLUDE_DIR in cppdefault.c with NATIVE_SYSTEM_HEADER_DIR. * Remove STANDARD_INCLUDE_DIR. * Add the --with-native-system-header-dir option. This will remove the setting in vms/xm-vms.h; people using VMS as a host should be advised to use --with-sysroot instead. I think this will get us to a consistent state where the name of the header file directory is defined in one place and is used everywhere it is appropriate. Ian