summaryrefslogtreecommitdiff
path: root/infrastructure
diff options
context:
space:
mode:
authorJames O'Gorman <james@netinertia.co.uk>2011-05-01 16:34:15 +0000
committerJames O'Gorman <james@netinertia.co.uk>2011-05-01 16:34:15 +0000
commitf7768527a828c518f8cdd183806ae1cb061225b7 (patch)
treeb2da2f76d56df6d439cf9bac11f544c795bbfe1a /infrastructure
parent349d63cfd7ddaf02c9bc146497937ad92ecfb89e (diff)
Refine CPU detection code in BoxPlatform to allow use of multiple processors on systems other than Darwin.
Diffstat (limited to 'infrastructure')
-rw-r--r--infrastructure/BoxPlatform.pm.in29
1 files changed, 21 insertions, 8 deletions
diff --git a/infrastructure/BoxPlatform.pm.in b/infrastructure/BoxPlatform.pm.in
index 59ab5d85..c3e57a10 100644
--- a/infrastructure/BoxPlatform.pm.in
+++ b/infrastructure/BoxPlatform.pm.in
@@ -82,17 +82,30 @@ BEGIN
# where to put the files
$install_into_dir = '@sbindir_expanded@';
+ # see how many processors there are, and set make flags accordingly
+ if($build_os eq 'Darwin' || $build_os =~ /(Free|Net|Open)BSD/)
+ {
+ $cpus = `sysctl -n hw.ncpu`;
+ }
+ elsif($build_os eq 'Linux')
+ {
+ $cpus = `grep -c ^processor /proc/cpuinfo`;
+ }
+ elsif($build_os eq 'SunOS')
+ {
+ $cpus = `psrinfo -p`;
+ }
+
+ chomp $cpus;
+ if($cpus > 1)
+ {
+ print STDERR "$cpus processors detected, will set make to perform concurrent jobs\n";
+ $sub_make_options = ' -j '.($cpus + 1);
+ }
+
# if it's Darwin,
if($build_os eq 'Darwin')
{
- # see how many processors there are, and set make flags accordingly
- my $cpus = `sysctl hw.ncpu`;
- if($cpus =~ m/hw.ncpu:\s(\d+)/ && $1 > 1)
- {
- print STDERR "$1 processors detected, will set make to perform concurrent jobs\n";
- $sub_make_options = ' -j '.($1 + 1);
- }
-
# test for fink installation
if(-d '/sw/include' && -d '/sw/lib')
{