~ubuntu-branches/ubuntu/trusty/net-snmp/trusty

« back to all changes in this revision

Viewing changes to win32/Configure

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2004-09-13 12:06:21 UTC
  • Revision ID: james.westby@ubuntu.com-20040913120621-g952ntonlleihcvm
Tags: upstream-5.1.1
ImportĀ upstreamĀ versionĀ 5.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
3
# Configure script for Net-SNMP and MSVC
 
4
# Written by Alex Burger
 
5
# March 5th, 2004
 
6
#
 
7
use Getopt::Long;
 
8
 
 
9
my $config;
 
10
my $sdk = 0;
 
11
my $linktype;
 
12
my $prefix;
 
13
my $openssl = 0;
 
14
my $help = 0;
 
15
 
 
16
GetOptions      ('config=s' => \$config,
 
17
                 'with-sdk' => \$sdk,
 
18
                 'linktype=s' => \$linktype,
 
19
                 'destdir=s' => \$prefix,
 
20
                 'prefix=s' => \$prefix,
 
21
                 'with-ssl' => \$openssl,
 
22
                 'help' => \$help);
 
23
 
 
24
if ($help == 1)
 
25
{
 
26
$USAGE = qq/
 
27
Usage:
 
28
    perl Configure [<options>] 
 
29
    
 
30
Options:
 
31
 
 
32
    --config=[release | debug]       Compile as release or with debug symbols
 
33
    --with-sdk                       Link against MS Platform SDK
 
34
    --linktype=[static | dynamic]    Build static or dynamic (DLL)
 
35
    --prefix=\"path\"                  Set INSTALL_BASE path (install path)
 
36
    --destdir=\"path\"                 Same as --prefix
 
37
    --with-ssl                       Link against OpenSSL
 
38
    --help                           This help screen
 
39
/;
 
40
 
 
41
  print $USAGE;
 
42
 
 
43
  exit(0);
 
44
 
 
45
}
 
46
               
 
47
$config = lc($config);  
 
48
if (($config ne "debug") && ($config ne "release")) {
 
49
  $config = "release";
 
50
}
 
51
 
 
52
$linktype = lc($linktype);              
 
53
if (($linktype ne "static") && ($linktype ne "dynamic")) {
 
54
  $linktype = "static";
 
55
}
 
56
 
 
57
if ($prefix eq "") {
 
58
  $prefix = "c:/usr";
 
59
}
 
60
 
 
61
# Make sure prefix only contains forward slashes
 
62
$prefix =~ s/\\/\//g;
 
63
 
 
64
$prefixdos = "\"$prefix\"";
 
65
# Make sure prefixdos only contains backward slashes
 
66
$prefixdos =~ s/\//\\/g;
 
67
 
 
68
print "\n\n";
 
69
 
 
70
###############################################
 
71
#
 
72
# Create main Makefile
 
73
#
 
74
###############################################
 
75
{  
 
76
  my $makefile_out = "Makefile";
 
77
  my $makefile_in  = "Makefile.in";
 
78
 
 
79
  open (MAKE_OUT, ">$makefile_out") || die "Can't Open $makefile_out\n";
 
80
  open (MAKE_IN, "<$makefile_in") || die "Can't Open $makefile_in\n";
 
81
 
 
82
  print "creating $makefile_out\n";
 
83
  
 
84
  while (<MAKE_IN>)
 
85
  {
 
86
    chomp;
 
87
    if ($sdk == 1) {
 
88
      s/^SDK=/SDK=true/;
 
89
    }
 
90
    else {
 
91
      s/^SDK=/SDK=false/;
 
92
    }
 
93
    
 
94
    s/^LINKTYPE=/LINKTYPE=$linktype/;
 
95
    s/^CFG=/CFG=$config/;
 
96
    s/^PREFIX=/PREFIX=$prefix/;    
 
97
    s/^PREFIX_DOS=/PREFIX_DOS=$prefixdos/;    
 
98
    s/^SSL=.*/SSL=$openssl/;
 
99
 
 
100
    print MAKE_OUT $_ . "\n";
 
101
  }
 
102
}
 
103
 
 
104
###############################################
 
105
#
 
106
# Create Makefiles for applications from 
 
107
# Makefile-apps.in
 
108
# (except for snmpnetstat)
 
109
#
 
110
###############################################
 
111
my @programs = qw 
 
112
/encode_keychange
 
113
snmpbulkget
 
114
snmpbulkwalk
 
115
snmpdelta
 
116
snmpdf
 
117
snmpget
 
118
snmpgetnext
 
119
snmpset
 
120
snmpstatus
 
121
snmptable
 
122
snmptest
 
123
snmptranslate
 
124
snmptrap
 
125
snmpusm
 
126
snmpvacm
 
127
snmpwalk
 
128
/;
 
129
 
 
130
foreach my $progName (@programs) {
 
131
  
 
132
  my $makefile_out = "$progName\\Makefile";
 
133
  my $makefile_in = "Makefile-apps.in";
 
134
 
 
135
  my $outdir = $config;
 
136
  my $intdir = $config;
 
137
  
 
138
  open (MAKE_OUT, ">$makefile_out") || die "Can't Open $makefile_out\n";
 
139
  open (MAKE_IN, "<$makefile_in") || die "Can't Open $makefile_in\n";
 
140
 
 
141
  print "creating $makefile_out\n";
 
142
  
 
143
  while (<MAKE_IN>)
 
144
  {
 
145
    chomp;
 
146
    
 
147
    s/^LINKTYPE=/LINKTYPE=$linktype/;
 
148
    s/^PROGNAME=/PROGNAME=$progName/;
 
149
    s/^CFG=/CFG=$config/;
 
150
    s/^OUTDIR=/OUTDIR=.\\$outdir/;
 
151
    s/^INTDIR=/INTDIR=.\\$intdir/;
 
152
    s/^SSL=.*/SSL=$openssl/;
 
153
 
 
154
    print MAKE_OUT $_ . "\n";
 
155
  }
 
156
}
 
157
 
 
158
###############################################
 
159
#
 
160
# Create Makefiles for snmpnetstat from
 
161
# snmpnetstat\Makefile.in
 
162
#
 
163
###############################################
 
164
my @programs = qw 
 
165
/snmpnetstat
 
166
/;
 
167
 
 
168
foreach my $progName (@programs) {
 
169
  
 
170
  my $makefile_out = "$progName\\Makefile";
 
171
  my $makefile_in = "$progName\\Makefile.in";
 
172
 
 
173
  my $outdir = $config;
 
174
  my $intdir = $config;
 
175
  
 
176
  open (MAKE_OUT, ">$makefile_out") || die "Can't Open $makefile_out\n";
 
177
  open (MAKE_IN, "<$makefile_in") || die "Can't Open $makefile_in\n";
 
178
 
 
179
  print "creating $makefile_out\n";
 
180
  
 
181
  while (<MAKE_IN>)
 
182
  {
 
183
    chomp;
 
184
 
 
185
    s/^LINKTYPE=/LINKTYPE=$linktype/;    
 
186
    s/^PROGNAME=/PROGNAME=$progName/;
 
187
    s/^CFG=/CFG=$config/;
 
188
    s/^OUTDIR=/OUTDIR=.\\$outdir/;
 
189
    s/^INTDIR=/INTDIR=.\\$intdir/;
 
190
    s/^SSL=.*/SSL=$openssl/;
 
191
 
 
192
    print MAKE_OUT $_ . "\n";
 
193
  }
 
194
}
 
195
 
 
196
 
 
197
###############################################
 
198
#
 
199
# Create Makefiles for libraries  
 
200
# from name\Makefile.in
 
201
#
 
202
###############################################
 
203
my @programs = qw 
 
204
/libagent
 
205
libhelpers
 
206
/;
 
207
 
 
208
if ($sdk == 1) {
 
209
  push (@programs, "netsnmpmibssdk");
 
210
}
 
211
else {
 
212
  push (@programs, "netsnmpmibs");
 
213
}
 
214
 
 
215
if ($linktype eq "dynamic") {
 
216
  push (@programs, "libsnmp_dll");
 
217
}
 
218
else {
 
219
  push (@programs, "libsnmp");
 
220
}
 
221
 
 
222
foreach my $progName (@programs) {
 
223
  
 
224
  my $makefile_out = "$progName\\Makefile";
 
225
  my $makefile_in = "$progName\\Makefile.in";
 
226
  
 
227
  my $outdir = $config;
 
228
  my $intdir = $config;
 
229
  
 
230
  open (MAKE_OUT, ">$makefile_out") || die "Can't Open $makefile_out\n";
 
231
  open (MAKE_IN, "<$makefile_in") || die "Can't Open $makefile_in\n";
 
232
 
 
233
  print "creating $makefile_out\n";
 
234
  
 
235
  while (<MAKE_IN>)
 
236
  {
 
237
    chomp;
 
238
    
 
239
    s/^PROGNAME=/PROGNAME=$progName/;
 
240
    s/^CFG=/CFG=$config/;
 
241
    s/^OUTDIR=/OUTDIR=.\\$outdir/;
 
242
    s/^INTDIR=/INTDIR=.\\$intdir/;
 
243
    s/^SSL=.*/SSL=$openssl/;
 
244
 
 
245
    print MAKE_OUT $_ . "\n";
 
246
  }
 
247
}
 
248
 
 
249
###############################################
 
250
#
 
251
# Create Makefiles for daemons
 
252
# from name\Makefile.in
 
253
#
 
254
###############################################
 
255
my @programs = qw 
 
256
/snmptrapd
 
257
/;
 
258
 
 
259
if ($sdk == 1) {
 
260
  push (@programs, "snmpdsdk");
 
261
}
 
262
else {
 
263
  push (@programs, "snmpd");
 
264
}
 
265
 
 
266
foreach my $progName (@programs) {
 
267
  
 
268
  my $makefile_out = "$progName\\Makefile";
 
269
  my $makefile_in = "$progName\\Makefile.in";
 
270
  
 
271
  my $outdir = $config;
 
272
  my $intdir = $config;
 
273
  
 
274
  open (MAKE_OUT, ">$makefile_out") || die "Can't Open $makefile_out\n";
 
275
  open (MAKE_IN, "<$makefile_in") || die "Can't Open $makefile_in\n";
 
276
 
 
277
  print "creating $makefile_out\n";
 
278
  
 
279
  while (<MAKE_IN>)
 
280
  {
 
281
    chomp;
 
282
    
 
283
    s/^LINKTYPE=/LINKTYPE=$linktype/;
 
284
    s/^PROGNAME=/PROGNAME=$progName/;
 
285
    s/^CFG=/CFG=$config/;
 
286
    s/^OUTDIR=/OUTDIR=.\\$outdir/;
 
287
    s/^INTDIR=/INTDIR=.\\$intdir/;
 
288
    s/^SSL=.*/SSL=$openssl/;
 
289
 
 
290
    print MAKE_OUT $_ . "\n";
 
291
  }
 
292
}
 
293
 
 
294
###############################################
 
295
#
 
296
# Create net-snmp-config.h
 
297
#
 
298
###############################################
 
299
{
 
300
  my $file_out = "net-snmp\\net-snmp-config.h";
 
301
  my $file_in = "net-snmp\\net-snmp-config.h.in";
 
302
 
 
303
  open (FILE_OUT, ">$file_out") || die "Can't Open $file_out\n";
 
304
  open (FILE_IN, "<$file_in") || die "Can't Open $file_in\n";
 
305
  
 
306
  print "creating $file_out\n";
 
307
 
 
308
  while (<FILE_IN>)
 
309
  {
 
310
    chomp;
 
311
 
 
312
    if ($prefix ne "") {
 
313
      s/^#define INSTALL_BASE.*/#define INSTALL_BASE \"$prefix\"/;
 
314
    }
 
315
    if ($linktype eq "dynamic") {
 
316
      s/^#undef NETSNMP_USE_DLL.*/#define NETSNMP_USE_DLL 1/;
 
317
    }
 
318
    if ($openssl == 1) {
 
319
      s/^#undef USE_OPENSSL.*/#define USE_OPENSSL 1/;
 
320
    }
 
321
 
 
322
    print FILE_OUT $_ . "\n";
 
323
  }
 
324
}
 
325
 
 
326
print qq/
 
327
---------------------------------------------------------
 
328
            Net-SNMP configuration summary:
 
329
---------------------------------------------------------
 
330
 
 
331
/;
 
332
 
 
333
print "  Config type:                $config\n";
 
334
print "  SDK:                        " . ($sdk == 1 ? "enabled" : "disabled") . "\n";
 
335
print "  Link type:                  $linktype\n";
 
336
print "  Prefix / Destdir:           " . ($prefix ne "" ? $prefix : "(default)") . "\n";
 
337
print "  OpenSSL:                    " . ($openssl == 1 ? "enabled" : "disabled") . "\n";
 
338
 
 
339
if ($ENV{INCLUDE} eq "") {
 
340
  print "\n\nVisual Studio environment not detected.  Please run VCVARS32.BAT before\n";
 
341
  print "running nmake\n\n";
 
342
}
 
343