2004-06-22 06:37:04 +08:00
|
|
|
package Sigar::ArchName;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use Config;
|
|
|
|
|
|
|
|
sub get_name {
|
|
|
|
my $os = lc $^O;
|
|
|
|
my $vers = $Config{osvers};
|
|
|
|
my $arch = $Config{archname};
|
|
|
|
|
|
|
|
if ($os =~ /win32/) {
|
|
|
|
return 'x86-winnt';
|
|
|
|
}
|
|
|
|
elsif ($os =~ /linux/) {
|
|
|
|
return 'x86-linux';
|
|
|
|
}
|
|
|
|
elsif ($os =~ /hpux/) {
|
|
|
|
if ($vers =~ /11\./) {
|
2006-07-05 03:49:18 +08:00
|
|
|
return 'pa-hpux-11';
|
2004-06-22 06:37:04 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
elsif ($os =~ /aix/) {
|
2006-07-05 03:49:18 +08:00
|
|
|
return 'ppc-aix-5';
|
2004-06-22 06:37:04 +08:00
|
|
|
}
|
|
|
|
elsif ($os =~ /solaris/) {
|
|
|
|
if ($arch =~ /sun4/) {
|
2006-07-05 03:49:18 +08:00
|
|
|
return 'sparc-solaris';
|
2004-06-22 06:37:04 +08:00
|
|
|
}
|
|
|
|
elsif ($arch =~ /.86/) {
|
2006-07-05 03:49:18 +08:00
|
|
|
return 'x86-solaris';
|
2004-06-22 06:37:04 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
elsif ($os =~ /darwin/) {
|
2006-07-05 03:49:18 +08:00
|
|
|
return 'universal-macosx';
|
2004-06-22 06:37:04 +08:00
|
|
|
}
|
2007-02-28 13:14:24 +08:00
|
|
|
elsif ($os =~ /freebsd/) {
|
|
|
|
if($arch =~ /.86/) {
|
|
|
|
if($vers =~ /6\../ ) {
|
|
|
|
return 'x86-freebsd-6';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elsif( $arch =~ /amd64/) {
|
|
|
|
if($vers =~ /6\../ ) {
|
|
|
|
return 'amd64-freebsd-6';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-06-22 06:37:04 +08:00
|
|
|
|
|
|
|
die "Unsupported platform";
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|
|
|
|
__END__
|