Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / patches / gcc-7-cross-environment-variables.patch
CommitLineData
04c4ef35
RW
1Search path environment variables for cross-compilers. See the discussion
2at <http://gcc.gnu.org/ml/gcc/2013-02/msg00124.html>.
3
4Note: Touch 'C_INCLUDE_PATH' et al. rather than 'CPATH', as discussed
5at <http://bugs.gnu.org/22186>.
6
7diff --git a/gcc/gcc.c b/gcc/gcc.c
8index eced0d5..08dec2b 100644
9--- a/gcc/gcc.c
10+++ b/gcc/gcc.c
11@@ -4317,7 +4317,7 @@ process_command (unsigned int decoded_options_count,
12 }
13
14 temp = env.get (LIBRARY_PATH_ENV);
15- if (temp && *cross_compile == '0')
16+ if (temp)
17 {
18 const char *startp, *endp;
19 char *nstore = (char *) alloca (strlen (temp) + 3);
20diff --git a/gcc/incpath.c b/gcc/incpath.c
21index 98fe5ec..96aff65 100644
22--- a/gcc/incpath.c
23+++ b/gcc/incpath.c
24@@ -461,8 +461,8 @@ register_include_chains (cpp_reader *pfile, const char *sysroot,
25 int stdinc, int cxx_stdinc, int verbose)
26 {
27 static const char *const lang_env_vars[] =
28- { "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH",
29- "OBJC_INCLUDE_PATH", "OBJCPLUS_INCLUDE_PATH" };
30+ { "CROSS_C_INCLUDE_PATH", "CROSS_CPLUS_INCLUDE_PATH",
31+ "CROSS_OBJC_INCLUDE_PATH", "CROSS_OBJCPLUS_INCLUDE_PATH" };
32 cpp_options *cpp_opts = cpp_get_options (pfile);
33 size_t idx = (cpp_opts->objc ? 2: 0);
34
35@@ -473,7 +473,7 @@ register_include_chains (cpp_reader *pfile, const char *sysroot,
36
37 /* CPATH and language-dependent environment variables may add to the
38 include chain. */
39- add_env_var_paths ("CPATH", BRACKET);
40+ add_env_var_paths ("CROSS_CPATH", BRACKET);
41 add_env_var_paths (lang_env_vars[idx], SYSTEM);
42
43 target_c_incpath.extra_pre_includes (sysroot, iprefix, stdinc);
44diff --git a/gcc/system.h b/gcc/system.h
45index 0cbf60a..3242c68 100644
46--- a/gcc/system.h
47+++ b/gcc/system.h
48@@ -1169,4 +1169,6 @@ helper_const_non_const_cast (const char *p)
49 /* Get definitions of HOST_WIDE_INT. */
50 #include "hwint.h"
51
52+#define LIBRARY_PATH_ENV "CROSS_LIBRARY_PATH"
53+
54 #endif /* ! GCC_SYSTEM_H */
55diff --git a/gcc/tlink.c b/gcc/tlink.c
56index a2a7db0..2d96872 100644
57--- a/gcc/tlink.c
58+++ b/gcc/tlink.c
59@@ -456,7 +456,7 @@ recompile_files (void)
60 file *f;
61
62 putenv (xstrdup ("COMPILER_PATH="));
63- putenv (xstrdup ("LIBRARY_PATH="));
64+ putenv (xstrdup (LIBRARY_PATH_ENV "="));
65
66 while ((f = file_pop ()) != NULL)
67 {