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.

thnks to yenliangl