- case "$(detect_platform_type)" in
- *-*-darwin)
- ioreg -r -c IOCPU | fgrep -c IOCPUNumber
- ;;
- *)
- 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
- ;;
- esac
+ if sysctl -n "hw.ncpu" 2>/dev/null; then
+ # This works for most BSDs.
+ :
+ elif grep -qF processor /proc/cpuinfo 2>/dev/null; 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
+ fi