mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-19 21:07:54 +00:00
Use configure to find the processor count
configure.ac now finds how to count the CPUs in a system. Currently the getconf method and sysctl methods are supported. Adding more is easy enough. Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca>
This commit is contained in:
parent
f2f782dd1c
commit
6d1bcaa2f5
@ -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
|
||||
|
||||
|
@ -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...
|
||||
#--------------------------------------------------------------------
|
||||
|
@ -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}"
|
||||
|
Loading…
Reference in New Issue
Block a user