Debian Codegraph @

perl/default_store/Makefile.PL

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