Merge branch 't/clang_analyzer_fixes'
[paraslash.git] / autogen.sh
index e5000a6fd70cddc63b1f2a2dc21f54bc760641bc..ea38dbf7ac901be9265427f4f91748fcfafebc09 100755 (executable)
@@ -5,6 +5,11 @@ if [ -z "$n" ]; then
        n=$(grep ^processor /proc/cpuinfo 2>/dev/null | wc -l)
        [ $n -eq 0 ] && n=1
 fi
+# If we are compiling with distcc, try to guess a reasonable number
+# based on (a) the number of cores on this machine and (b) the number
+# of words in the DISTCC_HOSTS variable.
+d="$(echo $DISTCC_HOSTS | wc -w)"
+n=$(($n + 2 * $n * $d))
 echo preparing, parallel=$n...
 if test -f Makefile; then
        make maintainer-clean > /dev/null 2>&1