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
9
host_srcdir = ${glibcxx_srcdir}/$(OS_INC_SRCDIR)
10
default_host_alias = @default_host_alias@
11
host_builddir = ./${default_host_alias}/bits
12
-host_installdir = ${gxx_include_dir}/${default_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
22
host_srcdir = ${glibcxx_srcdir}/$(OS_INC_SRCDIR)
23
default_host_alias = @default_host_alias@
24
host_builddir = ./${default_host_alias}/bits
25
-host_installdir = ${gxx_include_dir}/${default_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
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
@@ -1542,6 +1543,14 @@
46
+# Directory in which the compiler finds target-dependent g++ includes.
47
+ifneq ($(call if_multiarch,non-empty),)
48
+ gcc_gxx_tool_include_dir = /usr/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
58
"$(MULTILIB_EXCLUSIONS)" \
59
"$(MULTILIB_OSDIRNAMES)" \
60
"$(MULTILIB_REQUIRED)" \
61
- "$(MULTIARCH_DIRNAME)" \
62
+ "$(if $(MULTILIB_OSDIRNAMES),,$(MULTIARCH_DIRNAME))" \
67
-DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
68
-DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
69
-DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
70
- -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_noncanonical)\" \
71
+ -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_tool_include_dir)\" \
72
-DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
73
-DLOCAL_INCLUDE_DIR=\"$(local_includedir)\" \
74
-DCROSS_INCLUDE_DIR=\"$(CROSS_SYSTEM_HEADER_DIR)\" \
75
Index: b/src/gcc/cppdefault.c
76
===================================================================
77
--- a/src/gcc/cppdefault.c
78
+++ b/src/gcc/cppdefault.c
80
/* Pick up GNU C++ target-dependent include files. */
81
{ GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,
82
GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },
83
+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,
84
+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 2 },
86
#ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
87
/* Pick up GNU C++ backward and deprecated include files. */
88
Index: b/src/gcc/incpath.c
89
===================================================================
90
--- a/src/gcc/incpath.c
91
+++ b/src/gcc/incpath.c
94
str = reconcat (str, str, dir_separator_str,
98
+ char *suffix = strstr (str, "/c++/");
100
+ suffix = xstrdup (suffix);
101
+ str = reconcat (str, str, dir_separator_str,
103
+ dir_separator_str, suffix, NULL);
106
+ str = reconcat (str, str, dir_separator_str,
109
add_path (str, SYSTEM, p->cxx_aware, false);
115
- str = reconcat (str, str, dir_separator_str, imultiarch, NULL);
118
+ char *suffix = strstr (str, "/c++/");
120
+ suffix = xstrdup (suffix);
121
+ str = reconcat (str, str, dir_separator_str, imultiarch,
122
+ dir_separator_str, suffix, NULL);
125
+ str = reconcat (str, str, dir_separator_str, imultiarch, NULL);
128
add_path (str, SYSTEM, p->cxx_aware, false);