aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-incpath.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2007-03-12 15:59:06 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2007-03-12 15:59:06 +0000
commit6d4817e3740f021599e620067452c223f7b3b397 (patch)
treeb1c057375072b5526bd29466adc19cb4108c1305 /gcc/c-incpath.c
parent91b0b94a042721a2a8dff04f0a177a37c4f08cad (diff)
downloadgcc-6d4817e3740f021599e620067452c223f7b3b397.zip
gcc-6d4817e3740f021599e620067452c223f7b3b397.tar.gz
gcc-6d4817e3740f021599e620067452c223f7b3b397.tar.bz2
cppdefault.c (cpp_EXEC_PREFIX): New variable.
* 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. From-SVN: r122843
Diffstat (limited to 'gcc/c-incpath.c')
-rw-r--r--gcc/c-incpath.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/gcc/c-incpath.c b/gcc/c-incpath.c
index fe863d5..3a9585b 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