1 use ExtUtils::MakeMaker;
6 %MakeParams = InitMakeParams();
8 WriteMakefile(%MakeParams);
13 'NAME' => 'NetSNMP::agent',
14 'VERSION_FROM' => 'agent.pm', # finds $VERSION
15 'XSPROTOARG' => '-prototypes',
17 'agent.pm' => '$(INST_LIBDIR)/agent.pm',
18 'netsnmp_request_infoPtr.pm' =>
19 '$(INST_LIBDIR)/agent/netsnmp_request_infoPtr.pm'
24 my ($snmp_lib, $snmp_llib, $sep);
25 if ($Config{'osname'} eq 'MSWin32') {
26 $snmp_lib = 'libnetsnmp.lib';
27 $snmp_link_lib = 'libnetsnmp';
30 $opts = NetSNMPGetOpts();
31 $Params{'LIBS'} = `$opts->{'nsconfig'} --agent-libs`;
32 chomp($Params{'LIBS'});
33 $Params{'CCFLAGS'} = `$opts->{'nsconfig'} --cflags`;
34 chomp($Params{'CCFLAGS'});
35 $Params{'CCFLAGS'} .= " " . $Config{'ccflags'};
36 if ($opts->{'insource'} eq "true") {
37 $Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ -L../../agent/.libs -L../../agent/ -L../../agent/helpers/.libs -L../../agent/helpers/ " . $Params{'LIBS'};
38 $Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
40 # $Params{'PREREQ_PM'} = {'NetSNMP::OID' => '0.1'};
42 $Params{'CCFLAGS'} =~ s/ -W[-\w]+//g; # ignore developer warnings
43 if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
44 die "You need to install net-snmp first (I can't find net-snmp-config)";
50 # common subroutines -- DO NOT EDIT.
51 # They are imported from the Makefile.subs.pl file
55 $rootpath = "../" if (!$rootpath);
56 $rootpath .= '/' if ($rootpath !~ /\/$/);
58 if ($ENV{'NET-SNMP-CONFIG'} &&
59 $ENV{'NET-SNMP-IN-SOURCE'}) {
60 # have env vars, pull from there
61 $ret{'nsconfig'} = $ENV{'NET-SNMP-CONFIG'};
62 $ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
64 # don't have env vars, pull from command line and put there
65 GetOptions("NET-SNMP-CONFIG=s" => \$ret{'nsconfig'},
66 "NET-SNMP-IN-SOURCE=s" => \$ret{'insource'});
68 if ($ret{'insource'} eq "true" && $ret{'nsconfig'} eq "") {
69 $ret{'nsconfig'}="sh ROOTPATH../net-snmp-config";
70 } elsif ($ret{'nsconfig'} eq "") {
71 $ret{'nsconfig'}="net-snmp-config";
74 $ENV{'NET-SNMP-CONFIG'} = $ret{'nsconfig'};
75 $ENV{'NET-SNMP-IN-SOURCE'} = $ret{'insource'};
78 $ret{'nsconfig'} =~ s/ROOTPATH/$rootpath/;
80 $ret{'rootpath'} = $rootpath;