1
# DP: Use /usr/include/<multiarch>/c++/4.x as the include directory
2
# DP: for host dependent c++ header files.
4
Index: b/src/libstdc++-v3/include/Makefile.am
5
===================================================================
6
--- a/src/libstdc++-v3/include/Makefile.am
7
+++ b/src/libstdc++-v3/include/Makefile.am
8
@@ -873,7 +873,7 @@ endif
10
host_srcdir = ${glibcxx_srcdir}/$(OS_INC_SRCDIR)
11
host_builddir = ./${host_alias}/bits
12
-host_installdir = ${gxx_include_dir}/${host_alias}$(MULTISUBDIR)/bits
13
+host_installdir = $(if $(shell $(CC) -print-multiarch),/usr/include/$(shell $(filter-out -m%,$(CC)) -print-multiarch)/c++/$(notdir ${gxx_include_dir})$(MULTISUBDIR)/bits,${gxx_include_dir}/${default_host_alias}$(MULTISUBDIR)/bits)
15
${host_srcdir}/ctype_base.h \
16
${host_srcdir}/ctype_inline.h \
17
Index: b/src/libstdc++-v3/include/Makefile.in
18
===================================================================
19
--- a/src/libstdc++-v3/include/Makefile.in
20
+++ b/src/libstdc++-v3/include/Makefile.in
21
@@ -1154,7 +1154,7 @@ profile_impl_headers = \
22
@GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE@c_compatibility_headers_extra = ${c_compatibility_headers}
23
host_srcdir = ${glibcxx_srcdir}/$(OS_INC_SRCDIR)
24
host_builddir = ./${host_alias}/bits
25
-host_installdir = ${gxx_include_dir}/${host_alias}$(MULTISUBDIR)/bits
26
+host_installdir = $(if $(shell $(CC) -print-multiarch),/usr/include/$(shell $(filter-out -m%,$(CC)) -print-multiarch)/c++/$(notdir ${gxx_include_dir})$(MULTISUBDIR)/bits,${gxx_include_dir}/${default_host_alias}$(MULTISUBDIR)/bits)
28
${host_srcdir}/ctype_base.h \
29
${host_srcdir}/ctype_inline.h \
30
Index: b/src/gcc/Makefile.in
31
===================================================================
32
--- a/src/gcc/Makefile.in
33
+++ b/src/gcc/Makefile.in
34
@@ -1119,6 +1119,7 @@ FLAGS_TO_PASS = \
36
"local_prefix=$(local_prefix)" \
37
"gxx_include_dir=$(gcc_gxx_include_dir)" \
38
+ "gxx_tool_include_dir=$(gcc_gxx_tool_include_dir)" \
39
"build_tooldir=$(build_tooldir)" \
40
"gcc_tooldir=$(gcc_tooldir)" \
42
@@ -1596,6 +1597,14 @@ ifneq ($(xmake_file),)
46
+# Directory in which the compiler finds target-dependent g++ includes.
47
+ifneq ($(call if_multiarch,non-empty),)
48
+ gcc_gxx_tool_include_dir = $(libsubdir)/$(libsubdir_to_prefix)include/$(MULTIARCH_DIRNAME)/c++/$(BASEVER_c)
50
+ gcc_gxx_tool_include_dir = $(gcc_gxx_include_dir)/$(target_noncanonical)
54
# all-tree.def includes all the tree.def files.
55
all-tree.def: s-alltree; @true
57
@@ -2595,7 +2604,7 @@ PREPROCESSOR_DEFINES = \
58
-DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
59
-DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
60
-DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
61
- -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_noncanonical)\" \
62
+ -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_tool_include_dir)\" \
63
-DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
64
-DLOCAL_INCLUDE_DIR=\"$(local_includedir)\" \
65
-DCROSS_INCLUDE_DIR=\"$(CROSS_SYSTEM_HEADER_DIR)\" \
66
Index: b/src/gcc/cppdefault.c
67
===================================================================
68
--- a/src/gcc/cppdefault.c
69
+++ b/src/gcc/cppdefault.c
70
@@ -49,6 +49,8 @@ const struct default_include cpp_include
71
/* Pick up GNU C++ target-dependent include files. */
72
{ GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,
73
GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },
74
+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,
75
+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 2 },
77
#ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
78
/* Pick up GNU C++ backward and deprecated include files. */
79
Index: b/src/gcc/incpath.c
80
===================================================================
81
--- a/src/gcc/incpath.c
82
+++ b/src/gcc/incpath.c
83
@@ -160,6 +160,18 @@ add_standard_paths (const char *sysroot,
85
str = reconcat (str, str, dir_separator_str,
89
+ char *suffix = strstr (str, "/c++/");
91
+ suffix = xstrdup (suffix);
92
+ str = reconcat (str, str, dir_separator_str,
94
+ dir_separator_str, suffix, NULL);
97
+ str = reconcat (str, str, dir_separator_str,
100
add_path (str, SYSTEM, p->cxx_aware, false);
102
@@ -224,7 +236,16 @@ add_standard_paths (const char *sysroot,
106
- str = reconcat (str, str, dir_separator_str, imultiarch, NULL);
109
+ char *suffix = strstr (str, "/c++/");
111
+ suffix = xstrdup (suffix);
112
+ str = reconcat (str, str, dir_separator_str, imultiarch,
113
+ dir_separator_str, suffix, NULL);
116
+ str = reconcat (str, str, dir_separator_str, imultiarch, NULL);
119
add_path (str, SYSTEM, p->cxx_aware, false);