diff options
author | Ricardo Salveti de Araujo <ricardo.salveti@linaro.org> | 2012-03-25 18:58:25 -0300 |
---|---|---|
committer | Ricardo Salveti de Araujo <ricardo.salveti@linaro.org> | 2012-03-25 18:58:25 -0300 |
commit | a5f51dee3f8480b7bfb309a9cd6a05c87d013858 (patch) | |
tree | c5b886b6c1d44b2dca15ba4e92a59f7294886a93 /sgx/eurasiacon/build/linux2/tools |
Imported Upstream version 1.7.10.0.1.21 (ARMHF)upstream/1.7.10.0.1.21
Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@linaro.org>
Diffstat (limited to 'sgx/eurasiacon/build/linux2/tools')
-rwxr-xr-x | sgx/eurasiacon/build/linux2/tools/cc-check.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/sgx/eurasiacon/build/linux2/tools/cc-check.sh b/sgx/eurasiacon/build/linux2/tools/cc-check.sh new file mode 100755 index 0000000..ac7f9cb --- /dev/null +++ b/sgx/eurasiacon/build/linux2/tools/cc-check.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +usage() { + echo "usage: $0 [--64] --cc CC --out OUT [cflag]" + exit 1 +} + +do_cc() { + echo "int main(void){return 0;}" | $CC $1 -xc -c - -o $ccof 2>/dev/null +} + +while [ 1 ]; do + if [ "$1" = "--64" ]; then + BIT_CHECK=1 + elif [ "$1" = "--cc" ]; then + [ "x$2" = "x" ] && usage + CC="$2" && shift + elif [ "$1" = "--out" ]; then + [ "x$2" = "x" ] && usage + OUT="$2" && shift + elif [ "${1#--}" != "$1" ]; then + usage + else + break + fi + shift +done + +[ "x$CC" = "x" ] && usage +[ "x$OUT" = "x" ] && usage +ccof=$OUT/cc-sanity-check + +if [ "x$BIT_CHECK" = "x1" ]; then + do_cc "" + file $ccof | grep -q 64-bit + [ "$?" = "0" ] && echo true || echo false +else + [ "x$1" = "x" ] && usage + do_cc $1 + [ "$?" = "0" ] && echo $1 +fi + +rm -f $ccof +exit 0 |