From ab2f5ccb4bf4670f9e943ae739a9afcafca9b108 Mon Sep 17 00:00:00 2001 From: François Revol Date: Fri, 27 Dec 2013 02:43:01 +0100 Subject: env.sh: Use a more portable way of counting online processors getconf _NPROCESSORS_ONLN should be available on Linux, FreeBSD and OSX at least: http://linux.die.net/man/1/getconf https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/getconf.1.html getconf NPROCESSORS_ONLN is BSD variant which Haiku provides. One might want to handle Solaris too some day... cf. https://gist.github.com/jj1bdx/5746298 --- Docs/env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/env.sh b/Docs/env.sh index 7b5aedd1d..734bc34f9 100644 --- a/Docs/env.sh +++ b/Docs/env.sh @@ -22,7 +22,7 @@ if [ "x${TARGET_WORKSPACE}" = "x" ]; then fi if [ "x${USE_CPUS}" = "x" ]; then - NCPUS=$(grep -c "^processor" /proc/cpuinfo 2>/dev/null) + NCPUS=$(getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null) NCPUS="${NCPUS:-1}" NCPUS=$((NCPUS * 2)) USE_CPUS="-j${NCPUS}" -- cgit v1.2.3