2004-06-22 06:37:04 +08:00
|
|
|
use ExtUtils::MakeMaker;
|
|
|
|
|
|
|
|
use Config;
|
2007-09-03 08:20:38 +08:00
|
|
|
use lib qw(.. lib);
|
|
|
|
use SigarWrapper ();
|
2004-06-22 06:37:04 +08:00
|
|
|
|
2007-04-10 23:35:04 +08:00
|
|
|
my $installdir;
|
|
|
|
if ($ARGV[0]) {
|
|
|
|
$installdir = $ARGV[0];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
#check binary-dist location and svn source location
|
|
|
|
for (qw(../../sigar-bin ../java/sigar-bin)) {
|
|
|
|
if (-e $_) {
|
|
|
|
$installdir = $_;
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-03 08:20:38 +08:00
|
|
|
SigarWrapper::generate(Perl => '.');
|
2007-04-10 23:35:04 +08:00
|
|
|
|
2007-09-04 03:36:03 +08:00
|
|
|
my $archname = SigarWrapper::archname();
|
|
|
|
my $libname = 'sigar';
|
|
|
|
if ($archname) {
|
|
|
|
$libname .= '-' . $archname;
|
|
|
|
}
|
2004-06-22 06:37:04 +08:00
|
|
|
|
|
|
|
my $ccname = $Config{ccname};
|
|
|
|
|
|
|
|
my $define = {
|
|
|
|
gcc => '-Wall -Werror',
|
|
|
|
cc_r => '-qhalt=w',
|
|
|
|
}->{$ccname} || '';
|
|
|
|
|
|
|
|
WriteMakefile(
|
|
|
|
'NAME' => 'Sigar',
|
|
|
|
'VERSION_FROM' => 'Sigar.pm',
|
2007-09-04 03:36:03 +08:00
|
|
|
'LIBS' => ["-L$installdir/lib -l$libname"],
|
2004-06-22 06:37:04 +08:00
|
|
|
'INC' => "-I$installdir/include",
|
|
|
|
'DEFINE' => $define,
|
|
|
|
'depend' => { 'Sigar.c' => 'Sigar_generated.xs' },
|
|
|
|
);
|