1ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl#!/bin/sh
2ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl
3ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl# Copyright 2013, ARM Limited
4ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl# All rights reserved.
5ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl#
6ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl# Redistribution and use in source and binary forms, with or without
7ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl# modification, are permitted provided that the following conditions are met:
8ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl#
9ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl#   * Redistributions of source code must retain the above copyright notice,
10ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl#     this list of conditions and the following disclaimer.
11ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl#   * Redistributions in binary form must reproduce the above copyright notice,
12ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl#     this list of conditions and the following disclaimer in the documentation
13ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl#     and/or other materials provided with the distribution.
14ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl#   * Neither the name of ARM Limited nor the names of its contributors may be
15ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl#     used to endorse or promote products derived from this software without
16ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl#     specific prior written permission.
17ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl#
18ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS CONTRIBUTORS "AS IS" AND
19ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl
29ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlif [ "$#" -lt 1 ]; then
30ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl  echo "Usage: tools/cross_build_gcc.sh <GCC prefix> [scons arguments ...]"
31ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl  exit 1
32ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlfi
33ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl
34ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlexport CXX=$1g++
35ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlexport AR=$1ar
36ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlexport RANLIB=$1ranlib
37ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlexport CC=$1gcc
38ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlexport LD=$1ld
39ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl
40ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlOK=1
41ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlif [ ! -x "$CXX" ]; then
42ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl  echo "Error: $CXX does not exist or is not executable."
43ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl  OK=0
44ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlfi
45ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlif [ ! -x "$AR" ]; then
46ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl  echo "Error: $AR does not exist or is not executable."
47ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl  OK=0
48ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlfi
49ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlif [ ! -x "$RANLIB" ]; then
50ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl  echo "Error: $RANLIB does not exist or is not executable."
51ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl  OK=0
52ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlfi
53ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlif [ ! -x "$CC" ]; then
54ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl  echo "Error: $CC does not exist or is not executable."
55ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl  OK=0
56ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlfi
57ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlif [ ! -x "$LD" ]; then
58ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl  echo "Error: $LD does not exist or is not executable."
59ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl  OK=0
60ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlfi
61ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlif [ $OK -ne 1 ]; then
62ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl  exit 1
63ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlfi
64ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl
65ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixl
66ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlshift
67ad96eda8944ab1c1ba55715c50d9d6f0a3ed1dcarmvixlscons $@
68