From e90b45fee71a78e072eabb296b36e1f1ff7d6a67 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Thu, 15 Mar 2007 08:12:25 +0000 Subject: Merged Rev. 122210-122935 from the trunk. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/fortran-experiments@122946 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-incpath.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'gcc/c-incpath.c') 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 -- cgit v1.2.3