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