2 Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2003, 2004, 2006 Free Software Foundation, Inc.
4 Contributed by Per Bothner, 1994-95.
5 Based on CCCP program by Paul Rubin, June 1986
6 Adapted to ANSI C, Richard Stallman, Jan 1987
8 This program is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 2, or (at your option) any
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
24 #include "coretypes.h"
26 #include "cppdefault.h"
28 #ifndef STANDARD_INCLUDE_DIR
29 #define STANDARD_INCLUDE_DIR "/usr/include"
32 #ifndef STANDARD_INCLUDE_COMPONENT
33 #define STANDARD_INCLUDE_COMPONENT 0
36 #if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
37 # undef LOCAL_INCLUDE_DIR
38 # undef SYSTEM_INCLUDE_DIR
39 # undef STANDARD_INCLUDE_DIR
41 # undef CROSS_INCLUDE_DIR
44 const struct default_include cpp_include_defaults
[]
45 #ifdef INCLUDE_DEFAULTS
49 #ifdef GPLUSPLUS_INCLUDE_DIR
50 /* Pick up GNU C++ generic include files. */
51 { GPLUSPLUS_INCLUDE_DIR
, "G++", 1, 1, 0, 0 },
53 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
54 /* Pick up GNU C++ target-dependent include files. */
55 { GPLUSPLUS_TOOL_INCLUDE_DIR
, "G++", 1, 1, 0, 1 },
57 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
58 /* Pick up GNU C++ backward and deprecated include files. */
59 { GPLUSPLUS_BACKWARD_INCLUDE_DIR
, "G++", 1, 1, 0, 0 },
61 #ifdef LOCAL_INCLUDE_DIR
62 /* /usr/local/include comes before the fixincluded header files. */
63 { LOCAL_INCLUDE_DIR
, 0, 0, 1, 1, 0 },
65 #ifdef PREFIX_INCLUDE_DIR
66 { PREFIX_INCLUDE_DIR
, 0, 0, 1, 0, 0 },
68 #ifdef GCC_INCLUDE_DIR
69 /* This is the dir for fixincludes and for gcc's private headers. */
70 { GCC_INCLUDE_DIR
, "GCC", 0, 0, 0, 0 },
72 #ifdef CROSS_INCLUDE_DIR
73 /* One place the target system's headers might be. */
74 { CROSS_INCLUDE_DIR
, "GCC", 0, 0, 0, 0 },
76 #ifdef TOOL_INCLUDE_DIR
77 /* Another place the target system's headers might be. */
78 { TOOL_INCLUDE_DIR
, "BINUTILS", 0, 1, 0, 0 },
80 #ifdef SYSTEM_INCLUDE_DIR
81 /* Some systems have an extra dir of include files. */
82 { SYSTEM_INCLUDE_DIR
, 0, 0, 0, 1, 0 },
84 #ifdef STANDARD_INCLUDE_DIR
85 /* /usr/include comes dead last. */
86 { STANDARD_INCLUDE_DIR
, STANDARD_INCLUDE_COMPONENT
, 0, 0, 1, 0 },
90 #endif /* no INCLUDE_DEFAULTS */
92 #ifdef GCC_INCLUDE_DIR
93 const char cpp_GCC_INCLUDE_DIR
[] = GCC_INCLUDE_DIR
;
94 const size_t cpp_GCC_INCLUDE_DIR_len
= sizeof GCC_INCLUDE_DIR
- 8;
96 const char cpp_GCC_INCLUDE_DIR
[] = "";
97 const size_t cpp_GCC_INCLUDE_DIR_len
= 0;
100 /* The configured prefix. */
101 const char cpp_PREFIX
[] = PREFIX
;
102 const size_t cpp_PREFIX_len
= sizeof PREFIX
- 1;
104 /* This value is set by cpp_relocated at runtime */
105 const char *gcc_exec_prefix
;
107 /* Return true if the toolchain is relocated. */
111 static int relocated
= -1;
113 /* A relocated toolchain ignores standard include directories. */
116 /* Check if the toolchain was relocated? */
117 GET_ENVIRONMENT (gcc_exec_prefix
, "GCC_EXEC_PREFIX");