From: Andre Noll Date: Thu, 21 Apr 2011 21:33:06 +0000 (+0200) Subject: autogen: Run parallel make if compiling with distcc. X-Git-Tag: v0.4.9~23^2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=75f66a2471d09e27698b0319b60cd6e365b9dfd4 autogen: Run parallel make if compiling with distcc. This adjusts the value of the make -j option in case the DISTCC_HOSTS environment variable is set. There is no way to determine the number of processing units (cores) for the remote hosts listed in DISTCC_HOSTS, so we set the number of jobs to run simultaneously to n + 2 * n * d where n is the number of cores on the local system and d is the number of hosts in DISTCC_HOSTS. This seems to work fine on one such distributed setup. --- diff --git a/autogen.sh b/autogen.sh index e5000a6f..ea38dbf7 100755 --- a/autogen.sh +++ b/autogen.sh @@ -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