https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115416

--- Comment #7 from YunQiang Su <syq at gcc dot gnu.org> ---
Maybe this patch is better

--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -560,11 +560,7 @@ 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.
-ifeq (@includedir@,$(prefix)/include)
-  CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
-else
-  CROSS_SYSTEM_HEADER_DIR = @includedir@
-endif
+CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@

 # autoconf sets SYSTEM_HEADER_DIR to one of the above.
 # Purge it of unnecessary internal relative paths
@@ -581,7 +577,10 @@ BUILD_SYSTEM_HEADER_DIR = `echo @BUILD_SYSTEM_HEADER_DIR@
| sed -e :a -e 's,[^/]
 STMP_FIXINC = @STMP_FIXINC@

 # Test to see whether <limits.h> exists in the system header files.
-LIMITS_H_TEST = [ -f $(BUILD_SYSTEM_HEADER_DIR)/limits.h ]
+LIMITS_H_TEST = headdir=$(BUILD_SYSTEM_HEADER_DIR) && \
+               headdir_sys=`echo $$headdir | grep '/sys-include$$'` && \
+               headdir_nosys=`echo $$headdir | sed 's/sys-include/include/'`
&& \
+               [ -f $$headdir/limits.h -o -n $$headdir_sys -a -f
"$$headdir_nosys/limits.h" ]

 # Directory for prefix to system directories, for
 # each of $(system_prefix)/usr/include, $(system_prefix)/usr/lib, etc.


Background: For cross/no-with-sysroot, the BUILD_SYSTEM_HEADER_DIR value will
be `$(gcc_tooldir)/sys-include`.  Here, `sys-include` is used by
`--with-headers` option.


So let's detect $(gcc_tooldir)/include too.

Reply via email to