summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDan McGregor <dan.mcgregor@usask.ca>2017-03-02 04:22:13 (GMT)
committerDan McGregor <dan.mcgregor@usask.ca>2017-03-02 04:22:13 (GMT)
commit6d1bcaa2f53dd540bbb85b5b98ee1422005cdc9e (patch)
tree46f493dc5b55f77031bf8b8300cc2622822e962e /configure.ac
parentf2f782dd1cf2b4ccb6f28f6113e7fedb23f078d6 (diff)
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>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac9
1 files changed, 9 insertions, 0 deletions
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...
#--------------------------------------------------------------------