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-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/1612e7a4 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/1612e7a4 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/1612e7a4 Branch: refs/heads/master Commit: 1612e7a48aae57a02ebcff89abb4bf0a706705d3 Parents: ae56843 Author: Nick Wellnhofer <wellnho...@aevum.de> Authored: Fri Feb 3 22:22:11 2017 +0100 Committer: Nick Wellnhofer <wellnho...@aevum.de> Committed: Sat Feb 4 18:13:34 2017 +0100 ---------------------------------------------------------------------- runtime/c/configure | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/1612e7a4/runtime/c/configure ---------------------------------------------------------------------- diff --git a/runtime/c/configure b/runtime/c/configure index 9557e66..40b79b6 100755 --- a/runtime/c/configure +++ b/runtime/c/configure @@ -15,8 +15,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -(cd ../../compiler/c && ./configure "$@") || exit -echo +if [ ! -e ../../compiler/c/Makefile ]; then + (cd ../../compiler/c && TARGET_CC= ./configure "$@") || exit + echo +fi echo Configuring Clownfish runtime... @@ -41,12 +43,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 "$@"