aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-05-08 21:15:27 -0700
committerMichael Forney <mforney@mforney.org>2019-05-08 21:15:27 -0700
commitedaab94419b857c441ed8025d0a28103e99e7d55 (patch)
treec995f6ad663b22d97f5425d730131a33402697f6 /configure
parentb00a5fd0a0b897ffd5a01906676b5d0814dd85de (diff)
configure: Add tool prefix when building a cross-compiler
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure14
1 files changed, 10 insertions, 4 deletions
diff --git a/configure b/configure
index 5f90898..a270b41 100755
--- a/configure
+++ b/configure
@@ -27,10 +27,6 @@ for arg ; do
done
: ${CC:=cc}
-: ${DEFAULT_PREPROCESSOR:=cpp}
-: ${DEFAULT_QBE:=qbe}
-: ${DEFAULT_ASSEMBLER:=as}
-: ${DEFAULT_LINKER:=ld}
printf 'checking host system type... '
test -n "$host" || host=$($CC -dumpmachine 2>/dev/null) || fail "could not determine host"
@@ -40,6 +36,16 @@ printf 'checking target system type...'
test -n "$target" || target=$host
printf '%s\n' "$target"
+toolprefix=
+if [ "$host" != "$target" ] ; then
+ toolprefix=$target-
+fi
+
+: ${DEFAULT_PREPROCESSOR:=${toolprefix}cpp}
+: ${DEFAULT_QBE:=qbe}
+: ${DEFAULT_ASSEMBLER:=${toolprefix}as}
+: ${DEFAULT_LINKER:=${toolprefix}ld}
+
case "$target" in
x86_64*|amd64*) qbetarget=amd64_sysv ;;
aarch64*) qbetarget=arm64 ;;