> The build system currently doesn't provide itself with hooks for an
> alternative compiler. Here's what I did for PCC:
>
> - HAVE_GCC and HAVE_PCC variables control which compiler will be
> used. defaults to HAVE_GCC = 4
I'll note that support for gcc 3 isn't supported anymore.
> - MKPCC variable controls whether PCC is compiled during the build
>
> For build.sh:
>
> - PCC compiles the do-gnu-lib-crtstuff4 target, although this code
> actually appears to be NetBSD code, not GNU code.
> - there are no c++ nor objc compilers in PCC, so these host tools
use
> false(1)
> - a directory tools/pcc is created to build a host tool
>
> It seems to work reasonably well. Is there a fundamental problem
> with this approach?
See below.
[..]
> @@ -358,20 +369,48 @@
> @true
> .endfor
>
The following patch isn't correct, gnu/lib/crtstuff4 and gnu/lib/
libgcc4 have
to be keept in that order. And LIBGCC_EXT isn't needed anymore,
where removing
the gcc3 support should be done in another step.
I would add something like this before the 'for dir' loop (not
tested):
.if defined(HAVE_GCC)
BUILD_CC_LIB= gnu/lib/libgcc${LIBGCC_EXT}
.elif defined(HAVE_PCC)
BUILD_CC_LIB= dist/pcc-libs
.endif
and then keep the crtstuff entry and use ${BUILD_CC_LIB} instead of
gnu/lib/libgcc${LIBGCC_EXT}
Alternative use this to replace 'gnu/lib/crtstuff${LIBGCC_EXT} gnu/
lib/libgcc${LIBGCC_EXT}':
.if defined(HAVE_GCC)
BUILD_CC_LIB= gnu/lib/crtstuff${LIBGCC_EXT}
BUILD_CC_LIB+= gnu/lib/libgcc${LIBGCC_EXT}
.elif defined(HAVE_PCC)
BUILD_CC_LIB= gnu/lib/crtstuff${LIBGCC_EXT}
BUILD_CC_LIB+= dist/pcc-libs
.endif