libretro-super/script-modules/cpu.sh

57 lines
954 B
Bash
Raw Normal View History

2015-02-09 00:16:00 +00:00
# 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`}
}
2015-02-23 07:00:15 +00:00
iscpu_x86() {
2015-02-09 00:16:00 +00:00
case ${1:-`uname -m`} in
2015-02-23 07:00:15 +00:00
i386|i486|i586|i686|x86_64) return 0 ;;
*) [ "${PROCESSOR_ARCHITEW6432}" = "AMD64" ] && return 0 ;;
2015-02-09 00:16:00 +00:00
esac
2015-02-23 07:00:15 +00:00
return 1
2015-02-09 00:16:00 +00:00
}
2015-02-23 07:00:15 +00:00
iscpu_x86_64() {
2015-02-09 00:16:00 +00:00
[ ${1:-`uname -m`} = "x86_64" ] && return 0
return 1
}
2015-02-23 07:00:15 +00:00
iscpu_arm() {
2015-02-09 00:16:00 +00:00
case ${1:-`uname -m`} in
armv*) return 0 ;;
esac
return 1
}
2015-02-23 07:00:15 +00:00
iscpu_armv5() {
2015-02-09 00:16:00 +00:00
[ "${1:-`uname -m`}" = "armv5tel" ] && return 0
return 1
}
# Consider using armv6* here?
2015-02-23 07:00:15 +00:00
iscpu_armv6() {
2015-02-09 00:16:00 +00:00
case ${1:-`uname -m`} in
armv6l|armv6) return 0 ;;
esac
return 1
}
# Consider using armv7* here?
# armv7s is Apple A6 chip
2015-02-23 07:00:15 +00:00
iscpu_armv7() {
2015-02-09 00:16:00 +00:00
case ${1:-`uname -m`} in
armv7l|armv7|armv7s) return 0 ;;
esac
return 1
}