From a5f51dee3f8480b7bfb309a9cd6a05c87d013858 Mon Sep 17 00:00:00 2001 From: Ricardo Salveti de Araujo Date: Sun, 25 Mar 2012 18:58:25 -0300 Subject: Imported Upstream version 1.7.10.0.1.21 (ARMHF) Signed-off-by: Ricardo Salveti de Araujo --- sgx/eurasiacon/build/linux2/tools/cc-check.sh | 44 +++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 sgx/eurasiacon/build/linux2/tools/cc-check.sh (limited to 'sgx/eurasiacon/build/linux2/tools') 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 -- cgit v1.2.3