1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
# vim: set ts=3 sw=3 noet ft=sh : bash
# CPU identification
#
# All of these functions can be overridden by $1 for use in buildbots, etc.
# The rest are meant to replace test or [ in if statements.
# Use with $() syntax
host_cpu() {
echo ${1:-`uname -m`}
}
iscpu_64bit() {
case ${1:-`uname -m`} in
x86_64|amd64) return 0 ;;
esac
return 1
}
iscpu_x86() {
case ${1:-`uname -m`} in
i386|i486|i586|i686|x86_64) return 0 ;;
*) [ "${PROCESSOR_ARCHITEW6432}" = "AMD64" ] && return 0 ;;
esac
return 1
}
iscpu_x86_64() {
case ${1:-`uname -m`} in
x86_64|amd64) return 0 ;;
esac
return 1
}
iscpu_arm() {
case ${1:-`uname -m`} in
armv*) return 0 ;;
esac
return 1
}
iscpu_armv5() {
[ "${1:-`uname -m`}" = "armv5tel" ] && return 0
return 1
}
# Consider using armv6* here?
iscpu_armv6() {
case ${1:-`uname -m`} in
armv6l|armv6) return 0 ;;
esac
return 1
}
# Consider using armv7* here?
# armv7s is Apple A6 chip
iscpu_armv7() {
case ${1:-`uname -m`} in
armv7l|armv7|armv7s) return 0 ;;
esac
return 1
}
|