diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5ecf066fbf4..79a0f905abc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,53 @@ +2011-10-17 Simon Baldwin + Ian Lance Taylor + + * 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. + 2011-10-17 Richard Henderson * config/sparc/sparc.md: Use register_or_zero_operand where rJ diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 6e3fecd40af..a26b63bf263 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -455,7 +455,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h 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@ @@ -4075,6 +4075,7 @@ PREPROCESSOR_DEFINES = \ -DLOCAL_INCLUDE_DIR=\"$(local_includedir)\" \ -DCROSS_INCLUDE_DIR=\"$(CROSS_SYSTEM_HEADER_DIR)\" \ -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \ + -DNATIVE_SYSTEM_HEADER_DIR=\"$(NATIVE_SYSTEM_HEADER_DIR)\" \ -DPREFIX=\"$(prefix)/\" \ -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \ @TARGET_SYSTEM_ROOT_DEFINE@ diff --git a/gcc/config.gcc b/gcc/config.gcc index 8099ed790b3..018e4218471 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -186,6 +186,13 @@ # configure_default_options # Set to an initializer for configure_default_options # in configargs.h, based on --with-cpu et cetera. +# +# native_system_header_dir +# Where system header files are found for this +# target. This defaults to /usr/include. If +# the --with-sysroot configure option or the +# --sysroot command line option is used this +# will be relative to the sysroot. # The following variables are used in each case-construct to build up the # outgoing variables: @@ -238,6 +245,7 @@ default_gnu_indirect_function=no target_gtfiles= need_64bit_hwint= need_64bit_isa= +native_system_header_dir=/usr/include # Don't carry these over build->host->target. Please. xm_file= @@ -596,7 +604,8 @@ case ${target} in *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-kopensolaris*-gnu) :;; *-*-gnu*) - tmake_file="$tmake_file t-gnu";; + native_system_header_dir=/include + ;; esac # glibc / uclibc / bionic switch. # uclibc and bionic aren't usable for GNU/Hurd and neither for GNU/k*BSD. @@ -1370,7 +1379,7 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu) i[34567]86-pc-msdosdjgpp*) xm_file=i386/xm-djgpp.h tm_file="dbxcoff.h ${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/djgpp.h i386/djgpp-stdint.h" - tmake_file="${tmake_file} i386/t-djgpp" + native_system_header_dir=/dev/env/DJDIR/include extra_options="${extra_options} i386/djgpp.opt" gnu_ld=yes gas=yes @@ -1540,6 +1549,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*) tmake_file="${tmake_file} i386/t-mingw32" ;; esac + native_system_header_dir=/mingw/include target_gtfiles="\$(srcdir)/config/i386/winnt.c" extra_options="${extra_options} i386/cygming.opt i386/mingw.opt" case ${target} in @@ -2563,6 +2573,7 @@ sparc64-*-openbsd*) spu-*-elf*) tm_file="dbxelf.h elfos.h spu/spu-elf.h spu/spu.h newlib-stdint.h" tmake_file="spu/t-spu-elf" + native_system_header_dir=/include extra_headers="spu_intrinsics.h spu_internals.h vmx2spu.h spu_mfcio.h vec_types.h spu_cache.h" extra_modes=spu/spu-modes.def c_target_objs="${c_target_objs} spu-c.o" diff --git a/gcc/config/gnu.h b/gcc/config/gnu.h index 8b1d079ee89..dddbcbf5a49 100644 --- a/gcc/config/gnu.h +++ b/gcc/config/gnu.h @@ -28,10 +28,6 @@ along with GCC. If not, see . #undef LIB_SPEC #define LIB_SPEC "%{pthread:-lpthread} %{pg|p|profile:-lc_p;:-lc}" -/* Standard include directory. In GNU, "/usr" is a four-letter word. */ -#undef STANDARD_INCLUDE_DIR -#define STANDARD_INCLUDE_DIR "/include" - #undef GNU_USER_TARGET_OS_CPP_BUILTINS #define GNU_USER_TARGET_OS_CPP_BUILTINS() \ do { \ diff --git a/gcc/config/i386/djgpp.h b/gcc/config/i386/djgpp.h index d1109a2ff3f..c770219657c 100644 --- a/gcc/config/i386/djgpp.h +++ b/gcc/config/i386/djgpp.h @@ -48,10 +48,6 @@ along with GCC; see the file COPYING3. If not see /* We override default /usr or /usr/local part with /dev/env/DJDIR which */ /* points to actual DJGPP installation directory. */ -/* Standard include directory */ -#undef STANDARD_INCLUDE_DIR -#define STANDARD_INCLUDE_DIR "/dev/env/DJDIR/include/" - /* Search for as.exe and ld.exe in DJGPP's binary directory. */ #undef MD_EXEC_PREFIX #define MD_EXEC_PREFIX "/dev/env/DJDIR/bin/" diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h index 371cb72248b..d9f10c834af 100644 --- a/gcc/config/i386/mingw32.h +++ b/gcc/config/i386/mingw32.h @@ -78,12 +78,8 @@ along with GCC; see the file COPYING3. If not see #define SUB_LINK_ENTRY SUB_LINK_ENTRY32 #endif -/* Override the standard choice of /usr/include as the default prefix - to try when searching for header files. */ -#undef STANDARD_INCLUDE_DIR -#define STANDARD_INCLUDE_DIR "/mingw/include" -#undef STANDARD_INCLUDE_COMPONENT -#define STANDARD_INCLUDE_COMPONENT "MINGW" +#undef NATIVE_SYSTEM_HEADER_COMPONENT +#define NATIVE_SYSTEM_HEADER_COMPONENT "MINGW" #undef CPP_SPEC #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} " \ @@ -235,4 +231,3 @@ do { \ /* We should find a way to not have to update this manually. */ #define LIBGCJ_SONAME "libgcj" /*LIBGCC_EH_EXTN*/ "-12.dll" - diff --git a/gcc/config/i386/t-djgpp b/gcc/config/i386/t-djgpp deleted file mode 100644 index 7b54b7ba7aa..00000000000 --- a/gcc/config/i386/t-djgpp +++ /dev/null @@ -1,2 +0,0 @@ -# Location of DJGPP's header directory. -NATIVE_SYSTEM_HEADER_DIR=$(DJDIR)/include diff --git a/gcc/config/i386/t-mingw-w32 b/gcc/config/i386/t-mingw-w32 index a1421801664..83cee71f1c1 100644 --- a/gcc/config/i386/t-mingw-w32 +++ b/gcc/config/i386/t-mingw-w32 @@ -1,6 +1,3 @@ -# Match SYSTEM_INCLUDE_DIR -NATIVE_SYSTEM_HEADER_DIR = /mingw/include - MULTILIB_OPTIONS = m64/m32 MULTILIB_DIRNAMES = 64 32 MULTILIB_OSDIRNAMES = ../lib64 ../lib diff --git a/gcc/config/i386/t-mingw-w64 b/gcc/config/i386/t-mingw-w64 index dbe2d00a2e7..041a02f1018 100644 --- a/gcc/config/i386/t-mingw-w64 +++ b/gcc/config/i386/t-mingw-w64 @@ -1,6 +1,3 @@ -# Match SYSTEM_INCLUDE_DIR -NATIVE_SYSTEM_HEADER_DIR = /mingw/include - MULTILIB_OPTIONS = m64/m32 MULTILIB_DIRNAMES = 64 32 MULTILIB_OSDIRNAMES = ../lib ../lib32 diff --git a/gcc/config/i386/t-mingw32 b/gcc/config/i386/t-mingw32 index a8235242a50..bfdef6723ce 100644 --- a/gcc/config/i386/t-mingw32 +++ b/gcc/config/i386/t-mingw32 @@ -1,5 +1,2 @@ -# Match SYSTEM_INCLUDE_DIR -NATIVE_SYSTEM_HEADER_DIR = /mingw/include - # MinGW-specific parts of LIB_SPEC SHLIB_LC = -lmingwthrd -lmingw32 -lmingwex -lmoldname -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 diff --git a/gcc/config/openbsd.h b/gcc/config/openbsd.h index aa279ed4738..fad29154cef 100644 --- a/gcc/config/openbsd.h +++ b/gcc/config/openbsd.h @@ -1,5 +1,5 @@ /* Base configuration file for all OpenBSD targets. - Copyright (C) 1999, 2000, 2004, 2005, 2007, 2009, 2010 + Copyright (C) 1999, 2000, 2004, 2005, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -59,7 +59,7 @@ along with GCC; see the file COPYING3. If not see { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1 }, \ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1 }, \ - { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0 }, \ + { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0 }, \ { 0, 0, 0, 0 } \ } diff --git a/gcc/config/spu/spu-elf.h b/gcc/config/spu/spu-elf.h index 818c391f994..146bcb21052 100644 --- a/gcc/config/spu/spu-elf.h +++ b/gcc/config/spu/spu-elf.h @@ -35,10 +35,6 @@ #undef STANDARD_STARTFILE_PREFIX_2 #define STANDARD_STARTFILE_PREFIX_2 "" -/* Use "/include" instead of "/usr/include". */ -#undef STANDARD_INCLUDE_DIR -#define STANDARD_INCLUDE_DIR "/include" - /* We do not provide any "/usr/local/include" directory on SPU. */ #undef LOCAL_INCLUDE_DIR @@ -77,4 +73,3 @@ mcache-size=16 :-lgcc_cache16k; \ mcache-size=8 :-lgcc_cache8k; \ :-lgcc_cache64k}" - diff --git a/gcc/config/spu/t-spu-elf b/gcc/config/spu/t-spu-elf index 3f9510112f7..b48106efed2 100644 --- a/gcc/config/spu/t-spu-elf +++ b/gcc/config/spu/t-spu-elf @@ -15,10 +15,6 @@ # along with GCC; see the file COPYING3. If not see # . -# Define system directory to match STANDARD_INCLUDE_DIR in spu-elf.h, -# allowing combined SPU/PPU sysroot builds. -NATIVE_SYSTEM_HEADER_DIR = /include - # Suppress building libgcc1.a LIBGCC1 = CROSS_LIBGCC1 = diff --git a/gcc/config/t-gnu b/gcc/config/t-gnu deleted file mode 100644 index 7be5d00a718..00000000000 --- a/gcc/config/t-gnu +++ /dev/null @@ -1,2 +0,0 @@ -# In GNU, "/usr" is a four-letter word. -NATIVE_SYSTEM_HEADER_DIR = /include diff --git a/gcc/config/vms/xm-vms.h b/gcc/config/vms/xm-vms.h index 7907f9263cf..816935b5062 100644 --- a/gcc/config/vms/xm-vms.h +++ b/gcc/config/vms/xm-vms.h @@ -1,6 +1,6 @@ /* Configuration for GCC for hosting on VMS using a Unix style C library. - Copyright (C) 1996, 1997, 2001, 2004, 2007, 2009 + Copyright (C) 1996, 1997, 2001, 2004, 2007, 2009, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -55,4 +55,3 @@ do \ #define STANDARD_EXEC_PREFIX "/gnu/libexec/gcc/" #define STANDARD_STARTFILE_PREFIX "/gnu/lib/" -#define STANDARD_INCLUDE_DIR "/gnu/include" diff --git a/gcc/configure b/gcc/configure index 7bd1d5db2a8..32542dd455d 100755 --- a/gcc/configure +++ b/gcc/configure @@ -729,6 +729,7 @@ USE_NLS extra_opt_files extra_modes_file gthread_flags +NATIVE_SYSTEM_HEADER_DIR objext manext LIBICONV_DEP @@ -886,6 +887,7 @@ enable_tls enable_objc_gc with_dwarf2 enable_shared +with_native_system_header_dir with_build_sysroot with_sysroot with_specs @@ -1651,6 +1653,9 @@ Optional Packages: --with-as arrange to use the specified as (full pathname) --with-stabs arrange to use stabs instead of host debug format --with-dwarf2 force the default debug format to be DWARF 2 + --with-native-system-header-dir=dir + use dir as the directory to look for standard + system header files in. Defaults to /usr/include. --with-build-sysroot=sysroot use sysroot as the system root during the build --with-sysroot[=DIR] search for usr/lib, usr/include, et al, within DIR @@ -7152,6 +7157,22 @@ fi +# Check whether --with-native-system-header-dir was given. +if test "${with_native_system_header_dir+set}" = set; then : + withval=$with_native_system_header_dir; + case ${with_native_system_header_dir} in + yes|no) as_fn_error "bad value ${withval} given for --with-native-system-header-dir" "$LINENO" 5 ;; + /* | [A-Za-z]:[\\/]*) ;; + *) as_fn_error "--with-native-system-header-dir argument ${withval} must be an absolute directory" "$LINENO" 5 ;; + esac + configured_native_system_header_dir="${withval}" + +else + configured_native_system_header_dir= +fi + + + # Check whether --with-build-sysroot was given. if test "${with_build_sysroot+set}" = set; then : withval=$with_build_sysroot; if test x"$withval" != x ; then @@ -11145,6 +11166,12 @@ if test "$host_xm_file" != "$build_xm_file"; then fi fi +if test -n "$configured_native_system_header_dir"; then + native_system_header_dir=$configured_native_system_header_dir +fi +NATIVE_SYSTEM_HEADER_DIR="$native_system_header_dir" + + case ${host} in powerpc*-*-darwin*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mcontext_t fields have underscores" >&5 @@ -17921,7 +17948,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17924 "configure" +#line 17951 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -18027,7 +18054,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18030 "configure" +#line 18057 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -26409,14 +26436,14 @@ if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then 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. diff --git a/gcc/configure.ac b/gcc/configure.ac index 353746f4a81..d19ca077b2e 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -725,6 +725,19 @@ AC_ARG_ENABLE(shared, ], [enable_shared=yes]) AC_SUBST(enable_shared) +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 --with-native-system-header-dir]) ;; + /* | [[A-Za-z]]:[[\\/]]*) ;; + *) AC_MSG_ERROR([--with-native-system-header-dir argument ${withval} must be an absolute directory]) ;; + esac + configured_native_system_header_dir="${withval}" +], [configured_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])], @@ -1331,6 +1344,12 @@ if test "$host_xm_file" != "$build_xm_file"; then fi fi +if test -n "$configured_native_system_header_dir"; then + native_system_header_dir=$configured_native_system_header_dir +fi +NATIVE_SYSTEM_HEADER_DIR="$native_system_header_dir" +AC_SUBST(NATIVE_SYSTEM_HEADER_DIR) + case ${host} in powerpc*-*-darwin*) AC_CACHE_CHECK([whether mcontext_t fields have underscores], @@ -4517,14 +4536,14 @@ if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then 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. diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c index 9b1495feb94..fabf314a024 100644 --- a/gcc/cppdefault.c +++ b/gcc/cppdefault.c @@ -1,6 +1,7 @@ /* CPP Library. Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2003, 2004, 2006, 2007, 2010 Free Software Foundation, Inc. + 1999, 2000, 2003, 2004, 2006, 2007, 2010, 2011 + Free Software Foundation, Inc. Contributed by Per Bothner, 1994-95. Based on CCCP program by Paul Rubin, June 1986 Adapted to ANSI C, Richard Stallman, Jan 1987 @@ -25,18 +26,12 @@ #include "tm.h" #include "cppdefault.h" -#ifndef STANDARD_INCLUDE_DIR -#define STANDARD_INCLUDE_DIR "/usr/include" -#endif - -#ifndef STANDARD_INCLUDE_COMPONENT -#define STANDARD_INCLUDE_COMPONENT 0 +#ifndef NATIVE_SYSTEM_HEADER_COMPONENT +#define NATIVE_SYSTEM_HEADER_COMPONENT 0 #endif #if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT) # undef LOCAL_INCLUDE_DIR -# undef SYSTEM_INCLUDE_DIR -# undef STANDARD_INCLUDE_DIR #else # undef CROSS_INCLUDE_DIR #endif @@ -89,14 +84,8 @@ const struct default_include cpp_include_defaults[] /* Another place the target system's headers might be. */ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 }, #endif -#ifdef SYSTEM_INCLUDE_DIR - /* Some systems have an extra dir of include files. */ - { SYSTEM_INCLUDE_DIR, 0, 0, 0, 1, 0 }, -#endif -#ifdef STANDARD_INCLUDE_DIR /* /usr/include comes dead last. */ - { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0, 1, 0 }, -#endif + { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 }, { 0, 0, 0, 0, 0, 0 } }; #endif /* no INCLUDE_DEFAULTS */ @@ -136,4 +125,3 @@ cpp_relocated (void) return relocated; } - diff --git a/gcc/doc/fragments.texi b/gcc/doc/fragments.texi index 28edae98e67..31674f9a5d0 100644 --- a/gcc/doc/fragments.texi +++ b/gcc/doc/fragments.texi @@ -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{MULTILIB_EXTRA_OPTS} to be the list 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 diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 83a7361386f..730f82baff8 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -903,6 +903,14 @@ ideas of what it is for. People use it as if it specified where to 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. + @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 +1744,10 @@ target libraries (which runs on the build system) and the compiler newly 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 @file{/usr/include}. + @item --with-build-sysroot @itemx --with-build-sysroot=@var{dir} Tells GCC to consider @var{dir} as the system root (see @@ -1750,6 +1762,10 @@ This option affects the system root for the compiler used to build target libraries (which runs on the build system); 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 @file{/usr/include}. + @item --with-headers @itemx --with-headers=@var{dir} Deprecated in favor of @option{--with-sysroot}. diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 90cef1c5f38..f9e4260b238 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -470,33 +470,15 @@ initialize the necessary environment variables. 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. @code{LOCAL_INCLUDE_DIR} -comes before @code{SYSTEM_INCLUDE_DIR} in the search order. +comes before @code{NATIVE_SYSTEM_HEADER_DIR} (set in +@file{config.gcc}, normally @file{/usr/include}) in the search order. Cross compilers do not search either @file{/usr/local/include} or its replacement. @end defmac -@defmac SYSTEM_INCLUDE_DIR -Define this macro as a C string constant if you wish to specify a -system-specific directory to search for header files before the standard -directory. @code{SYSTEM_INCLUDE_DIR} comes before -@code{STANDARD_INCLUDE_DIR} in the search order. - -Cross compilers do not use this macro and do not search the directory -specified. -@end defmac - -@defmac STANDARD_INCLUDE_DIR -Define this macro as a C string constant if you wish to override the -standard choice of @file{/usr/include} as the default prefix to -try when searching for header files. - -Cross compilers ignore this macro and do not search either -@file{/usr/include} or its replacement. -@end defmac - -@defmac STANDARD_INCLUDE_COMPONENT -The ``component'' corresponding to @code{STANDARD_INCLUDE_DIR}. +@defmac NATIVE_SYSTEM_HEADER_COMPONENT +The ``component'' corresponding to @code{NATIVE_SYSTEM_HEADER_DIR}. See @code{INCLUDE_DEFAULTS}, below, for the description of components. If you do not define this macro, no component is used. @end defmac @@ -505,8 +487,8 @@ If you do not define this macro, no component is used. Define this macro if you wish to override the entire default search path for include files. For a native compiler, the default search path usually consists of @code{GCC_INCLUDE_DIR}, @code{LOCAL_INCLUDE_DIR}, -@code{SYSTEM_INCLUDE_DIR}, @code{GPLUSPLUS_INCLUDE_DIR}, and -@code{STANDARD_INCLUDE_DIR}. In addition, @code{GPLUSPLUS_INCLUDE_DIR} +@code{GPLUSPLUS_INCLUDE_DIR}, and +@code{NATIVE_SYSTEM_HEADER_DIR}. In addition, @code{GPLUSPLUS_INCLUDE_DIR} and @code{GCC_INCLUDE_DIR} are defined automatically by @file{Makefile}, and specify private search areas for GCC@. The directory @code{GPLUSPLUS_INCLUDE_DIR} is used only for C++ programs. diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 187122eea81..e7e25888e37 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -468,33 +468,15 @@ initialize the necessary environment variables. 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. @code{LOCAL_INCLUDE_DIR} -comes before @code{SYSTEM_INCLUDE_DIR} in the search order. +comes before @code{NATIVE_SYSTEM_HEADER_DIR} (set in +@file{config.gcc}, normally @file{/usr/include}) in the search order. Cross compilers do not search either @file{/usr/local/include} or its replacement. @end defmac -@defmac SYSTEM_INCLUDE_DIR -Define this macro as a C string constant if you wish to specify a -system-specific directory to search for header files before the standard -directory. @code{SYSTEM_INCLUDE_DIR} comes before -@code{STANDARD_INCLUDE_DIR} in the search order. - -Cross compilers do not use this macro and do not search the directory -specified. -@end defmac - -@defmac STANDARD_INCLUDE_DIR -Define this macro as a C string constant if you wish to override the -standard choice of @file{/usr/include} as the default prefix to -try when searching for header files. - -Cross compilers ignore this macro and do not search either -@file{/usr/include} or its replacement. -@end defmac - -@defmac STANDARD_INCLUDE_COMPONENT -The ``component'' corresponding to @code{STANDARD_INCLUDE_DIR}. +@defmac NATIVE_SYSTEM_HEADER_COMPONENT +The ``component'' corresponding to @code{NATIVE_SYSTEM_HEADER_DIR}. See @code{INCLUDE_DEFAULTS}, below, for the description of components. If you do not define this macro, no component is used. @end defmac @@ -503,8 +485,8 @@ If you do not define this macro, no component is used. Define this macro if you wish to override the entire default search path for include files. For a native compiler, the default search path usually consists of @code{GCC_INCLUDE_DIR}, @code{LOCAL_INCLUDE_DIR}, -@code{SYSTEM_INCLUDE_DIR}, @code{GPLUSPLUS_INCLUDE_DIR}, and -@code{STANDARD_INCLUDE_DIR}. In addition, @code{GPLUSPLUS_INCLUDE_DIR} +@code{GPLUSPLUS_INCLUDE_DIR}, and +@code{NATIVE_SYSTEM_HEADER_DIR}. In addition, @code{GPLUSPLUS_INCLUDE_DIR} and @code{GCC_INCLUDE_DIR} are defined automatically by @file{Makefile}, and specify private search areas for GCC@. The directory @code{GPLUSPLUS_INCLUDE_DIR} is used only for C++ programs. diff --git a/gcc/system.h b/gcc/system.h index e86f7ba7a4f..7c7d07ea3ee 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -868,7 +868,8 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; FUNCTION_INCOMING_ARG IRA_COVER_CLASSES TARGET_VERSION \ MACHINE_TYPE TARGET_HAS_TARGETCM ASM_OUTPUT_BSS \ SETJMP_VIA_SAVE_AREA FORBIDDEN_INC_DEC_CLASSES \ - PREFERRED_OUTPUT_RELOAD_CLASS + PREFERRED_OUTPUT_RELOAD_CLASS SYSTEM_INCLUDE_DIR \ + STANDARD_INCLUDE_DIR STANDARD_INCLUDE_COMPONENT /* Hooks that are no longer used. */ #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \