Re: PATCH RFA: New configure option --with-native-system-header-dir
On 10/09/2011 08:18 AM, Ian Lance Taylor wrote: +#undef NATIVE_HEADER_HEADER_COMPONENT +#define NATIVE_SYSTEM_HEADER_COMPONENT MINGW Typo (I think), otherwise okay. Paolo
Re: PATCH RFA: New configure option --with-native-system-header-dir
+ yes|no) AC_MSG_ERROR([bad value ${withval} given for --with-native-system-header-dir]) ;; + /*) ;; + *) AC_MSG_ERROR([--with-native-system-header-dir argument ${withval} must be an absolute directory]) ;; This doesn't handle DOS-style absolute paths (like c:/Users). Not sure if we care about '\' separators but they probably should be checked for too (if the user can figure out how to make those work elsewhere, we shouldn't prevent it here). Otherwise, I'm OK with the build-specific portions of the patch (and the djgpp-specific ones).
Re: PATCH RFA: New configure option --with-native-system-header-dir
On Sat, 8 Oct 2011, Ian Lance Taylor wrote: This patch implements this proposal. Only lightly tested so far. How does this look if testing succeeds? OK in the absence of build system maintainer objections within 24 hours. -- Joseph S. Myers jos...@codesourcery.com
Re: PATCH RFA: New configure option --with-native-system-header-dir
Ian Lance Taylor i...@google.com writes: 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 patch implements this proposal. Only lightly tested so far. How does this look if testing succeeds? Ian 2011-10-08 Simon Baldwin sim...@google.com Ian Lance Taylor i...@google.com * configure.ac: Add --with-native-system-header-dir. Set and substitute NATIVE_SYSTEM_HEADER_DIR. Use native_system_header when setting target_header_dir. * config.gcc: Always set native_system_header_dir. (*-*-gnu*): Set native_system_header_dir. Don't use t-gnu. (i[34567]86-pc-msdosdjgpp*): Set native_system_header_dir. Don't use i386/t-djgpp. (i[34567]86-*-mingw* | x86_64-*-mingw*): Set native_system_header_dir. (spu-*-elf*): Set native_system_header_dir. * Makefile.in (NATIVE_SYSTEM_HEADER_DIR): Set to @NATIVE_SYSTEM_HEADER_DIR@. (PREPROCESSOR_DEFINES): Define NATIVE_SYSTEM_HEADER_DIR. * cppdefault.c (STANDARD_INCLUDE_DIR): Don't define. (NATIVE_SYSTEM_HEADER_COMPONENT): Rename from STANDARD_INCLUDE_COMPONENT. (cpp_include_defaults): Don't use SYSTEM_INCLUDE_DIR. Rename STANDARD_INCLUDE_DIR to NATIVE_SYSTEM_HEADER_DIR. * system.h: Poison SYSTEM_INCLUDE_DIR, STANDARD_INCLUDE_DIR, and STANDARD_INCLUDE_COMPONENT. * config/i386/t-mingw32 (NATIVE_SYSTEM_HEADER_DIR): Remove. * config/i386/t-mingw-w32: Likewise. * config/i386/t-mingw-w64: Likewise. * config/spu/t-spu-elf: Likewise. * config/i386/t-djgpp: Remove. * config/t-gnu: Remove. * config/i386/mingw32.h (STANDARD_INCLUDE_DIR): Don't define. (NATIVE_SYSTEM_HEADER_COMPONENT): Rename from STANDARD_INCLUDE_COMPONENT. * config/i386/djgpp.h (STANDARD_INCLUDE_DIR): Don't define. * config/spu/spu-elf.h: Likewise. * config/vms/xm-vms.h: Likewise. * config/gnu.h: Likewise. * config/openbsd.h (INCLUDE_DEFAULTS): Change STANDARD_INCLUDE_DIR and STANDARD_INCLUDE_COMPONENT to NATIVE_SYSTEM_HEADER_DIR and NATIVE_SYSTME_HEADER_COMPONENT. * doc/install.texi (Configuration): Document --with-native-system-header-dir. Mention it in the documentation for --with-sysroot and --with-build-sysroot. * doc/tm.texi.in (Driver): Don't document SYSTEM_INCLUDE_DIR or STANDARD_INCLUDE_DIR. Rename STANDARD_INCLUDE_COMPONENT to NATIVE_SYSTEM_HEADER_COMPONENT. Rename uses of STANDARD_INCLUDE_DIR to NATIVE_SYSTEM_HEADER_DIR. * doc/fragments.texi (Target Fragment): Don't document NATIVE_SYSTEM_HEADER_DIR. * configure, doc/tm.texi: Rebuild. Index: doc/fragments.texi === --- doc/fragments.texi (revision 179696) +++ doc/fragments.texi (working copy) @@ -1,5 +1,6 @@ @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -@c 1999, 2000, 2001, 2003, 2004, 2005, 2008 Free Software Foundation, Inc. +@c 1999, 2000, 2001, 2003, 2004, 2005, 2008, 2011 +@c Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @@ -128,12 +129,6 @@ compiler. In that case, set @code{MULTI of options to be used for all builds. If you set this, you should probably set @code{CRTSTUFF_T_CFLAGS} to a dash followed by it. -@findex NATIVE_SYSTEM_HEADER_DIR -@item NATIVE_SYSTEM_HEADER_DIR -If the default location for system headers is not @file{/usr/include}, -you must set this to the directory containing the headers. This value -should match the value of the @code{SYSTEM_INCLUDE_DIR} macro. - @findex SPECS @item SPECS Unfortunately, setting @code{MULTILIB_EXTRA_OPTS} is not enough, since Index: doc/tm.texi.in === --- doc/tm.texi.in (revision 179696) +++ doc/tm.texi.in (working copy) @@ -468,33 +468,15 @@ initialize the necessary environment var Define this macro as a C string constant if you wish to override the standard choice of @file{/usr/local/include} as the default prefix to try when searching for local header files.
Re: PATCH RFA: New configure option --with-native-system-header-dir
On Fri, 7 Oct 2011, Ian Lance Taylor wrote: 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 There are no other *-*-gnu* targets (the others were all removed as bitrotten). So, it seems to me that we should: These proposals generally seem reasonable (with remove taken to be remove and poison in system.h as usual for removed target macros). -- Joseph S. Myers jos...@codesourcery.com
PATCH RFA: New configure option --with-native-system-header-dir
I would like to bring Simon's patch for the --with-native-system-header-dir configure option from the google/integration branch into gcc mainline. This patch permits changing the system header directory from /usr/include to something else. It's mainly useful in conjunction with sysroot, so that the header files don't have to live in usr/include under the sysroot. Simon's original patch: http://gcc.gnu.org/ml/gcc-patches/2011-01/msg01811.html Bootstrapped and tested on x86_64-unknown-linux-gnu. OK for mainline? Ian 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. Index: configure.ac === --- configure.ac (revision 179665) +++ configure.ac (working copy) @@ -725,6 +725,23 @@ AC_ARG_ENABLE(shared, ], [enable_shared=yes]) AC_SUBST(enable_shared) +# The use of native_system_header_dir here is for the value (optionally) +# configured here. Uses of NATIVE_SYSTEM_HEADER_DIR in this file refer +# to the make variable defined in Makefile or in target make fragments. +AC_ARG_WITH([native-system-header-dir], + [ --with-native-system-header-dir=dir + use dir as the directory to look for standard + system header files in. Defaults to /usr/include.], +[ + case ${with_native_system_header_dir} in + yes|no) AC_MSG_ERROR([bad value ${withval} given for native system include directory]) ;; + /*) ;; + *) AC_MSG_ERROR([${withval} should be an absolute directory]) ;; + esac + native_system_header_dir=${withval} +], [native_system_header_dir=/usr/include]) +AC_SUBST(NATIVE_SYSTEM_HEADER_DIR, $native_system_header_dir) + AC_ARG_WITH(build-sysroot, [AS_HELP_STRING([--with-build-sysroot=sysroot], [use sysroot as the system root during the build])], @@ -4515,14 +4532,14 @@ if test x$host != x$target || test x$TA elif test x$with_sysroot = x; then target_header_dir=${exec_prefix}/${target_noncanonical}/sys-include elif test x$with_build_sysroot != x; then -target_header_dir=${with_build_sysroot}/usr/include +target_header_dir=${with_build_sysroot}${native_system_header_dir} elif test x$with_sysroot = xyes; then -target_header_dir=${exec_prefix}/${target_noncanonical}/sys-root/usr/include +target_header_dir=${exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir} else -target_header_dir=${with_sysroot}/usr/include +target_header_dir=${with_sysroot}${native_system_header_dir} fi else - target_header_dir=/usr/include + target_header_dir=${native_system_header_dir} fi # Test for stack protector support in target C library. Index: Makefile.in === --- Makefile.in (revision 179665) +++ Makefile.in (working copy) @@ -455,7 +455,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../inclu LTO_SYMTAB_H = $(srcdir)/../include/lto-symtab.h # Default native SYSTEM_HEADER_DIR, to be overridden by targets. -NATIVE_SYSTEM_HEADER_DIR = /usr/include +NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@ # Default cross SYSTEM_HEADER_DIR, to be overridden by targets. CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ Index: doc/install.texi === --- doc/install.texi (revision 179665) +++ doc/install.texi (working copy) @@ -903,6 +903,18 @@ ideas of what it is for. People use it install part of GCC@. Perhaps they make this assumption because installing GCC creates the directory. +@item --with-native-system-header-dir=@var{dirname} +Specifies that @var{dirname} is the directory that contains native system +header files, rather than @file{/usr/include}. This option is most useful +if you are creating a compiler that should be isolated from the system +as much as possible. It is most commonly used with the +@option{--with-sysroot} option and will cause GCC to search +@var{dirname} inside the system root specified by that option. + +Please note that for certain targets, such as DJGPP, this value is +ignored. If the target specifies a default value for native system +header files then this option is ignored. + @item --enable-shared[=@var{package}[,@dots{}]] Build shared versions of libraries, if shared libraries are supported on the target platform. Unlike GCC 2.95.x and earlier, shared libraries @@ -1736,6 +1748,10 @@ target libraries (which runs on the buil installed with @code{make install}; it does not affect the compiler which is used to build GCC itself. +If you specify the @option{--with-native-system-header-dir=@var{dirname}} +option then the compiler will search that directory within @var{dirname} for +native system headers rather than the default
Re: PATCH RFA: New configure option --with-native-system-header-dir
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.) -- Joseph S. Myers jos...@codesourcery.com