summaryrefslogtreecommitdiff
path: root/tools/multigcc.pl
diff options
context:
space:
mode:
Diffstat (limited to 'tools/multigcc.pl')
-rwxr-xr-xtools/multigcc.pl32
1 files changed, 15 insertions, 17 deletions
diff --git a/tools/multigcc.pl b/tools/multigcc.pl
index e263638d9d..c272ebae08 100755
--- a/tools/multigcc.pl
+++ b/tools/multigcc.pl
@@ -1,5 +1,4 @@
1#!/usr/bin/perl 1#!/usr/bin/perl
2use feature "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;
29given ($^O) { 28# Don't use given/when here - it's not compatible with old perl versions
30 when ("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 when ("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 default { 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