summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in2
-rw-r--r--configure.ac9
-rw-r--r--scripts/crosstool-NG.sh.in2
3 files changed, 12 insertions, 1 deletions
diff --git a/Makefile.in b/Makefile.in
index f0034cb..aa27d61 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -81,6 +81,7 @@ export LIBS := @LIBS@
export INTL_LIBS := @INTL_LIBS@
export curses_hdr := @ac_ct_curses_hdr@
export gettext := @gettext@
+export CPU_COUNT := @CPU_COUNT@
# config options to push down to kconfig
KCONFIG:= @kconfig_options@
@@ -192,6 +193,7 @@ define sed_it
-e 's,@@CT_awk@@,$(awk),g;' \
-e 's,@@CT_wget@@,$(wget),g;' \
-e 's,@@CT_curl@@,$(curl),g;' \
+ -e 's,@@CT_cpucount@@,$(CPU_COUNT),g;' \
$< >$@
endef
diff --git a/configure.ac b/configure.ac
index 3c94392..d80a5cd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -248,6 +248,15 @@ ACX_SET_KCONFIG_OPTION([stat_flavor_BSD])
test "$acx_cv_stat_flavor" = "GNU" && stat_flavor_GNU=y
ACX_SET_KCONFIG_OPTION([stat_flavor_GNU])
+#Find out how to count CPUs
+AC_CACHE_CHECK([whether to use getconf or sysctl to count CPUs],
+ [acx_cv_cpu_count],
+ [getconf _NPROCESSORS_ONLN >/dev/null 2>&1 && \
+ acx_cv_cpu_count="getconf _NPROCESSORS_ONLN"
+ sysctl -n hw.ncpu >/dev/null 2>&1 && \
+ acx_cv_cpu_count="sysctl -n hw.ncpu"])
+AC_SUBST(CPU_COUNT, "$acx_cv_cpu_count")
+
#--------------------------------------------------------------------
# Still boring, but remember the path, now...
#--------------------------------------------------------------------
diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in
index 902c15d..2635e5f 100644
--- a/scripts/crosstool-NG.sh.in
+++ b/scripts/crosstool-NG.sh.in
@@ -534,7 +534,7 @@ if [ -z "${CT_RESTART}" ]; then
fi
# Use the number of processors+1 when automatically setting the number of
# parallel jobs. Fall back to 1 if the host doesn't use GLIBC.
- AUTO_JOBS=$((`getconf _NPROCESSORS_ONLN 2> /dev/null || echo 0` + 1))
+ AUTO_JOBS=$((`@@CT_cpucount@@ 2>/dev/null || echo 0` + 1))
[ ${CT_PARALLEL_JOBS} -eq 0 ] && JOBSFLAGS="${JOBSFLAGS} -j${AUTO_JOBS}"
[ ${CT_PARALLEL_JOBS} -gt 0 ] && JOBSFLAGS="${JOBSFLAGS} -j${CT_PARALLEL_JOBS}"
JOBSFLAGS="${JOBSFLAGS} -l${CT_LOAD}"