Debian Codegraph @

perl/OID/Makefile.PL

raw
1 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
2 # the contents of the Makefile that is written.
3
4 use strict;
5 use warnings;
6 use ExtUtils::MakeMaker;
7 require 5;
8 use Config;
9 use MakefileSubs;
10
11 my $lib_version;
12
13 WriteMakefile(OidInitMakeParams());
14
15 Check_Version($lib_version);
16
17 sub OidInitMakeParams {
18 my $opts;
19 my %Params = (
20 'NAME' => 'NetSNMP::OID',
21 'VERSION_FROM' => 'OID.pm', # finds $VERSION
22 'XSPROTOARG' => '-prototypes',
23 'PREREQ_PM' => {},
24 );
25
26 AddCommonParams(\%Params);
27
28 my ($snmp_lib, $snmp_llib, $sep);
29
30 $opts = NetSNMPGetOpts();
31
32 if ($Config{'osname'} eq 'MSWin32' && !defined($ENV{'OSTYPE'})) {
33 $sep = '\\';
34 my $snmp_lib_file = 'netsnmp.lib';
35 my $snmp_link_lib = 'netsnmp';
36 my $lib_dir;
37
38 if (lc($opts->{'debug'}) eq "true") {
39 $lib_dir = 'lib\\debug';
40 }
41 else {
42 $lib_dir = 'lib\\release';
43 }
44
45 if (lc($opts->{'insource'}) eq "true") {
46 $Params{'LIBS'} = "-L" . $MakefileSubs::basedir . "\\win32\\$lib_dir\\ -l$snmp_link_lib";
47 }
48 else {
49 my @LibDirs = split($Config{path_sep}, $ENV{LIB});
50 my $LibDir;
51 if ($opts->{'prefix'}) {
52 push (@LibDirs,"$ENV{'NET-SNMP-PATH'}${sep}lib");
53 }
54 my $noLibDir = 1;
55 while ($noLibDir) {
56 $LibDir = find_files(["$snmp_lib_file"],\@LibDirs);
57 if ($LibDir ne '') {
58 $noLibDir = 0;
59 # Put quotes around LibDir to allow spaces in paths
60 $LibDir = '"' . $LibDir . '"';
61 }
62 else
63 {
64 @LibDirs = ();
65 $LibDirs[0] = prompt("The Net-SNMP library ($snmp_lib_file) could not be found.\nPlease enter the directory where it is located:");
66 $LibDirs[0] =~ s/\\$//;
67 }
68 }
69 $Params{LIBS} = "-L$LibDir -l$snmp_link_lib";
70 }
71 }
72 else {
73 $Params{'LIBS'} = `$opts->{'nsconfig'} --libs` or
74 die "net-snmp-config failed\n";
75 chomp($Params{'LIBS'});
76 $lib_version = `$opts->{'nsconfig'} --version` or
77 die "net-snmp-config failed\n";
78 if (lc($opts->{'insource'}) eq "true") {
79 $Params{'LIBS'} =
80 "-L" . abs_path("../../snmplib/.libs") .
81 " -L" . abs_path("../../snmplib") .
82 " " . $Params{'LIBS'};
83 # } else {
84 # $Params{'PREREQ_PM'} = {'SNMP' => '5.0'};
85 }
86 }
87
88 return(%Params);
89 }