X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=userapps%2Fopensource%2Fnet-snmp%2Fperl%2Fagent%2FMakefile.PL;fp=userapps%2Fopensource%2Fnet-snmp%2Fperl%2Fagent%2FMakefile.PL;h=d9518a0d171188773f083187a9cb4099398776e2;hb=9dffd9f7659a1b28265e0dc9497343eb3d108d02;hp=0000000000000000000000000000000000000000;hpb=e48c2529a5a7e7dbf1797bb6d1bf964bc03e78a7;p=bcm963xx.git diff --git a/userapps/opensource/net-snmp/perl/agent/Makefile.PL b/userapps/opensource/net-snmp/perl/agent/Makefile.PL new file mode 100644 index 00000000..d9518a0d --- /dev/null +++ b/userapps/opensource/net-snmp/perl/agent/Makefile.PL @@ -0,0 +1,83 @@ +use ExtUtils::MakeMaker; +require 5; +use Config; +use Getopt::Long; + +%MakeParams = InitMakeParams(); + +WriteMakefile(%MakeParams); + +sub InitMakeParams { + my $opts; + my %Params = ( + 'NAME' => 'NetSNMP::agent', + 'VERSION_FROM' => 'agent.pm', # finds $VERSION + 'XSPROTOARG' => '-prototypes', + 'PM' => { + 'agent.pm' => '$(INST_LIBDIR)/agent.pm', + 'netsnmp_request_infoPtr.pm' => + '$(INST_LIBDIR)/agent/netsnmp_request_infoPtr.pm' + }, + 'PREREQ_PM' => {}, + ); + + my ($snmp_lib, $snmp_llib, $sep); + if ($Config{'osname'} eq 'MSWin32') { + $snmp_lib = 'libnetsnmp.lib'; + $snmp_link_lib = 'libnetsnmp'; + # XXX fix me + } else { + $opts = NetSNMPGetOpts(); + $Params{'LIBS'} = `$opts->{'nsconfig'} --agent-libs`; + chomp($Params{'LIBS'}); + $Params{'CCFLAGS'} = `$opts->{'nsconfig'} --cflags`; + chomp($Params{'CCFLAGS'}); + $Params{'CCFLAGS'} .= " " . $Config{'ccflags'}; + if ($opts->{'insource'} eq "true") { + $Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ -L../../agent/.libs -L../../agent/ -L../../agent/helpers/.libs -L../../agent/helpers/ " . $Params{'LIBS'}; + $Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'}; +# } else { +# $Params{'PREREQ_PM'} = {'NetSNMP::OID' => '0.1'}; + } + $Params{'CCFLAGS'} =~ s/ -W[-\w]+//g; # ignore developer warnings + if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") { + die "You need to install net-snmp first (I can't find net-snmp-config)"; + } + } + + return(%Params); +} +# common subroutines -- DO NOT EDIT. +# They are imported from the Makefile.subs.pl file +sub NetSNMPGetOpts { + my %ret; + my $rootpath = shift; + $rootpath = "../" if (!$rootpath); + $rootpath .= '/' if ($rootpath !~ /\/$/); + + if ($ENV{'NET-SNMP-CONFIG'} && + $ENV{'NET-SNMP-IN-SOURCE'}) { + # have env vars, pull from there + $ret{'nsconfig'} = $ENV{'NET-SNMP-CONFIG'}; + $ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'}; + } else { + # don't have env vars, pull from command line and put there + GetOptions("NET-SNMP-CONFIG=s" => \$ret{'nsconfig'}, + "NET-SNMP-IN-SOURCE=s" => \$ret{'insource'}); + + if ($ret{'insource'} eq "true" && $ret{'nsconfig'} eq "") { + $ret{'nsconfig'}="sh ROOTPATH../net-snmp-config"; + } elsif ($ret{'nsconfig'} eq "") { + $ret{'nsconfig'}="net-snmp-config"; + } + + $ENV{'NET-SNMP-CONFIG'} = $ret{'nsconfig'}; + $ENV{'NET-SNMP-IN-SOURCE'} = $ret{'insource'}; + } + + $ret{'nsconfig'} =~ s/ROOTPATH/$rootpath/; + + $ret{'rootpath'} = $rootpath; + + \%ret; +}