diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-12 15:59:06 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-12 15:59:06 +0000 |
commit | a8bb4f69a81ee6ab68e7883a86c824781bbc5eb3 (patch) | |
tree | b1c057375072b5526bd29466adc19cb4108c1305 /gcc/c-incpath.c | |
parent | 381ab469096927f9ec73b2b3ca7a92eef7f3330c (diff) | |
download | gcc-a8bb4f69a81ee6ab68e7883a86c824781bbc5eb3.tar.gz |
* cppdefault.c (cpp_EXEC_PREFIX): New variable.
* cppdefault.h (cpp_PREFIX): Document.
(cpp_PREFIX_len): Likewise.
(cpp_EXEC_PREFIX): New variable.
* Makefile.in (PREPROCESSOR_DEFINES): Add STANDARD_EXEC_PREFIX.
* c-incpath.c (add_standard_paths): Correct logic for relocating
paths within prefix.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122843 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-incpath.c')
-rw-r--r-- | gcc/c-incpath.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/gcc/c-incpath.c b/gcc/c-incpath.c index fe863d52b6e..3a9585bd26d 100644 --- a/gcc/c-incpath.c +++ b/gcc/c-incpath.c @@ -167,11 +167,26 @@ add_standard_paths (const char *sysroot, const char *iprefix, else if (!p->add_sysroot && relocated && strncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len) == 0) { - /* If the compiler is relocated, and this is a configured - prefix relative path, then we use gcc_exec_prefix instead - of the configured prefix. */ - str = concat (gcc_exec_prefix, p->fname - + cpp_PREFIX_len, NULL); + static const char *relocated_prefix; + /* If this path starts with the configure-time prefix, + but the compiler has been relocated, replace it + with the run-time prefix. The run-time exec prefix + is GCC_EXEC_PREFIX. Compute the path from there back + to the toplevel prefix. */ + if (!relocated_prefix) + { + char *dummy; + /* Make relative prefix expects the first argument + to be a program, not a directory. */ + dummy = concat (gcc_exec_prefix, "dummy", NULL); + relocated_prefix + = make_relative_prefix (dummy, + cpp_EXEC_PREFIX, + cpp_PREFIX); + } + str = concat (relocated_prefix, + p->fname + cpp_PREFIX_len, + NULL); str = update_path (str, p->component); } else |