aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-incpath.c
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos@codesourcery.com>2006-11-20 17:15:27 +0000
committerCarlos O'Donell <carlos@gcc.gnu.org>2006-11-20 17:15:27 +0000
commit76642aabbd91c89cfae1c3ba2fa61785b6fbabd6 (patch)
tree97ba2bb27388441e1c8a03a879e691c010485917 /gcc/c-incpath.c
parent9d691ba7501c741571edc1618c434316b1eb0170 (diff)
downloadgcc-76642aabbd91c89cfae1c3ba2fa61785b6fbabd6.zip
gcc-76642aabbd91c89cfae1c3ba2fa61785b6fbabd6.tar.gz
gcc-76642aabbd91c89cfae1c3ba2fa61785b6fbabd6.tar.bz2
cppdefault.c: Define cpp_PREFIX, cpp_PREFIX_len, and gcc_exec_prefix.
gcc/ 2006-11-20 Carlos O'Donell <carlos@codesourcery.com> Mark Mitchell <mark@codesourcery.com> * cppdefault.c: Define cpp_PREFIX, cpp_PREFIX_len, and gcc_exec_prefix. (cpp_relocated): New function. * cppdefault.h: Declare cpp_PREFIX, cpp_PREFIX_len, gcc_exec_prefix and cpp_relocated. * Makefile.in (PREPROCESSOR_DEFINES): Add -DPREFIX option. * c-incpath.c (add_standard_paths): Call cpp_relocated. If relocated, replace configured prefix with gcc_exec_prefix. Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r119017
Diffstat (limited to 'gcc/c-incpath.c')
-rw-r--r--gcc/c-incpath.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/c-incpath.c b/gcc/c-incpath.c
index 0e534dd..2c5ac6d 100644
--- a/gcc/c-incpath.c
+++ b/gcc/c-incpath.c
@@ -127,6 +127,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
const char *imultilib, int cxx_stdinc)
{
const struct default_include *p;
+ int relocated = cpp_relocated();
size_t len;
if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0)
@@ -163,6 +164,17 @@ add_standard_paths (const char *sysroot, const char *iprefix,
/* Should this directory start with the sysroot? */
if (sysroot && p->add_sysroot)
str = concat (sysroot, p->fname, NULL);
+ else if (!p->add_sysroot && relocated)
+ {
+ /* If the compiler is relocated, and this is a configured
+ prefix relative path, then we use gcc_exec_prefix instead
+ of the configured prefix. */
+ gcc_assert (strncmp (p->fname, cpp_PREFIX,
+ cpp_PREFIX_len) == 0);
+ str = concat (gcc_exec_prefix, p->fname
+ + cpp_PREFIX_len, NULL);
+ str = update_path (str, p->component);
+ }
else
str = update_path (p->fname, p->component);