Commit 18f06878 authored by Tamar Christina's avatar Tamar Christina

Fix configure detection.

Summary:
GHC's configure script seems to normalize the values returned from config.guess.
So for Windows it turns x86_64-pc-mingw64 into x86_64-unknown-mingw32.
These mangled names are stored in the values $BuildPlatform, $HostPlatform
and $TargetPlatform.

However further down the file when the comparison is done between the stage0
compiler and the host the normalized versions are not used.
So when normalization actually changes the triple this check will fail.

Not sure why it's worked for all this time.. Nor if this is the right fix?
Does it still work for cross compiling correctly?

Test Plan: ./configure

Reviewers: hvr, austin, thomie, bgamari, erikd

Reviewed By: erikd

Subscribers: erikd, #ghc_windows_task_force

Differential Revision: https://phabricator.haskell.org/D2452

GHC Trac Issues: #12487
parent 7ad3b491
......@@ -410,20 +410,20 @@ dnl ** Building a cross compiler?
dnl --------------------------------------------------------------
CrossCompiling=NO
# If 'host' and 'target' differ, then this means we are building a cross-compiler.
if test "$target" != "$host" ; then
if test "$TargetPlatform" != "$HostPlatform" ; then
CrossCompiling=YES
cross_compiling=yes # This tells configure that it can accept just 'target',
# otherwise you get
# configure: error: cannot run C compiled programs.
# If you meant to cross compile, use `--host'.
fi
if test "$build" != "$host" ; then
if test "$BuildPlatform" != "$host" ; then
AC_MSG_ERROR([
You've selected:
BUILD: $build (the architecture we're building on)
HOST: $host (the architecture the compiler we're building will execute on)
TARGET: $target (the architecture the compiler we're building will produce code for)
BUILD: $BuildPlatform (the architecture we're building on)
HOST: $HostPlatform (the architecture the compiler we're building will execute on)
TARGET: $TargetPlatform (the architecture the compiler we're building will produce code for)
BUILD must equal HOST; that is, we do not support building GHC itself
with a cross-compiler. To cross-compile GHC itself, set TARGET: stage
......@@ -437,7 +437,7 @@ then
else
CrossCompilePrefix=""
fi
TargetPlatformFull="${target}"
TargetPlatformFull="${TargetPlatform}"
AC_SUBST(CrossCompiling)
AC_SUBST(CrossCompilePrefix)
AC_SUBST(TargetPlatformFull)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment