mirror of https://git.musl-libc.org/git/musl
follow standard configure behavior for cross compile prefix
the standard configure interface, which our configure script tries to implement, identifies cross compiling (build != host) and searches for the properly-prefixed cross tools. our script was not doing that, forcing users to explicitly provide either CC or a CROSS_COMPILE tool prefix, and the more common choice, just providing CC, was incomplete because the Makefile would still invoke the native ar and ranlib programs. this happened to work when building on ELF-based systems with GNU binutils, but could easily fail when cross-compiling from dissimilar systems. like before, and like the standard configure behavior, an explicit CC or CROSS_COMPILE variable on the command line or in the environment overrides the automatic prefixing.
This commit is contained in:
parent
f0a6139933
commit
2d49c2243f
|
@ -25,6 +25,7 @@ Fine tuning of the installation directories:
|
|||
System types:
|
||||
--target=TARGET configure to run on target TARGET [detected]
|
||||
--host=HOST same as --target
|
||||
--build=BUILD build system type; used only to infer cross-compiling
|
||||
|
||||
Optional features:
|
||||
--enable-optimize=... optimize listed components for speed over size [auto]
|
||||
|
@ -129,6 +130,7 @@ includedir='$(prefix)/include'
|
|||
syslibdir='/lib'
|
||||
tools=
|
||||
tool_libs=
|
||||
build=
|
||||
target=
|
||||
optimize=auto
|
||||
debug=no
|
||||
|
@ -172,6 +174,7 @@ case "$arg" in
|
|||
--disable-gcc-wrapper|--enable-gcc-wrapper=no) wrapper=no ;;
|
||||
--enable-*|--disable-*|--with-*|--without-*|--*dir=*|--build=*) ;;
|
||||
--host=*|--target=*) target=${arg#*=} ;;
|
||||
--build=*) build=${arg#*=} ;;
|
||||
-* ) echo "$0: unknown option $arg" ;;
|
||||
CC=*) CC=${arg#*=} ;;
|
||||
CFLAGS=*) CFLAGS=${arg#*=} ;;
|
||||
|
@ -180,7 +183,7 @@ LDFLAGS=*) LDFLAGS=${arg#*=} ;;
|
|||
CROSS_COMPILE=*) CROSS_COMPILE=${arg#*=} ;;
|
||||
LIBCC=*) LIBCC=${arg#*=} ;;
|
||||
*=*) ;;
|
||||
*) target=$arg ;;
|
||||
*) build=$arg ; target=$arg ;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
@ -213,6 +216,15 @@ done
|
|||
set +C
|
||||
trap 'rm "$tmpc"' EXIT INT QUIT TERM HUP
|
||||
|
||||
#
|
||||
# Check whether we are cross-compiling, and set a default
|
||||
# CROSS_COMPILE prefix if none was provided.
|
||||
#
|
||||
test "$target" && \
|
||||
test "$target" != "$build" && \
|
||||
test -z "$CROSS_COMPILE" && \
|
||||
CROSS_COMPILE="$target-"
|
||||
|
||||
#
|
||||
# Find a C compiler to use
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue