summaryrefslogtreecommitdiff
path: root/gcc/cppdefault.c
diff options
context:
space:
mode:
authorcarlos <carlos@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-20 17:15:27 +0000
committercarlos <carlos@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-20 17:15:27 +0000
commite9ed62b675eba4cf4adbb99eada85016efd9d8a9 (patch)
tree97ba2bb27388441e1c8a03a879e691c010485917 /gcc/cppdefault.c
parent88eef51c4795352e157731459fcf2256d920b02e (diff)
downloadgcc-e9ed62b675eba4cf4adbb99eada85016efd9d8a9.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119017 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cppdefault.c')
-rw-r--r--gcc/cppdefault.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c
index d040558b54c..c72cb390aba 100644
--- a/gcc/cppdefault.c
+++ b/gcc/cppdefault.c
@@ -96,3 +96,31 @@ const size_t cpp_GCC_INCLUDE_DIR_len = sizeof GCC_INCLUDE_DIR - 8;
const char cpp_GCC_INCLUDE_DIR[] = "";
const size_t cpp_GCC_INCLUDE_DIR_len = 0;
#endif
+
+/* The configured prefix. */
+const char cpp_PREFIX[] = PREFIX;
+const size_t cpp_PREFIX_len = sizeof PREFIX - 1;
+
+/* This value is set by cpp_relocated at runtime */
+const char *gcc_exec_prefix;
+
+/* Return true if the toolchain is relocated. */
+bool
+cpp_relocated (void)
+{
+ static int relocated = -1;
+
+ /* A relocated toolchain ignores standard include directories. */
+ if (relocated == -1)
+ {
+ /* Check if the toolchain was relocated? */
+ GET_ENVIRONMENT (gcc_exec_prefix, "GCC_EXEC_PREFIX");
+ if (gcc_exec_prefix)
+ relocated = 1;
+ else
+ relocated = 0;
+ }
+
+ return relocated;
+}
+