#!/bin/sh
cmdexists()
{
type "$1" > /dev/null 2>&1
}
trycmd()
{
local name="$1"
shift
test -z "$(eval echo \$$name)" && cmdexists "$1" && eval "$name=\"$*\""
}
trycmd CC "gcc"
trycmd CC "clang"
trycmd CC "cc"
trycmd CC "false"
case "$($CC -dumpmachine 2>/dev/null)" in
*x86_64*) exit 0;;
esac
exit 1