Set CROSS_SYSTEM_HEADER_DIR according includedir

Message ID 20230106102520.3949796-1-yunqiang.su@cipunited.com
State Accepted
Headers
Series Set CROSS_SYSTEM_HEADER_DIR according includedir |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

YunQiang Su Jan. 6, 2023, 10:25 a.m. UTC
  For cross building with option:
   --sysroot=/ --prefix=/usr --includedir=/usr/<triple>
just like Debian does, fixinc.sh will use the wrong header files
from /usr/include.

gcc/
	* Makefile.in (CROSS_SYSTEM_HEADER_DIR): set according the
	  value of includedir.
---
 gcc/Makefile.in | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 6aed2cda3ca..6001c9e3b55 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -532,7 +532,11 @@  LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
 # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
 NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
 # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
-CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+ifeq (@includedir@,$(prefix)/include)
+  CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+else
+  CROSS_SYSTEM_HEADER_DIR = @includedir@
+endif
 
 # autoconf sets SYSTEM_HEADER_DIR to one of the above.
 # Purge it of unnecessary internal relative paths