X-Git-Url: https://git.gag.com/?p=fw%2Fsdcc;a=blobdiff_plain;f=support%2Fcpp%2Fcppdefault.c;h=e869975674397b8669c27c6c67ff66ec82f809ed;hp=283742bff9e8b839f5f7425ab4d954bdb1b91ee1;hb=15bebb5458d3dfc30d8dd147c0cc74e8a766f7d0;hpb=124d1fe4fa35a4c642b073bde8f45004326d1192 diff --git a/support/cpp/cppdefault.c b/support/cpp/cppdefault.c index 283742bf..e8699756 100644 --- a/support/cpp/cppdefault.c +++ b/support/cpp/cppdefault.c @@ -1,23 +1,23 @@ /* CPP Library. Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2003, 2004, 2006 Free Software Foundation, Inc. + 1999, 2000, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. Contributed by Per Bothner, 1994-95. Based on CCCP program by Paul Rubin, June 1986 Adapted to ANSI C, Richard Stallman, Jan 1987 -This program is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING3. If not see + . */ #include "config.h" #include "system.h" @@ -31,7 +31,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #define STANDARD_INCLUDE_COMPONENT 0 #endif -#if defined (CROSS_COMPILE) && !defined (TARGET_SYSTEM_ROOT) +#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT) # undef LOCAL_INCLUDE_DIR # undef SYSTEM_INCLUDE_DIR # undef STANDARD_INCLUDE_DIR @@ -64,9 +64,21 @@ const struct default_include cpp_include_defaults[] { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 }, #endif #ifdef GCC_INCLUDE_DIR - /* This is the dir for fixincludes and for gcc's private headers. */ + /* This is the dir for gcc's private headers. */ { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 }, #endif +#ifdef FIXED_INCLUDE_DIR + /* This is the dir for fixincludes. */ + { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0, + /* A multilib suffix needs adding if different multilibs use + different headers. */ +#ifdef SYSROOT_HEADERS_SUFFIX_SPEC + 1 +#else + 0 +#endif + }, +#endif #ifdef CROSS_INCLUDE_DIR /* One place the target system's headers might be. */ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0 }, @@ -94,3 +106,33 @@ 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 + +#if 0 +/* The configured prefix. */ +const char cpp_PREFIX[] = PREFIX; +const size_t cpp_PREFIX_len = sizeof PREFIX - 1; +const char cpp_EXEC_PREFIX[] = STANDARD_EXEC_PREFIX; + +/* 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; +} +#endif