summaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@mvista.com>2003-02-13 17:23:56 +0000
committerDaniel Jacobowitz <drow@gcc.gnu.org>2003-02-13 17:23:56 +0000
commit047d636f544fad604aec883b45012d59369839fe (patch)
tree3d7379a3ec405d4e0f84ede65961991b09195727 /gcc/gcc.c
parent902cf50c93298503d3966675cd01841b97c909e8 (diff)
downloadgcc-047d636f544fad604aec883b45012d59369839fe.tar.gz
Makefile.in (PREPROCESSOR_DEFINES): Add @TARGET_SYSTEM_ROOT_DEFINE@.
* Makefile.in (PREPROCESSOR_DEFINES): Add @TARGET_SYSTEM_ROOT_DEFINE@. * configure.in (PREFIX_INCLUDE_DIR): Don't define if $with_sysroot is specified or if building a cross compiler. (TARGET_SYSTEM_ROOT_DEFINE): Add TARGET_SYSTEM_ROOT_RELOCATABLE if the sysroot is under $exec_prefix. * configure: Regenerated. * cppdefault.h: Use native include paths if TARGET_SYSTEM_ROOT is defined. (struct default_include): Add add_sysroot field. (cpp_SYSROOT): Declare. * cppdefault.c (cpp_include_defaults): Fill in add_sysroot field. (cpp_SYSROOT): New variable. * cppinit.c (cpp_create_reader): Initialize CPP_OPTION (pfile, sysroot). (init_standard_includes): Handle add_sysroot. Do not add unrelocated copies of relocated directories. (COMMAND_LINE_OPTIONS): Add -isysroot. (cpp_handle_option): Handle -isysroot. * cpplib.h (struct cpp_options): Add sysroot member. * gcc.c (The Specs Language): Update description of %I. (target_system_root_changed): New variable. (process_command): Conditionalize make_relative_prefix call on !VMS and TARGET_SYSTEM_ROOT_RELOCATABLE. Set target_system_root_changed. (do_spec_1): Add -isysroot to %I. * doc/invoke.texi (Spec Files): Update description of %I. * doc/install.texi (--with-sysroot): Update comment about relocation. From-SVN: r62853
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 3a36d3517b1..b7aac2db625 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -204,6 +204,10 @@ static int report_times;
static const char *target_system_root = TARGET_SYSTEM_ROOT;
+/* Nonzero means pass the updated target_system_root to the compiler. */
+
+static int target_system_root_changed;
+
/* Nonzero means write "temp" files in source directory
and use the source file's name in them, and don't delete them. */
@@ -445,7 +449,9 @@ or with constant text in a single argument.
%P like %p, but puts `__' before and after the name of each macro.
(Except macros that already have __.)
This is for ANSI C.
- %I Substitute a -iprefix option made from GCC_EXEC_PREFIX.
+ %I Substitute any of -iprefix (made from GCC_EXEC_PREFIX), -isysroot
+ (made from TARGET_SYSTEM_ROOT), and -isystem (made from COMPILER_PATH
+ and -B options) as necessary.
%s current argument is the name of a library or startup file of some sort.
Search for that file in a standard list of directories
and substitute the full name found.
@@ -3830,14 +3836,23 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
concat (tooldir_prefix, "lib", dir_separator_str, NULL),
"BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 1);
+#if defined(TARGET_SYSTEM_ROOT_RELOCATABLE) && !defined(VMS)
+ /* If the normal TARGET_SYSTEM_ROOT is inside of $exec_prefix,
+ then consider it to relocate with the rest of the GCC installation
+ if GCC_EXEC_PREFIX is set.
+ ``make_relative_prefix'' is not compiled for VMS, so don't call it. */
if (target_system_root && gcc_exec_prefix)
{
char *tmp_prefix = make_relative_prefix (argv[0],
standard_bindir_prefix,
target_system_root);
if (tmp_prefix && access_check (tmp_prefix, F_OK) == 0)
- target_system_root = tmp_prefix;
+ {
+ target_system_root = tmp_prefix;
+ target_system_root_changed = 1;
+ }
}
+#endif
/* More prefixes are enabled in main, after we read the specs file
and determine whether this is cross-compilation or not. */
@@ -4746,6 +4761,15 @@ do_spec_1 (spec, inswitch, soft_matched_part)
do_spec_1 (" ", 0, NULL);
}
+ if (target_system_root_changed)
+ {
+ do_spec_1 ("-isysroot", 1, NULL);
+ /* Make this a separate argument. */
+ do_spec_1 (" ", 0, NULL);
+ do_spec_1 (target_system_root, 1, NULL);
+ do_spec_1 (" ", 0, NULL);
+ }
+
for (; pl; pl = pl->next)
{
do_spec_1 ("-isystem", 1, NULL);