This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix PR 22541


GCC can't find sys-include while building, since the path contains "dir/../" components where "dir" is only created during make install.

This patch was approved a long time ago by geoffk:
  http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01345.html

I've retested it with a i686-linux bootstrap, and tested building a bfin-uclinux cross compiler with uClibc headers in the sys-include dir. Committed as 113859.

Mark, ok for 4.1?


Bernd



Index: ChangeLog
===================================================================
--- ChangeLog	(revision 113858)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2005-05-17  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+	PR bootstrap/22541
+	From Dan Kegel <dank@kegel.com>:
+	* Makefile.in: Strip "dir/../" combinations from SYSTEM_INCLUDE_DIR.
+
 2006-05-17  Eric Botcazou  <ebotcazou@adacore.com>
 
 	* tree.c (variably_modified_type_p) <ARRAY_TYPE>: Return true
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 113858)
+++ Makefile.in	(working copy)
@@ -397,7 +397,10 @@ NATIVE_SYSTEM_HEADER_DIR = /usr/include
 CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
 
 # autoconf sets SYSTEM_HEADER_DIR to one of the above.
-SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@
+# Purge it of unneccessary internal relative paths
+# to directories that might not exist yet.
+# The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta.
+SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`
 
 # Control whether to run fixproto and fixincludes.
 STMP_FIXPROTO = @STMP_FIXPROTO@
@@ -3211,13 +3214,16 @@ s-macro_list : $(GCC_PASSES) 
 ../$(build_subdir)/fixincludes/fixincl: ; @ :
 
 # Build fixed copies of system files.
+# Abort if no system headers available, unless building a crosscompiler.
+# FIXME: abort unless building --without-headers would be more accurate and less ugly
 stmp-fixinc: gsyslimits.h macro_list \
   $(build_objdir)/fixincludes/fixincl \
   $(build_objdir)/fixincludes/fixinc.sh
 	@if ! $(inhibit_libc) && test ! -d ${SYSTEM_HEADER_DIR}; then \
 	  echo The directory that should contain system headers does not exist: >&2 ; \
 	  echo "  ${SYSTEM_HEADER_DIR}" >&2 ; \
-	  if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \
+	  tooldir_sysinc=`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`; \
+	  if test "x${SYSTEM_HEADER_DIR}" = "x${tooldir_sysinc}"; \
 	  then sleep 1; else exit 1; fi; \
 	fi
 	rm -rf include; mkdir include

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]