--- gcc-3.4.1.orig/gcc/Makefile.in 2004-06-17 21:56:58.000000000 +0000 +++ gcc-3.4.1/gcc/Makefile.in 2005-12-09 20:52:18.196780139 +0000 @@ -350,7 +350,11 @@ 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@ @@ -2515,11 +2519,13 @@ $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(gcc_tooldir) # Build fixed copies of system files. +# Abort if no system headers available, unless building a crosscompiler. +# Canonicalize path so directory/that/doesnt/exist/yet/../../../.. doesn't fail stmp-fixinc: fixinc.sh gsyslimits.h @if 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"; \ + if test "x${SYSTEM_HEADER_DIR}" = "x`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`"; \ then sleep 1; else exit 1; fi; \ fi rm -rf include; mkdir include