From e77f34eb39a0e78f73c72f8e0774263c240ec3da Mon Sep 17 00:00:00 2001 From: Rys Sommefeldt Date: Fri, 29 Mar 2013 23:50:16 +0000 Subject: [PATCH] better sysctl use if it's not in PATH --- scripts/functions/build_config | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/scripts/functions/build_config b/scripts/functions/build_config index 13f84a1322..cb6266a703 100755 --- a/scripts/functions/build_config +++ b/scripts/functions/build_config @@ -370,7 +370,21 @@ __rvm_detect_max_threads() { case "$(uname)" in (Darwin|FreeBSD) - sysctl -n hw.ncpu + if + __rvm_which sysctl >/dev/null + then + sysctl -n hw.ncpu + elif + [[ -x /usr/sbin/sysctl ]] + then + /usr/sbin/sysctl -n hw.ncpu + elif + [[ -x /sbin/sysctl ]] + then + /sbin/sysctl -n hw.ncpu + else + echo 1 + fi ;; (*) cat /proc/cpuinfo 2>/dev/null | (grep vendor_id || echo 'one';) | wc -l