summaryrefslogtreecommitdiff
path: root/aclocal.m4
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2013-01-17 11:52:15 +0000
committerSimon Marlow <marlowsd@gmail.com>2013-01-17 12:39:55 +0000
commit109a1e53287f50103e8a5b592275940b6e3dbb53 (patch)
tree0cc3389e7a18318553be973b63577114a8c465f6 /aclocal.m4
parent900e7d255e2e41bab50e239f9b12c30bd6254881 (diff)
downloadhaskell-109a1e53287f50103e8a5b592275940b6e3dbb53.tar.gz
Tidy up cross-compiling
We have two cases: 1. building a cross-compiler 2. compiling GHC to run on a foreign platform These two are done with almost the same setup: (1) is the stage 1 compiler, and (2) is the stage 2 compiler, when CrossCompiling=YES. The only difference between (1) and (2) is that you if you set up the build for (1), then it stops before stage 2 and you can 'make install' to install stage 1. Unfortunately, (2) didn't work, and the build system code needed some tidying up. Change to the way the build is set up: Before ------ To build a cross-compiler: ./configure --target=<..> To compile a foreign GHC: ./configure --host=<..> --target=<..> Now --- To build a cross-compiler: ./configure --target=<..> And set "Stage1Only=YES" in mk/build.mk To compile a foreign GHC: ./configure --target=<..>
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m428
1 files changed, 19 insertions, 9 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 127f528f3e..fca602f487 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -61,18 +61,25 @@ AC_DEFUN([FPTOOLS_SET_PLATFORM_VARS],
if test "$target_alias" = ""
then
- if test "$bootstrap_target" != ""
+ if test "$host_alias" != ""
then
- target=$bootstrap_target
- echo "Target platform inferred as: $target"
+ GHC_CONVERT_CPU([$host_cpu], [TargetArch])
+ GHC_CONVERT_VENDOR([$host_vendor], [TargetVendor])
+ GHC_CONVERT_OS([$host_os], [TargetOS])
else
- echo "Can't work out target platform"
- exit 1
+ if test "$bootstrap_target" != ""
+ then
+ target=$bootstrap_target
+ echo "Target platform inferred as: $target"
+ else
+ echo "Can't work out target platform"
+ exit 1
+ fi
+
+ TargetArch=`echo "$target" | sed 's/-.*//'`
+ TargetVendor=`echo "$target" | sed -e 's/.*-\(.*\)-.*/\1/'`
+ TargetOS=`echo "$target" | sed 's/.*-//'`
fi
-
- TargetArch=`echo "$target" | sed 's/-.*//'`
- TargetVendor=`echo "$target" | sed -e 's/.*-\(.*\)-.*/\1/'`
- TargetOS=`echo "$target" | sed 's/.*-//'`
else
GHC_CONVERT_CPU([$target_cpu], [TargetArch])
GHC_CONVERT_VENDOR([$target_vendor], [TargetVendor])
@@ -377,6 +384,7 @@ AC_DEFUN([FP_SETTINGS],
then
mingw_bin_prefix=mingw/bin/
SettingsCCompilerCommand="\$topdir/../${mingw_bin_prefix}gcc.exe"
+ SettingsLdCommand="\$topdir/../${mingw_bin_prefix}ld.exe"
SettingsArCommand="\$topdir/../${mingw_bin_prefix}ar.exe"
SettingsPerlCommand='$topdir/../perl/perl.exe'
SettingsDllWrapCommand="\$topdir/../${mingw_bin_prefix}dllwrap.exe"
@@ -384,6 +392,7 @@ AC_DEFUN([FP_SETTINGS],
SettingsTouchCommand='$topdir/touchy.exe'
else
SettingsCCompilerCommand="$WhatGccIsCalled"
+ SettingsLdCommand="$LdCmd"
SettingsArCommand="$ArCmd"
SettingsPerlCommand="$PerlCmd"
SettingsDllWrapCommand="/bin/false"
@@ -406,6 +415,7 @@ AC_DEFUN([FP_SETTINGS],
SettingsLdFlags="$CONF_LD_LINKER_OPTS_STAGE2"
AC_SUBST(SettingsCCompilerCommand)
AC_SUBST(SettingsCCompilerFlags)
+ AC_SUBST(SettingsLdCommand)
AC_SUBST(SettingsLdFlags)
AC_SUBST(SettingsArCommand)
AC_SUBST(SettingsPerlCommand)