diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2016-04-16 18:12:09 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-04-16 18:12:46 +0200 |
commit | 865602e0beb8e30ea1e1edf7db90f24088badb9e (patch) | |
tree | bbda9ab6adebd8b41a95f4f2c4760aab9c04b34e /aclocal.m4 | |
parent | f4e659121960eb81d5478f0b20d4cf6f4c0ed0d9 (diff) | |
download | haskell-865602e0beb8e30ea1e1edf7db90f24088badb9e.tar.gz |
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
Diffstat (limited to 'aclocal.m4')
-rw-r--r-- | aclocal.m4 | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/aclocal.m4 b/aclocal.m4 index 6403748c7f..477da3f05d 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -471,7 +471,7 @@ AC_DEFUN([FP_SETTINGS], SettingsWindresCommand="\$topdir/../${mingw_bin_prefix}windres.exe" SettingsTouchCommand='$topdir/bin/touchy.exe' else - SettingsCCompilerCommand="$WhatGccIsCalled" + SettingsCCompilerCommand="$CC" SettingsHaskellCPPCommand="$HaskellCPPCmd" SettingsHaskellCPPFlags="$HaskellCPPArgs" SettingsLdCommand="$LdCmd" @@ -2067,38 +2067,6 @@ AC_DEFUN([FIND_GHC_BOOTSTRAP_PROG],[ ]) -# FIND_GCC() -# -------------------------------- -# Finds where gcc is -# -# $1 = the variable to set -# $2 = the with option name -# $3 = the command to look for -AC_DEFUN([FIND_GCC],[ - if test "$windows" = YES - then - $1="$CC" - else - FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([$1], [$2], [$3]) - # fallback to CC if set and no --with-$2=... was used - if test -z "$With_$2" -a -n "$CC" - then - With_$2="$CC" - $1="$CC" - # From Xcode 5 on/, OS X command line tools do not include gcc - # anymore. Use clang. - elif test -z "$$1" - then - FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([$1], [clang], [clang]) - fi - if test -z "$$1" - then - AC_MSG_ERROR([cannot find $3 nor clang in your PATH]) - fi - fi - AC_SUBST($1) -]) - AC_DEFUN([MAYBE_OVERRIDE_STAGE0],[ if test ! -z "$With_$1" -a "$CrossCompiling" != "YES"; then AC_MSG_NOTICE([Not cross-compiling, so --with-$1 also sets $2]) @@ -2132,13 +2100,13 @@ AC_ARG_WITH(hs-cpp, # We can't use $CPP here, since HS_CPP_CMD is expected to be a single # command (no flags), and AC_PROG_CPP defines CPP as "/usr/bin/gcc -E". - HS_CPP_CMD=$WhatGccIsCalled + HS_CPP_CMD=$CC SOLARIS_GCC_CPP_BROKEN=NO SOLARIS_FOUND_GOOD_CPP=NO case $host in i386-*-solaris2) - GCC_MAJOR_MINOR=`$WhatGccIsCalled --version|grep "gcc (GCC)"|cut -d ' ' -f 3-3|cut -d '.' -f 1-2` + GCC_MAJOR_MINOR=`$CC --version|grep "gcc (GCC)"|cut -d ' ' -f 3-3|cut -d '.' -f 1-2` if test "$GCC_MAJOR_MINOR" != "3.4"; then # this is not 3.4.x release so with broken CPP SOLARIS_GCC_CPP_BROKEN=YES |