From 865602e0beb8e30ea1e1edf7db90f24088badb9e Mon Sep 17 00:00:00 2001 From: Herbert Valerio Riedel Date: Sat, 16 Apr 2016 18:12:09 +0200 Subject: Rework CC/CC_STAGE0 handling in `configure.ac` Rather than using the non-standard/idiomatic `--with-{gcc,clang}=...` scheme use the `CC=...` style scheme. The basic idea is to have Autoconf's CC/CFLAG/CPPFLAG apply to stage{1,2,3}, while having a separate _STAGE0 set of env-vars denote the bootstrap-toolchain flags/programs. This should be simpler, less confusing, and somewhat more in line with Autoconf's idioms (allowing us to reuse more of Autoconf rather than (re)inventing our own confusing non-standard m4 macros to do stuff that Autoconf could almost do already for us) Morever, expose CC_STAGE0 as a so-called "precious" variable. So now we can better control which bootstrapping gcc is used (by default the one used by the stage0 ghc, unless CC_STAGE0 is overriden) ``` Some influential environment variables: CC_STAGE0 C compiler command (bootstrap) CC C compiler command CFLAGS C compiler flags ... Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. ``` Test Plan: I've tested that cross-compiling with `--target=powerpc-linux-gnu` still works, and tried a few variants of settting `CC=` and `CC_STAGE0=`; `./validate` passed as well Reviewers: erikd, austin, bgamari, simonmar Reviewed By: simonmar Subscribers: Phyx, thomie Differential Revision: https://phabricator.haskell.org/D2078 --- mk/config.mk.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'mk/config.mk.in') diff --git a/mk/config.mk.in b/mk/config.mk.in index 5d5e581a43..b5d910b841 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -509,11 +509,10 @@ SUPPORTS_THIS_UNIT_ID = @SUPPORTS_THIS_UNIT_ID@ #----------------------------------------------------------------------------- # C compiler # -# NB. Don't override $(WhatGccIsCalled) using build.mk, re-configure using -# the flag --with-gcc= instead. The reason is that the configure script +# NB. Don't override $(CC) using build.mk, re-configure using +# the flag CC= instead. The reason is that the configure script # needs to know which gcc you're using in order to perform its tests. -WhatGccIsCalled = @WhatGccIsCalled@ GccVersion = @GccVersion@ ifeq "$(phase)" "0" CrossCompilePrefix = @@ -527,18 +526,19 @@ GccLT34 = @GccLT34@ GccLT46 = @GccLT46@ GccIsClang = @GccIsClang@ -CC = $(WhatGccIsCalled) +CC = @CC@ CC_STAGE0 = @CC_STAGE0@ CC_STAGE1 = $(CC) CC_STAGE2 = $(CC) CC_STAGE3 = $(CC) -AS = $(WhatGccIsCalled) +AS = @CC@ AS_STAGE0 = @CC_STAGE0@ AS_STAGE1 = $(AS) AS_STAGE2 = $(AS) AS_STAGE3 = $(AS) +# why no LD=@LD@ ? LD_STAGE0 = @LD_STAGE0@ LD_STAGE1 = $(LD) LD_STAGE2 = $(LD) -- cgit v1.2.1