get correct number of cores info in MacOSX

no /proc file system in MacOSX. use sysctl to return correct number of
cores to speed up building.

Change-Id: Ic813521c5867fd3c5ac1f565894dcb89aa1a3579
This commit is contained in:
Liu Yen-Liang (josh) 2014-09-30 21:10:05 +08:00 committed by josh
parent 24eaa04526
commit efb7430eb1
1 changed files with 4 additions and 0 deletions

View File

@ -25,7 +25,11 @@ txtrst=$(tput sgr0) # Reset
# Local defaults, can be overriden by environment
: ${PREFS_FROM_SOURCE:="false"}
if [ `uname -s` == "Darwin" ]; then
: ${THREADS:="$(sysctl -n machdep.cpu.core_count)"}
else
: ${THREADS:="$(cat /proc/cpuinfo | grep "^processor" | wc -l)"}
fi
# If there is more than one jdk installed, use latest 6.x
if [ "`update-alternatives --list javac | wc -l`" -gt 1 ]; then