summaryrefslogtreecommitdiff
path: root/tools/multigcc.pl
diff options
context:
space:
mode:
Diffstat (limited to 'tools/multigcc.pl')
-rw-r--r--[-rwxr-xr-x]tools/multigcc.pl30
1 files changed, 14 insertions, 16 deletions
diff --git a/tools/multigcc.pl b/tools/multigcc.pl
index 9be9978bd4..c272ebae08 100755..100644
--- a/tools/multigcc.pl
+++ b/tools/multigcc.pl
@@ -1,5 +1,4 @@
1#!/usr/bin/perl 1#!/usr/bin/perl
2use Switch;
3use List::Util 'shuffle'; # standard from Perl 5.8 and later 2use List::Util 'shuffle'; # standard from Perl 5.8 and later
4 3
5my $tempfile = "multigcc.out"; 4my $tempfile = "multigcc.out";
@@ -26,23 +25,22 @@ my $command = join " ", @params;
26 25
27# count number of cores 26# count number of cores
28my $cores; 27my $cores;
29switch($^O) { 28# Don't use given/when here - it's not compatible with old perl versions
30 case "darwin" { 29if ($^O eq 'darwin') {
31 chomp($cores = `sysctl -n hw.ncpu`); 30 chomp($cores = `sysctl -n hw.ncpu`);
32 $cores = 1 if ($?); 31 $cores = 1 if ($?);
33 } 32}
34 case "solaris" { 33elsif ($^O eq 'solaris') {
35 $cores = scalar grep /on-line/i, `psrinfo`; 34 $cores = scalar grep /on-line/i, `psrinfo`;
36 $cores = 1 if ($?); 35 $cores = 1 if ($?);
36}
37else {
38 if (open CPUINFO, "</proc/cpuinfo") {
39 $cores = scalar grep /^processor/i, <CPUINFO>;
40 close CPUINFO;
37 } 41 }
38 else { 42 else {
39 if (open CPUINFO, "</proc/cpuinfo") { 43 $cores = 1;
40 $cores = scalar grep /^processor/i, <CPUINFO>;
41 close CPUINFO;
42 }
43 else {
44 $cores = 1;
45 }
46 } 44 }
47} 45}
48 46