1 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
2 # the contents of the Makefile that is written.
4 use ExtUtils::MakeMaker;
9 %MakeParams = InitMakeParams();
11 WriteMakefile(%MakeParams);
16 'NAME' => 'NetSNMP::OID',
17 'VERSION_FROM' => 'OID.pm', # finds $VERSION
18 'XSPROTOARG' => '-prototypes',
22 my ($snmp_lib, $snmp_llib, $sep);
23 if ($Config{'osname'} eq 'MSWin32') {
24 $snmp_lib = 'libnetsnmp.lib';
25 $snmp_link_lib = 'libnetsnmp';
29 $opts = NetSNMPGetOpts();
30 $Params{'LIBS'} = `$opts->{'nsconfig'} --libs`;
31 chomp($Params{'LIBS'});
32 $Params{'CCFLAGS'} = `$opts->{'nsconfig'} --cflags`;
33 chomp($Params{'CCFLAGS'});
34 $Params{'CCFLAGS'} .= " " . $Config{'ccflags'};
35 if ($opts->{'insource'} eq "true") {
36 $Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ " . $Params{'LIBS'};
37 $Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
39 # $Params{'PREREQ_PM'} = {'SNMP' => '5.0'};
41 $Params{'CCFLAGS'} =~ s/ -W[-\w]+//g; # ignore developer warnings
42 if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
43 die "You need to install net-snmp first (I can't find net-snmp-config)";
49 # common subroutines -- DO NOT EDIT.
50 # They are imported from the Makefile.subs.pl file
54 $rootpath = "../" if (!$rootpath);
55 $rootpath .= '/' if ($rootpath !~ /\/$/);
57 if ($ENV{'NET-SNMP-CONFIG'} &&
58 $ENV{'NET-SNMP-IN-SOURCE'}) {
59 # have env vars, pull from there
60 $ret{'nsconfig'} = $ENV{'NET-SNMP-CONFIG'};
61 $ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
63 # don't have env vars, pull from command line and put there
64 GetOptions("NET-SNMP-CONFIG=s" => \$ret{'nsconfig'},
65 "NET-SNMP-IN-SOURCE=s" => \$ret{'insource'});
67 if ($ret{'insource'} eq "true" && $ret{'nsconfig'} eq "") {
68 $ret{'nsconfig'}="sh ROOTPATH../net-snmp-config";
69 } elsif ($ret{'nsconfig'} eq "") {
70 $ret{'nsconfig'}="net-snmp-config";
73 $ENV{'NET-SNMP-CONFIG'} = $ret{'nsconfig'};
74 $ENV{'NET-SNMP-IN-SOURCE'} = $ret{'insource'};
77 $ret{'nsconfig'} =~ s/ROOTPATH/$rootpath/;
79 $ret{'rootpath'} = $rootpath;