]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/cppdefault.c
Update copyright years.
[thirdparty/gcc.git] / gcc / cppdefault.c
CommitLineData
472679ed 1/* CPP Library.
fbd26352 2 Copyright (C) 1986-2019 Free Software Foundation, Inc.
472679ed 3 Contributed by Per Bothner, 1994-95.
4 Based on CCCP program by Paul Rubin, June 1986
5 Adapted to ANSI C, Richard Stallman, Jan 1987
6
8c4c00c1 7 This program is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3, or (at your option) any
10 later version.
472679ed 11
8c4c00c1 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
472679ed 16
8c4c00c1 17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
472679ed 20
472679ed 21#include "config.h"
22#include "system.h"
805e22b2 23#include "coretypes.h"
24#include "tm.h"
472679ed 25#include "cppdefault.h"
26
638454a1 27#ifndef NATIVE_SYSTEM_HEADER_COMPONENT
28#define NATIVE_SYSTEM_HEADER_COMPONENT 0
e69f4d0e 29#endif
30
29d774d0 31#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
e69f4d0e 32# undef LOCAL_INCLUDE_DIR
6e8421cb 33# undef NATIVE_SYSTEM_HEADER_DIR
e69f4d0e 34#else
35# undef CROSS_INCLUDE_DIR
36#endif
37
472679ed 38const struct default_include cpp_include_defaults[]
39#ifdef INCLUDE_DEFAULTS
40= INCLUDE_DEFAULTS;
41#else
42= {
43#ifdef GPLUSPLUS_INCLUDE_DIR
e23b9583 44 /* Pick up GNU C++ generic include files. */
36ddd5fe 45 { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,
46 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
472679ed 47#endif
e23b9583 48#ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
49 /* Pick up GNU C++ target-dependent include files. */
36ddd5fe 50 { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,
51 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },
e23b9583 52#endif
b91355a3 53#ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
54 /* Pick up GNU C++ backward and deprecated include files. */
36ddd5fe 55 { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,
56 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
b91355a3 57#endif
64f4ed01 58#ifdef GCC_INCLUDE_DIR
59 /* This is the dir for gcc's private headers. */
60 { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
61#endif
472679ed 62#ifdef LOCAL_INCLUDE_DIR
63 /* /usr/local/include comes before the fixincluded header files. */
77adc39e 64 { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
72779020 65 { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
472679ed 66#endif
759d75c3 67#ifdef PREFIX_INCLUDE_DIR
72779020 68 { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 },
759d75c3 69#endif
d3036f42 70#ifdef FIXED_INCLUDE_DIR
71 /* This is the dir for fixincludes. */
6ea4242f 72 { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0,
73 /* A multilib suffix needs adding if different multilibs use
74 different headers. */
75#ifdef SYSROOT_HEADERS_SUFFIX_SPEC
76 1
77#else
78 0
79#endif
80 },
d3036f42 81#endif
472679ed 82#ifdef CROSS_INCLUDE_DIR
83 /* One place the target system's headers might be. */
72779020 84 { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
472679ed 85#endif
86#ifdef TOOL_INCLUDE_DIR
87 /* Another place the target system's headers might be. */
72779020 88 { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 },
472679ed 89#endif
6e8421cb 90#ifdef NATIVE_SYSTEM_HEADER_DIR
472679ed 91 /* /usr/include comes dead last. */
77adc39e 92 { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
638454a1 93 { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
6e8421cb 94#endif
72779020 95 { 0, 0, 0, 0, 0, 0 }
472679ed 96 };
97#endif /* no INCLUDE_DEFAULTS */
98
99#ifdef GCC_INCLUDE_DIR
100const char cpp_GCC_INCLUDE_DIR[] = GCC_INCLUDE_DIR;
101const size_t cpp_GCC_INCLUDE_DIR_len = sizeof GCC_INCLUDE_DIR - 8;
102#else
103const char cpp_GCC_INCLUDE_DIR[] = "";
104const size_t cpp_GCC_INCLUDE_DIR_len = 0;
105#endif
e9ed62b6 106
107/* The configured prefix. */
108const char cpp_PREFIX[] = PREFIX;
109const size_t cpp_PREFIX_len = sizeof PREFIX - 1;
a8bb4f69 110const char cpp_EXEC_PREFIX[] = STANDARD_EXEC_PREFIX;
e9ed62b6 111
112/* This value is set by cpp_relocated at runtime */
113const char *gcc_exec_prefix;
114
115/* Return true if the toolchain is relocated. */
116bool
117cpp_relocated (void)
118{
119 static int relocated = -1;
120
121 /* A relocated toolchain ignores standard include directories. */
122 if (relocated == -1)
123 {
124 /* Check if the toolchain was relocated? */
967958e4 125 gcc_exec_prefix = getenv ("GCC_EXEC_PREFIX");
e9ed62b6 126 if (gcc_exec_prefix)
127 relocated = 1;
128 else
129 relocated = 0;
130 }
131
132 return relocated;
133}