summaryrefslogtreecommitdiff
path: root/0307-Set-fallback-value-for-print-multi-os-directory.patch
blob: 2032f6babfeec47a53f1e09b0d31d9cb66370d60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
From 0d157b14f361f8319f4694c54c6e01ac8f59d278 Mon Sep 17 00:00:00 2001
From: YunQiang Su <yunqiang@isrc.iscas.ac.cn>
Date: Tue, 8 Oct 2024 17:56:23 +0800
Subject: [PATCH 1/2] Set fallback value for -print-multi-os-directory

Clang doesn't support -print-multi-os-directory option.
So let's set the fallback value (../lib64) if it is empty.

This is only needed for the projects built by hostcc:
  gcc, libcc1, libiberty

The projects for targets only, will always built by gcc itself.
---
 gcc/configure         | 3 +++
 libcc1/configure      | 6 ++++++
 libcc1/configure.ac   | 3 +++
 libiberty/Makefile.in | 5 ++++-
 libtool.m4            | 3 +++
 5 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/gcc/configure b/gcc/configure
index 7e64599b0..ef0449edd 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -18598,6 +18598,9 @@ if test "$GCC" = yes; then
   # and add multilib dir if necessary.
   lt_tmp_lt_search_path_spec=
   lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  if [ -z "$lt_multi_os_dir" ];then
+    lt_multi_os_dir=../lib64
+  fi
   for lt_sys_path in $lt_search_path_spec; do
     if test -d "$lt_sys_path/$lt_multi_os_dir"; then
       lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
diff --git a/libcc1/configure b/libcc1/configure
index 01cfb2806..3c437d690 100755
--- a/libcc1/configure
+++ b/libcc1/configure
@@ -9701,6 +9701,9 @@ if test "$GCC" = yes; then
   # and add multilib dir if necessary.
   lt_tmp_lt_search_path_spec=
   lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  if [ -z "$lt_multi_os_dir" ];then
+    lt_multi_os_dir=../lib64
+  fi
   for lt_sys_path in $lt_search_path_spec; do
     if test -d "$lt_sys_path/$lt_multi_os_dir"; then
       lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
@@ -14865,6 +14868,9 @@ libsuffix=
 if test "$GXX" = yes; then
   libsuffix=`$CXX -print-multi-os-directory`
 fi
+if [ -z "$libsuffix" ];then
+  libsuffix=../lib64
+fi
 
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket libraries" >&5
diff --git a/libcc1/configure.ac b/libcc1/configure.ac
index 36f5a7e09..acd7c4c04 100644
--- a/libcc1/configure.ac
+++ b/libcc1/configure.ac
@@ -72,6 +72,9 @@ libsuffix=
 if test "$GXX" = yes; then
   libsuffix=`$CXX -print-multi-os-directory`
 fi
+if [ -z "$libsuffix" ];then
+  libsuffix=../lib64
+fi
 AC_SUBST(libsuffix)
 
 dnl Test for -lsocket and -lnsl.  Copied from libgo/configure.ac.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index 1b17c2e3a..2bfa00de5 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -385,7 +385,10 @@ install-strip: install
 # multilib-specific flags, it's overridden by FLAGS_TO_PASS from the
 # default multilib, so we have to take CFLAGS into account as well,
 # since it will be passed the multilib flags.
-MULTIOSDIR = `$(CC) $(CFLAGS) -print-multi-os-directory`
+MULTIOSDIR = `$(CC) $(CFLAGS) -print-multi-os-directory 2>/dev/null`
+ifeq ($(MULTIOSDIR),)
+ MULTIOSDIR = ../lib64
+endif
 install_to_libdir: all
 	if test -n "${target_header_dir}"; then \
 		${mkinstalldirs} $(DESTDIR)$(libdir)/$(MULTIOSDIR); \
diff --git a/libtool.m4 b/libtool.m4
index 17f8e5f30..86fc1e705 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -2059,6 +2059,9 @@ if test "$GCC" = yes; then
   # and add multilib dir if necessary.
   lt_tmp_lt_search_path_spec=
   lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  if [ -z "$lt_multi_os_dir" ];then
+    lt_multi_os_dir=../lib64
+  fi
   for lt_sys_path in $lt_search_path_spec; do
     if test -d "$lt_sys_path/$lt_multi_os_dir"; then
       lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
-- 
2.47.0