From edaab94419b857c441ed8025d0a28103e99e7d55 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Wed, 8 May 2019 21:15:27 -0700 Subject: configure: Add tool prefix when building a cross-compiler --- configure | 14 ++++++++++---- 1 file 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 ;; -- cgit v1.2.3