diff --git a/bindings/SigarBuild.pm b/bindings/SigarBuild.pm index cdff9894..54b6384e 100644 --- a/bindings/SigarBuild.pm +++ b/bindings/SigarBuild.pm @@ -1,6 +1,7 @@ package SigarBuild; use strict; +use Config; use Exporter; use File::Basename qw(basename); use File::Copy qw(copy); @@ -11,6 +12,57 @@ use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); @EXPORT = qw(cppflags ldflags libs os src inline_src); +sub archname { + my $os = lc $^O; + my $vers = $Config{osvers}; + my $arch = $Config{archname}; + + if ($os =~ /win32/) { + return 'x86-winnt'; + } + elsif ($os =~ /linux/) { + if ($arch =~ /_64/) { + return 'amd64-linux'; + } + else { + return 'x86-linux'; + } + } + elsif ($os =~ /hpux/) { + if ($vers =~ /11\./) { + return 'pa-hpux-11'; + } + } + elsif ($os =~ /aix/) { + return 'ppc-aix-5'; + } + elsif ($os =~ /solaris/) { + if ($arch =~ /sun4/) { + return 'sparc-solaris'; + } + elsif ($arch =~ /.86/) { + return 'x86-solaris'; + } + } + elsif ($os =~ /darwin/) { + return 'universal-macosx'; + } + elsif ($os =~ /freebsd/) { + if ($arch =~ /.86/) { + if($vers =~ /6\../ ) { + return 'x86-freebsd-6'; + } + } + elsif ($arch =~ /amd64/) { + if ($vers =~ /6\../ ) { + return 'amd64-freebsd-6'; + } + } + } + + return ''; +} + sub flags { my $os = lc $^O; my $is_win32 = 0; diff --git a/bindings/SigarWrapper.pm b/bindings/SigarWrapper.pm index f0c2de88..abbe5942 100644 --- a/bindings/SigarWrapper.pm +++ b/bindings/SigarWrapper.pm @@ -2,7 +2,6 @@ package SigarWrapper; use strict; -use Config; use Cwd; use Exporter; use File::Path; @@ -12,57 +11,6 @@ use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); @EXPORT = qw(generate); -sub archname { - my $os = lc $^O; - my $vers = $Config{osvers}; - my $arch = $Config{archname}; - - if ($os =~ /win32/) { - return 'x86-winnt'; - } - elsif ($os =~ /linux/) { - if ($arch =~ /_64/) { - return 'amd64-linux'; - } - else { - return 'x86-linux'; - } - } - elsif ($os =~ /hpux/) { - if ($vers =~ /11\./) { - return 'pa-hpux-11'; - } - } - elsif ($os =~ /aix/) { - return 'ppc-aix-5'; - } - elsif ($os =~ /solaris/) { - if ($arch =~ /sun4/) { - return 'sparc-solaris'; - } - elsif ($arch =~ /.86/) { - return 'x86-solaris'; - } - } - elsif ($os =~ /darwin/) { - return 'universal-macosx'; - } - elsif ($os =~ /freebsd/) { - if($arch =~ /.86/) { - if($vers =~ /6\../ ) { - return 'x86-freebsd-6'; - } - } - elsif( $arch =~ /amd64/) { - if($vers =~ /6\../ ) { - return 'amd64-freebsd-6'; - } - } - } - - return ''; -} - my %platforms = ( A => "AIX", D => "Darwin",