From f8a2d0a4be8b3ef5a4f3e0484a9f9c48db5743ee Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 19 Mar 2016 18:22:21 +0000 Subject: More standard cross-compilation support (only --host, no --enable-cross needed) --- configure | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 966b9fa..da5007d 100755 --- a/configure +++ b/configure @@ -43,7 +43,6 @@ Optional features: --disable-allstatic do not prefer linking against static libraries [enabled] --enable-static-libc make entirely static binaries [disabled] --enable-slashpackage[=ROOT] assume /package installation at ROOT [disabled] - --enable-cross=CROSS prefix toolchain executable names with CROSS [none] --livedir=DIR default live directory [/run/s6-rc] EOF @@ -151,7 +150,7 @@ addlibspath='' addlibdpath='' vpaths='' vpathd='' -cross="$CROSS_COMPILE" +build= livedir=/run/s6-rc for arg ; do @@ -185,8 +184,9 @@ for arg ; do --enable-cross) ;; --disable-cross) cross= ;; --livedir=*) livedir=${arg#*=} ;; - --enable-*|--disable-*|--with-*|--without-*|--*dir=*|--build=*) ;; + --enable-*|--disable-*|--with-*|--without-*|--*dir=*) ;; --host=*|--target=*) target=${arg#*=} ;; + --build=*) build=${arg#*=} ;; -* ) echo "$0: unknown option $arg" ;; *=*) ;; *) target=$arg ;; @@ -255,6 +255,11 @@ if $slashpackage ; then fi # Find a C compiler to use +if test -n "$target" && test x${build} != x${target} ; then + cross=${target}- +else + cross= +fi echo "checking for C compiler..." trycc ${cross}${CC} trycc ${cross}gcc @@ -273,7 +278,13 @@ else fi echo "checking target system type..." -test -n "$target" || target=$($CC_AUTO -dumpmachine 2>/dev/null) || target=unknown +if test -z "$target" ; then + if test -n "$build" ; then + target=$build ; + else + target=$($CC_AUTO -dumpmachine 2>/dev/null) || target=unknown + fi +fi echo " ... $target" if test ! -d $sysdeps || test ! -f $sysdeps/target ; then echo "$0: error: $sysdeps is not a valid sysdeps directory" -- cgit v1.3.1