From: PHO Date: Fri, 16 Mar 2012 03:44:18 +0000 (+0900) Subject: build-hc-pkg (detect_number_of_cpus): support for Linux X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=build-hc-pkg.git;a=commitdiff_plain;h=e1172e82e2def9b03ffe47e696a6aafeb182f0d6 build-hc-pkg (detect_number_of_cpus): support for Linux --- diff --git a/build-hc-pkg b/build-hc-pkg index 0c9069e..6e0e1fa 100755 --- a/build-hc-pkg +++ b/build-hc-pkg @@ -12,7 +12,13 @@ function detect_platform_type () { } function detect_number_of_cpus () { - if ! sysctl -n hw.ncpu 2>/dev/null; then + if sysctl -n "hw.ncpu" 2>/dev/null; then + # This works for most BSDs. + : + elif grep -qF processor /proc/cpuinfo; then + # Linux sucks... + grep -cF processor /proc/cpuinfo + else echo "WARNING: I don't know how to detect the number of processors on this platform." >&2 echo "WARNING: GHC will be built using only 1 processor. Expect some slowdown." >&2 echo 1