From: Rudolf Polzer Date: Sat, 3 Mar 2012 16:07:56 +0000 (+0100) Subject: better way to find number of CPUs X-Git-Tag: xonotic-v0.6.0~9 X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fxonotic.git;a=commitdiff_plain;h=d6c12f67ce8e308050c56bf7510226166b073ae6 better way to find number of CPUs --- diff --git a/misc/tools/all/xonotic.subr b/misc/tools/all/xonotic.subr index c8b7f8f1..dca4a33d 100644 --- a/misc/tools/all/xonotic.subr +++ b/misc/tools/all/xonotic.subr @@ -113,11 +113,9 @@ case "$cmd" in fi fi if [ -z "$MAKEFLAGS" ]; then - if [ -f /proc/cpuinfo ]; then - ncpus=$((`grep -c '^processor :' /proc/cpuinfo || true`+0)) - if [ $ncpus -gt 1 ]; then - MAKEFLAGS=-j$ncpus - fi + ncpus=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1` + if [ $ncpus -gt 1 ]; then + MAKEFLAGS=-j$ncpus fi if [ -n "$WE_HATE_OUR_USERS" ]; then MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw LIB_JPEG= CFLAGS_LIBJPEG="