Add cross-compilation support to configure script
If the environment variable TARGET_CC is set, configure uses the value
as target compiler for cross-compiling. For example:
TARGET_CC=x86_64-w64-mingw32-gcc ./configure
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/e2c7d719
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/e2c7d719
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/e2c7d719
Branch: refs/heads/master
Commit: e2c7d719964cc67c7096f7782ad2783b98162088
Parents: 982fdec
Author: Nick Wellnhofer <[email protected]>
Authored: Sat Feb 4 17:42:29 2017 +0100
Committer: Nick Wellnhofer <[email protected]>
Committed: Sat Feb 4 18:11:56 2017 +0100
----------------------------------------------------------------------
c/configure | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/e2c7d719/c/configure
----------------------------------------------------------------------
diff --git a/c/configure b/c/configure
index 8e61308..8a0535e 100755
--- a/c/configure
+++ b/c/configure
@@ -38,12 +38,17 @@ if [ -z "$CC" ]; then
fi
fi
-echo "Using C compiler '$CC'"
+if [ -z "$TARGET_CC" ]; then
+ echo "Using C compiler '$CC'"
+ TARGET_CC="$CC"
+else
+ echo "Using target compiler '$TARGET_CC' and host compiler '$CC'"
+fi
command="$CC ../common/charmonizer.c -o charmonizer"
echo $command
$command || exit
echo Running charmonizer
-./charmonizer --cc=$CC --host=c --enable-c --enable-makefile "$@"
+./charmonizer --cc="$TARGET_CC" --host=c --enable-c --enable-makefile "$@"