about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2016-03-19 18:22:13 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2016-03-19 18:22:13 +0000
commita7d962c0c5e35297e13d12ad2168f456d303ae88 (patch)
tree237f70f67b7c20dcb7513f8e2423d156e0619204
parentd18999790c462bc780bff457e6bb03cd88e488f3 (diff)
downloads6-linux-utils-a7d962c0c5e35297e13d12ad2168f456d303ae88.tar.gz
s6-linux-utils-a7d962c0c5e35297e13d12ad2168f456d303ae88.tar.xz
s6-linux-utils-a7d962c0c5e35297e13d12ad2168f456d303ae88.zip
More standard cross-compilation support (only --host, no --enable-cross needed)
-rw-r--r--INSTALL41
-rwxr-xr-xconfigure22
2 files changed, 40 insertions, 23 deletions
diff --git a/INSTALL b/INSTALL
index 6f7bec3..e6cb0ef 100644
--- a/INSTALL
+++ b/INSTALL
@@ -37,23 +37,30 @@ off them.
 
  Controlling a build process via environment variables is a big and
 dangerous hammer. You should try and pass flags to configure instead;
-nevertheless, the standard environment variables are recognized.
+nevertheless, a few standard environment variables are recognized.
 
- The value of the CROSS_COMPILE environment variable will prefix the
-building tools' names. The --enable-cross option is preferred, see
-"Cross-compilation" below.
- 
  If the CC environment variable is set, its value will override compiler
-detection by configure.
+detection by configure. The --host=HOST option will still add a HOST-
+prefix to the value of CC.
 
  The values of CFLAGS, CPPFLAGS and LDFLAGS will be appended to flags
 auto-detected by configure. To entirely override the flags set by
-configure, use make -e.
+configure instead, use make variables.
 
- The value of LDLIBS will be appended by make to command lines that link
-an executable, even without the -e option.
 
- The Makefile supports the DESTDIR convention for staging.
+* Make variables
+  --------------
+
+ You can invoke make with a few variables for more configuration.
+
+ CC, CFLAGS, CPPFLAGS, LDFLAGS, LDLIBS, AR, RANLIB, STRIP, INSTALL and
+CROSS_COMPILE can all be overridden on the make command line. This is
+an even bigger hammer than running ./configure with environment
+variables, so it is advised to only do this when it is the only way of
+obtaining the behaviour you want.
+
+ DESTDIR can be given on the "make install" command line in order to
+install to a staging directory.
 
 
 * Shared libraries
@@ -88,13 +95,15 @@ musl: http://musl-libc.org/
 cross-compilation in one place: skalibs. Once you have
 cross-compiled skalibs, the rest is easy.
 
- Use the --enable-cross=PREFIX option to configure, or simply
---enable-cross if your default toolchain is a cross-compiling
-toolchain. And make sure to use the correct version of skalibs
-for your target, and the correct sysdeps directory, making use
-of the --with-include, --with-lib, --with-dynlib and --with-sysdeps
+ * Use the --host=HOST option to configure, HOST being the triplet
+for your target.
+ * Make sure your cross-toolchain binaries (i.e. prefixed with HOST-)
+are accessible via your PATH environment variable.
+ * Make sure to use the correct version of skalibs for your target,
+and the correct sysdeps directory, making use of the
+--with-include, --with-lib, --with-dynlib and --with-sysdeps
 options as necessary.
- 
+
 
 * The slashpackage convention
   ---------------------------
diff --git a/configure b/configure
index 3378c99..ab7279f 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]
 
 EOF
 exit 0
@@ -150,7 +149,7 @@ addlibspath=''
 addlibdpath=''
 vpaths=''
 vpathd=''
-cross="$CROSS_COMPILE"
+build=
 
 for arg ; do
   case "$arg" in
@@ -179,11 +178,9 @@ for arg ; do
     --enable-slashpackage=*) sproot=${arg#*=} ; slashpackage=true ; ;;
     --enable-slashpackage) sproot= ; slashpackage=true ;;
     --disable-slashpackage) sproot= ; slashpackage=false ;;
-    --enable-cross=*) cross=${arg#*=} ;;
-    --enable-cross) ;;
-    --disable-cross) cross= ;;
-    --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 ;;
@@ -252,6 +249,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
@@ -270,7 +272,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"