~ubuntu-branches/ubuntu/intrepid/net-snmp/intrepid-updates

« back to all changes in this revision

Viewing changes to perl/TrapReceiver/Makefile.PL

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2006-11-28 12:29:34 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20061128122934-82xxzy2zcvypnvy7
Tags: 5.2.3-4ubuntu1
* Merge from debian unstable, remaining changes:
  - remove stop links from rc0 and rc6

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
require 5;
3
3
use Config;
4
4
use Getopt::Long;
 
5
my $lib_version;
5
6
my %MakeParams = ();
6
7
 
7
8
%MakeParams = InitMakeParams();
8
9
 
9
10
WriteMakefile(%MakeParams);
10
11
 
 
12
Check_Version();
 
13
 
11
14
if  (eval {require ExtUtils::Constant; 1}) {
12
15
  # If you edit these definitions to change the constants used by this module,
13
16
  # you will need to use the generated const-c.inc and const-xs.inc
117
120
            $Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
118
121
        }
119
122
 
120
 
        $Params{'CCFLAGS'} =~ s/ -W[-\w]+//g; # ignore developer warnings
 
123
        $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
121
124
        if ($Params{'CCFLAGS'} eq "") {
122
125
            die "You need to install net-snmp first (I can't find net-snmp-config)";
123
126
        }
 
127
        $lib_version = `$opts->{'nsconfig'} --version`;
124
128
    }
125
129
 
126
130
    return(%Params);
132
136
    my $rootpath = shift;
133
137
    $rootpath = "../" if (!$rootpath);
134
138
    $rootpath .= '/' if ($rootpath !~ /\/$/);
135
 
 
 
139
    
136
140
    if (($Config{'osname'} eq 'MSWin32' && $ENV{'OSTYPE'} ne 'msys')) {
137
141
 
138
142
      # Grab command line options first.  Only used if environment variables are not set
158
162
      # Update environment variables in case they are needed
159
163
      $ENV{'NET-SNMP-IN-SOURCE'}    = $ret{'insource'};
160
164
      $ENV{'NET-SNMP-PATH'}         = $ret{'prefix'};
161
 
      $ENV{'NET-SNMP-DEBUG'}        = $ret{'debug'};
 
165
      $ENV{'NET-SNMP-DEBUG'}        = $ret{'debug'};        
162
166
     
163
167
      $basedir = `%COMSPEC% /c cd`;
164
168
      chomp $basedir;
214
218
    }
215
219
}
216
220
 
 
221
 
 
222
sub Check_Version {
 
223
  if (($Config{'osname'} ne 'MSWin32' || $ENV{'OSTYPE'} eq 'msys')) {
 
224
    my $foundversion = 0;
 
225
    return if ($ENV{'NETSNMP_DONT_CHECK_VERSION'});
 
226
    open(I,"<Makefile");
 
227
    while (<I>) {
 
228
        if (/^VERSION = (.*)/) {
 
229
            my $perlver = $1;
 
230
            my $srcver = $lib_version;
 
231
            chomp($srcver);
 
232
            my $srcfloat = floatize_version($srcver);
 
233
            $perlver =~ s/pre/0./;
 
234
            if ($srcfloat ne $perlver) {
 
235
                if (!$foundversion) {
 
236
                    print STDERR "ERROR:
 
237
Net-SNMP installed version: $srcver => $srcfloat
 
238
Perl Module Version:        $perlver
 
239
 
 
240
These versions must match for perfect support of the module.  It is possible
 
241
that different versions may work together, but it is strongly recommended
 
242
that you make these two versions identical.  You can get the Net-SNMP
 
243
source code and the associated perl modules directly from 
 
244
 
 
245
   http://www.net-snmp.org/
 
246
 
 
247
If you want to continue anyway please set the NETSNMP_DONT_CHECK_VERSION
 
248
environmental variable to 1 and re-run the Makefile.PL script.\n";
 
249
                    exit(1);
 
250
                }
 
251
            }
 
252
            $foundversion = 1;
 
253
            last;
 
254
        }
 
255
    }
 
256
    close(I);
 
257
    die "ERROR: Couldn't find version number of this module\n" 
 
258
      if (!$foundversion);
 
259
  }
 
260
}
 
261
 
 
262
sub floatize_version {
 
263
    my ($major, $minor, $patch, $opps) = ($_[0] =~ /^(\d+)\.(\d+)\.?(\d*)\.?(\d*)/);
 
264
    return $major + $minor/100 + $patch/10000 + $opps/100000;
 
265
}