support getting number of CPUs on FreeBSD et al.
[summon-arm-toolchain.git] / summon-arm-toolchain
index 56192e1cc961ffd52a172b117c4fbbd4b7cc2c71..9577702c3e5e41a91fd46c362282a3f859ac28e3 100755 (executable)
@@ -72,8 +72,10 @@ b2269d30ce7b93b7c714b90ef2f40221c2df0fcd  newlib-1.19.0.tar.gz"
 # Flags section
 ##############################################################################
 
-if which getconf > /dev/null; then
+if which getconf > /dev/null && getconf _NPROCESSORS_ONLN > /dev/null; then
        CPUS=$(getconf _NPROCESSORS_ONLN)
+elif which sysctl > /dev/null && sysctl hw.ncpu > /dev/null; then
+  CPUS=$(sysctl hw.ncpu | sed -E -e 's/^hw\.ncpu(: | = )//')
 else
        CPUS=1
 fi