1
use ExtUtils::MakeMaker;
7
%MakeParams = InitMakeParams();
9
WriteMakefile(%MakeParams);
14
'NAME' => 'NetSNMP::agent::default_store',
15
'VERSION_FROM' => 'default_store.pm', # finds $VERSION
16
'XSPROTOARG' => '-prototypes',
19
if ($ENV{'OSTYPE'} eq 'msys') {
20
$Params{'DEFINE'} = "-DMINGW_PERL";
23
my $snmp_lib, $snmp_llib, $sep;
24
if (($Config{'osname'} eq 'MSWin32' && $ENV{'OSTYPE'} ne 'msys')) {
25
$opts = NetSNMPGetOpts();
26
$Params{'DEFINE'} = "-DMSVC_PERL";
28
$snmp_lib_file = 'netsnmp.lib';
29
$snmp_link_lib = 'netsnmp';
31
if (lc($opts->{'debug'}) eq "true") {
32
$lib_dir = 'lib\\debug';
35
$lib_dir = 'lib\\release';
38
if (lc($opts->{'insource'}) eq "true") {
39
$Params{'LIBS'} = "-L$basedir\\win32\\$lib_dir\\ -l$snmp_link_lib";
42
my @LibDirs = split (';',$ENV{LIB});
44
if ($opts->{'prefix'}) {
45
push (@LibDirs,"$ENV{'NET-SNMP-PATH'}${sep}lib");
49
$LibDir = find_files(["$snmp_lib_file"],\@LibDirs);
52
# Put quotes around LibDir to allow spaces in paths
53
$LibDir = '"' . $LibDir . '"';
58
@LibDirs[0] = prompt("The Net-SNMP library ($snmp_lib_file) could not be found.\nPlease enter the directory where it is located:");
59
@LibDirs[0] =~ s/\\$//;
62
$Params{LIBS} = "-L$LibDir -l$snmp_link_lib";
65
$Params{'INC'} = "-I$basedir\\include\\ -I$basedir\\include\\net-snmp\\ -I$basedir\\win32\\ ";
68
$opts = NetSNMPGetOpts("../../");
69
$Params{'LIBS'} = `$opts->{'nsconfig'} --libs`;
70
chomp($Params{'LIBS'});
71
$Params{'CCFLAGS'} = `$opts->{'nsconfig'} --cflags`;
72
chomp($Params{'CCFLAGS'});
73
$Params{'CCFLAGS'} .= " " . $Config{'ccflags'};
74
if ($opts->{'insource'} eq "true") {
75
$Params{'LIBS'} = "-L../../../snmplib/.libs -L../../../snmplib/ " . $Params{'LIBS'};
76
$Params{'CCFLAGS'} = "-I../../../include " . $Params{'CCFLAGS'};
78
$Params{'CCFLAGS'} =~ s/ -W[-\w]+//g; # ignore developer warnings
79
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
80
die "You need to install net-snmp first (I can't find net-snmp-config)";
87
# common subroutines -- DO NOT EDIT.
88
# They are imported from the Makefile.subs.pl file
92
$rootpath = "../" if (!$rootpath);
93
$rootpath .= '/' if ($rootpath !~ /\/$/);
95
if (($Config{'osname'} eq 'MSWin32' && $ENV{'OSTYPE'} ne 'msys')) {
97
# Grab command line options first. Only used if environment variables are not set
98
GetOptions("NET-SNMP-IN-SOURCE=s" => \$ret{'insource'},
99
"NET-SNMP-PATH=s" => \$ret{'prefix'},
100
"NET-SNMP-DEBUG=s" => \$ret{'debug'});
102
if ($ENV{'NET-SNMP-IN-SOURCE'})
104
$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
105
undef ($ret{'prefix'});
107
elsif ($ENV{'NET-SNMP-PATH'})
109
$ret{'prefix'} = $ENV{'NET-SNMP-PATH'};
112
if ($ENV{'NET-SNMP-DEBUG'})
114
$ret{'debug'} = $ENV{'NET-SNMP-DEBUG'};
117
# Update environment variables in case they are needed
118
$ENV{'NET-SNMP-IN-SOURCE'} = $ret{'insource'};
119
$ENV{'NET-SNMP-PATH'} = $ret{'prefix'};
120
$ENV{'NET-SNMP-DEBUG'} = $ret{'debug'};
122
$basedir = `%COMSPEC% /c cd`;
124
$basedir =~ /(.*?)\\perl.*/;
126
print "Net-SNMP base directory: $basedir\n";
131
if ($ENV{'NET-SNMP-CONFIG'} &&
132
$ENV{'NET-SNMP-IN-SOURCE'}) {
133
# have env vars, pull from there
134
$ret{'nsconfig'} = $ENV{'NET-SNMP-CONFIG'};
135
$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
137
# don't have env vars, pull from command line and put there
138
GetOptions("NET-SNMP-CONFIG=s" => \$ret{'nsconfig'},
139
"NET-SNMP-IN-SOURCE=s" => \$ret{'insource'});
141
if (lc($ret{'insource'}) eq "true" && $ret{'nsconfig'} eq "") {
142
$ret{'nsconfig'}="sh ROOTPATH../net-snmp-config";
143
} elsif ($ret{'nsconfig'} eq "") {
144
$ret{'nsconfig'}="net-snmp-config";
147
$ENV{'NET-SNMP-CONFIG'} = $ret{'nsconfig'};
148
$ENV{'NET-SNMP-IN-SOURCE'} = $ret{'insource'};
152
$ret{'nsconfig'} =~ s/ROOTPATH/$rootpath/;
154
$ret{'rootpath'} = $rootpath;
161
my ($dir,$found,$file);
165
$found++ if -f "$dir/$file";