From 0f1b77dae8b23844910c20442a86db9486f438aa Mon Sep 17 00:00:00 2001 From: Alex Parker Date: Thu, 1 Sep 2011 14:25:05 +0000 Subject: Backport r30323/r30169 - perl use if/elsif/else so that it'll build with both new and old perl. git-svn-id: svn://svn.rockbox.org/rockbox/branches/v3_9@30406 a1c6a512-1295-4272-9138-f99709370657 --- tools/multigcc.pl | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) mode change 100755 => 100644 tools/multigcc.pl (limited to 'tools/multigcc.pl') diff --git a/tools/multigcc.pl b/tools/multigcc.pl old mode 100755 new mode 100644 index 9be9978bd4..c272ebae08 --- a/tools/multigcc.pl +++ b/tools/multigcc.pl @@ -1,5 +1,4 @@ #!/usr/bin/perl -use Switch; use List::Util 'shuffle'; # standard from Perl 5.8 and later my $tempfile = "multigcc.out"; @@ -26,23 +25,22 @@ my $command = join " ", @params; # count number of cores my $cores; -switch($^O) { - case "darwin" { - chomp($cores = `sysctl -n hw.ncpu`); - $cores = 1 if ($?); - } - case "solaris" { - $cores = scalar grep /on-line/i, `psrinfo`; - $cores = 1 if ($?); +# Don't use given/when here - it's not compatible with old perl versions +if ($^O eq 'darwin') { + chomp($cores = `sysctl -n hw.ncpu`); + $cores = 1 if ($?); +} +elsif ($^O eq 'solaris') { + $cores = scalar grep /on-line/i, `psrinfo`; + $cores = 1 if ($?); +} +else { + if (open CPUINFO, "; + close CPUINFO; } else { - if (open CPUINFO, "; - close CPUINFO; - } - else { - $cores = 1; - } + $cores = 1; } } -- cgit v1.2.3