1.1 --- a/patches/gcc/4.0.0/100-fix-fixincl.patch Wed Oct 28 12:03:38 2009 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,72 +0,0 @@
1.4 -See http://gcc.gnu.org/PR22541
1.5 -
1.6 -From: Dan Kegel
1.7 -
1.8 -When building gcc-3.4.3 or gcc-4.0.[01] into a clean $PREFIX (the only two I've tried like this),
1.9 -the configure script happily copies the glibc include files from include to sys-include;
1.10 -here's the line from the log file (with $PREFIX instead of the real prefix):
1.11 -
1.12 -Copying $PREFIX/i686-unknown-linux-gnu/include to $PREFIX/i686-unknown-linux-gnu/sys-include
1.13 -
1.14 -But later, when running fixincludes, it gives the error message
1.15 - The directory that should contain system headers does not exist:
1.16 - $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/../../../../i686-unknown-linux-gnu/sys-include
1.17 -
1.18 -Nevertheless, it continues building; the header files it installs in
1.19 - $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/include
1.20 -do not include the boilerplate that would cause it to #include_next the
1.21 -glibc headers in the system header directory.
1.22 -Thus the resulting toolchain can't compile the following program:
1.23 -#include <limits.h>
1.24 -int x = PATH_MAX;
1.25 -because its limits.h doesn't include the glibc header.
1.26 -
1.27 -That's not nice. I suspect the problem is that gcc/Makefile.in assumes that
1.28 -it can refer to $PREFIX/i686-unknown-linux-gnu with the path
1.29 - $PREFIX/lib/../i686-unknown-linux-gnu, but
1.30 -that fails because the directory $PREFIX/lib doesn't exist during 'make all';
1.31 -it is only created later, during 'make install'. (Which makes this problem
1.32 -confusing, since one only notices the breakage well after 'make install',
1.33 -at which point the path configure complained about does exist, and has the
1.34 -right stuff in it.)
1.35 -
1.36 -A possible fix is to replace the line in gcc/Makefile.in that says
1.37 - SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@
1.38 -with a version that gets rid of extra ..'s, e.g.
1.39 - SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,,;ta"`
1.40 -(hey, that's the first time I've ever used a label in a sed script; thanks to the sed faq
1.41 -for explaining the :a ... ta method of looping to repeat a search-and-replace until it doesn't match.)
1.42 -
1.43 -[rediffed against gcc-4.0.0]
1.44 -
1.45 ---- gcc-4.0.0/gcc/Makefile.in.orig 2005-04-04 12:45:13.000000000 -0700
1.46 -+++ gcc-4.0.0/gcc/Makefile.in 2005-05-20 12:33:43.000000000 -0700
1.47 -@@ -378,7 +378,10 @@
1.48 - CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
1.49 -
1.50 - # autoconf sets SYSTEM_HEADER_DIR to one of the above.
1.51 --SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@
1.52 -+# Purge it of unneccessary internal relative paths
1.53 -+# to directories that might not exist yet.
1.54 -+# The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta.
1.55 -+SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`
1.56 -
1.57 - # Control whether to run fixproto and fixincludes.
1.58 - STMP_FIXPROTO = @STMP_FIXPROTO@
1.59 -@@ -2838,13 +2841,15 @@
1.60 - ../$(build_subdir)/fixincludes/fixincl: ; @ :
1.61 -
1.62 - # Build fixed copies of system files.
1.63 -+# Abort if no system headers available, unless building a crosscompiler.
1.64 -+# FIXME: abort unless building --without-headers would be more accurate and less ugly
1.65 - stmp-fixinc: gsyslimits.h macro_list \
1.66 - ../$(build_subdir)/fixincludes/fixincl \
1.67 - ../$(build_subdir)/fixincludes/fixinc.sh
1.68 - @if test ! -d ${SYSTEM_HEADER_DIR}; then \
1.69 - echo The directory that should contain system headers does not exist: >&2 ; \
1.70 - echo " ${SYSTEM_HEADER_DIR}" >&2 ; \
1.71 -- if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \
1.72 -+ if test "x${SYSTEM_HEADER_DIR}" = "x`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`"; \
1.73 - then sleep 1; else exit 1; fi; \
1.74 - fi
1.75 - rm -rf include; mkdir include