~ubuntu-branches/ubuntu/wily/net-snmp/wily-proposed

« back to all changes in this revision

Viewing changes to .pc/44_nlist_kvm.patch/configure.in

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-06-28 14:59:36 UTC
  • mfrom: (1.2.3 upstream) (1.1.12 sid)
  • Revision ID: james.westby@ubuntu.com-20100628145936-cbiallic69pn044g
Tags: 5.4.3~dfsg-1ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Set Ubuntu maintainer address.
  - net-snmp-config: Use bash. (LP: #104738)
  - Removed multiuser option when calling update-rc.d. (LP: #254261)
  - debian/snmpd.init: LSBify the init script.
  - debian/patches/52_fix_snmpcmd_1_typo.patch: Adjust a typo in snmpcmd.1
    (LP: #250459)
  - debian/snmpd.postinst: source debconf before doing work, LP: #589056
  - debian/snmp.preinst, debian/snmp.prerm: kill any/all processes owned by
    snmp user before install/uninstall, LP: #573391
  - Add apport hook (LP: #533603):
  - debian/{snmp,snmpd}.apport: Added.
  - debian/control: Build-depends on dh-apport.
  - debian/rules: 
    + Add --with apport.
    + override_dh_apport to install hook on snmpd package only.
 * Dropped patches:
   - debian/patches/99-fix-ubuntu-div0.patch: Fix dvision by zero.. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Portions of this file are subject to the following copyright.  See
 
2
# the Net-SNMP's COPYING file for more details and other copyrights
 
3
# that may apply:
 
4
#
 
5
# Portions Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
 
6
# Use is subject to license terms specified in the COPYING file
 
7
# distributed with the Net-SNMP package.
 
8
#
 
9
 
 
10
#
 
11
# Process this file with autoconf to produce a configure script.
 
12
#
 
13
AC_INIT([Net-SNMP], [5.4.3], [net-snmp-coders@lists.sourceforge.net])
 
14
AC_PREREQ([2.59])
 
15
AC_CONFIG_SRCDIR([agent/mibgroup/ucd-snmp/extensible.c])
 
16
AC_REVISION([$Revision: 18816 $])
 
17
 
 
18
AC_CONFIG_HEADER(include/net-snmp/net-snmp-config.h)
 
19
 
 
20
AC_MSG_CACHE_INIT()
 
21
 
 
22
#
 
23
# save the configure arguments
 
24
#
 
25
AC_DEFINE_UNQUOTED(NETSNMP_CONFIGURE_OPTIONS,"$ac_configure_args")
 
26
CONFIGURE_OPTIONS="\"$ac_configure_args"\"
 
27
AC_SUBST(CONFIGURE_OPTIONS)
 
28
 
 
29
#
 
30
# Compilation setup
 
31
#
 
32
AC_ARG_WITH(cc, [
 
33
Compiler Options:
 
34
  --with-cc=CC                    use CC to compile (default=gcc).],
 
35
    [CC=$with_cc;export CC])
 
36
 
 
37
AC_ARG_WITH(linkcc, [
 
38
  --with-linkcc=CC                use CC to link (default=gcc).],
 
39
    [LINKCC=$with_linkcc;export LINKCC])
 
40
 
 
41
AC_ARG_WITH(ar,
 
42
[  --with-ar=AR                    use AR as the archiver.],
 
43
    [AR=$with_ar; export AR])
 
44
 
 
45
AC_ARG_WITH(endianness,
 
46
[  --with-endianness=big|little    define endianness of target platform when
 
47
                                  cross-compiling.],
 
48
    [if test $with_endianness != "big" -a $with_endianness != "little" ; then
 
49
       AC_MSG_ERROR([Endianness must be big or little, not "$with_endianness".]);
 
50
     fi
 
51
])
 
52
 
 
53
AC_ARG_WITH(cflags,
 
54
[  --with-cflags=CFLAGS            use CFLAGS as compile time arguments.],
 
55
    [CFLAGS=$with_cflags; export CFLAGS])
 
56
 
 
57
AC_ARG_WITH(ldflags,
 
58
[  --with-ldflags=LDFLAGS          use LDFLAGS as link time arguments to ld.],
 
59
    [LDFLAGS=$with_ldflags; export LDFLAGS])
 
60
 
 
61
AC_ARG_ENABLE(as-needed,
 
62
[  --enable-as-needed              Link libperl against Net-SNMP libraries 
 
63
                                  rather than applications. We recommend to
 
64
                                  use this option if it works.])
 
65
 
 
66
AC_ARG_WITH(libs,
 
67
[  --with-libs=LIBS                use LIBS as link time arguments to ld.],
 
68
    [LIBS=$with_libs; export LIBS])
 
69
 
 
70
AC_ARG_ENABLE(silent-libtool,
 
71
[  --enable-silent-libtool         Pass --silent to libtool.],
 
72
        LIBTOOLFLAGS=--silent)
 
73
AC_SUBST(LIBTOOLFLAGS)
 
74
 
 
75
AC_ARG_WITH(install-prefix,
 
76
[  --with-install-prefix=PATH      Just for installing, prefix all 
 
77
                                  directories with PATH.  This is known not
 
78
                                  to work on some systems with shared
 
79
                                  libraries (eg, HPUX)],
 
80
      INSTALL_PREFIX="$withval")
 
81
 
 
82
if test "x$INSTALL_PREFIX" = "xyes" ; then
 
83
  AC_MSG_ERROR([--with-install-prefix requires an argument])
 
84
fi
 
85
if test "x$INSTALL_PREFIX" = "xno" ; then
 
86
  INSTALL_PREFIX=""
 
87
fi
 
88
AC_SUBST(INSTALL_PREFIX)
 
89
 
 
90
# check for errors in args that run after module processing here, so
 
91
# they fail before module processing...
 
92
AC_ARG_ENABLE(libwrap,,
 
93
        AC_MSG_ERROR([ Invalid option. Use --with-libwrap/--without-libwrap instead ]) )
 
94
  AC_ARG_ENABLE(zlib,,
 
95
        AC_MSG_ERROR([ Invalid option. Use --with-zlib/--without-zlib instead ]) )
 
96
 
 
97
AC_ARG_ENABLE(mini_agent,
 
98
[  --enable-mini-agent             Build a minimal agent.])
 
99
if test "x$enable_mini_agent" = "xyes"; then
 
100
    mini_agent="yes"
 
101
else
 
102
    mini_agent="no"
 
103
fi
 
104
AC_ARG_WITH(mini_agent,,
 
105
         AC_MSG_ERROR([ Invalid option. Use --enable-mini-agent/--disable-mini-agent instead ]) )
 
106
AC_ARG_WITH(miniagent,,
 
107
         AC_MSG_ERROR([ Invalid option. Use --enable-mini-agent/--disable-mini-agent instead ]) )
 
108
AC_ARG_ENABLE(miniagent,,
 
109
         AC_MSG_ERROR([ Invalid option. Use --enable-mini-agent/--disable-mini-agent instead ]) )
 
110
 
 
111
AC_ARG_ENABLE(agent,
 
112
[  --disable-agent                 Do not build the agent (snmpd).])
 
113
if test "x$enable_agent" != "xno"; then
 
114
   SNMPD='snmpd$(EXEEXT)'
 
115
   MAINSUBS="$MAINSUBS agent"
 
116
   TRAPLIBS='$(TRAPDWITHAGENT)'
 
117
   USETRAPLIBS='$(USEAGENTLIBS)'
 
118
else
 
119
   SNMPD=""
 
120
   # we still need/want the agentlibs (for subagents, e.g. snmptrapd)
 
121
   MAINSUBS="$MAINSUBS agent"
 
122
   # building snmptrapd w/o agentlibs doesn't work atm
 
123
   #TRAPLIBS='$(TRAPDWITHOUTAGENT)'
 
124
   #USETRAPLIBS='$(USELIBS)'
 
125
   TRAPLIBS='$(TRAPDWITHAGENT)'
 
126
   USETRAPLIBS='$(USEAGENTLIBS)'
 
127
fi
 
128
AC_SUBST(SNMPD)
 
129
AC_SUBST(TRAPLIBS)
 
130
AC_SUBST(USETRAPLIBS)
 
131
AC_ARG_WITH(agent,,
 
132
         AC_MSG_ERROR([ Invalid option. Use --enable-agent/--disable-agent instead ]) )
 
133
 
 
134
AC_ARG_ENABLE(applications,
 
135
[  --disable-applications          Do not build the apps (snmpget, ...).])
 
136
if test "x$enable_applications" != "xno"; then
 
137
   MAINSUBS="$MAINSUBS apps"
 
138
fi
 
139
# Common mistakes
 
140
AC_ARG_WITH(applications,,
 
141
        AC_MSG_ERROR([ Invalid option. Use --enable-applications/--disable-applications instead ]) )
 
142
 
 
143
AC_ARG_ENABLE(manuals,
 
144
[  --disable-manuals               Do not install the manuals.])
 
145
if test "x$enable_manuals" != "xno"; then
 
146
   MAINSUBS="$MAINSUBS man"
 
147
fi
 
148
AC_ARG_WITH(manuals,,
 
149
        AC_MSG_ERROR([ Invalid option. Use --enable-manuals/--disable-manuals instead ]) )
 
150
 
 
151
AC_ARG_ENABLE(scripts,
 
152
[  --disable-scripts               Do not install the scripts (mib2c, ...).])
 
153
if test "x$enable_scripts" != "xno"; then
 
154
   MAINSUBS="$MAINSUBS local"
 
155
fi
 
156
AC_ARG_WITH(scripts,,
 
157
        AC_MSG_ERROR([ Invalid option. Use --enable-scripts/--disable-scripts instead ]) )
 
158
 
 
159
AC_ARG_ENABLE(mibs,
 
160
[  --disable-mibs                  Do not install the mib files.])
 
161
if test "x$enable_mibs" != "xno"; then
 
162
   MAINSUBS="$MAINSUBS mibs"
 
163
fi
 
164
# with-mibs is valid too, but means something else
 
165
 
 
166
AC_SUBST(MAINSUBS)
 
167
AC_MSG_CHECKING([what to build and install])
 
168
AC_MSG_RESULT([$MAINSUBS])
 
169
 
 
170
AC_ARG_ENABLE(mib-loading,
 
171
[  --disable-mib-loading           Do not include code that parses and 
 
172
                                  manipulates the mib files.])
 
173
if test "x$enable_mib_loading" = "xno"; then
 
174
  AC_DEFINE([NETSNMP_DISABLE_MIB_LOADING], 1, 
 
175
            [Define if mib loading and parsing code should not be included])
 
176
fi
 
177
AC_ARG_WITH(mib-loading,,
 
178
        AC_MSG_ERROR([ Invalid option. Use --enable-mib-loading/--disable-mib-loading instead ]) )
 
179
 
 
180
#
 
181
SNMP_VERSIONS=""
 
182
AC_ARG_ENABLE(snmpv1,
 
183
[  --disable-snmpv1                Do not include code that implements SNMPv1.])
 
184
if test "x$enable_snmpv1" = "xno"; then
 
185
  AC_DEFINE([NETSNMP_DISABLE_SNMPV1], 1, 
 
186
            [Define if SNMPv1 code should not be included])
 
187
else
 
188
  SNMP_VERSIONS="$SNMP_VERSIONS 1"
 
189
fi
 
190
AC_ARG_WITH(snmpv1,,
 
191
        AC_MSG_ERROR([ Invalid option. Use --enable-snmpv1/--disable-snmpv1 instead ]) )
 
192
 
 
193
AC_ARG_ENABLE(snmpv2c,
 
194
[  --disable-snmpv2c               Do not include code that implements SNMPv2c.])
 
195
if test "x$enable_snmpv2c" = "xno"; then
 
196
  AC_DEFINE([NETSNMP_DISABLE_SNMPV2C], 1, 
 
197
            [Define if SNMPv2c code should not be included])
 
198
else
 
199
  SNMP_VERSIONS="$SNMP_VERSIONS 2c"
 
200
fi
 
201
AC_ARG_WITH(snmpv2c,,
 
202
        AC_MSG_ERROR([ Invalid option. Use --enable-snmpv2c/--disable-snmpv2c instead ]) )
 
203
 
 
204
SNMP_VERSIONS="$SNMP_VERSIONS 3"
 
205
AC_MSG_CACHE_ADD(SNMP Versions Supported:   $SNMP_VERSIONS)
 
206
 
 
207
AC_ARG_ENABLE(set-support,
 
208
[  --disable-set-support           Do not allow SNMP set requests.])
 
209
if test "x$enable_set_support" = "xno"; then
 
210
  AC_DEFINE([NETSNMP_DISABLE_SET_SUPPORT], 1, 
 
211
            [Define if SNMP SET support should be disabled])
 
212
fi
 
213
AC_ARG_WITH(set-support,,
 
214
        AC_MSG_ERROR([ Invalid option. Use --enable-set-support/--disable-set-support instead ]) )
 
215
 
 
216
AC_ARG_ENABLE(des,
 
217
[  --disable-des                   Do not support DES encryption.])
 
218
if test "x$enable_des" = "xno"; then
 
219
  AC_DEFINE([NETSNMP_DISABLE_DES], 1, 
 
220
            [Define if DES encryption should not be supported])
 
221
fi
 
222
AC_ARG_WITH(des,,
 
223
        AC_MSG_ERROR([ Invalid option. Use --enable-des/--disable-des instead ]) )
 
224
 
 
225
AC_ARG_ENABLE(privacy,
 
226
[  --disable-privacy               Don't compile in support for privacy (encryption).])
 
227
if test "x$enable_privacy" != "xno"; then
 
228
  AC_DEFINE(NETSNMP_ENABLE_SCAPI_AUTHPRIV)
 
229
fi
 
230
AC_ARG_WITH(privacy,,
 
231
        AC_MSG_ERROR([ Invalid option. Use --enable-privacy/--disable-privacy instead ]) )
 
232
 
 
233
AC_ARG_ENABLE(md5,
 
234
[  --disable-md5                   Do not support MD5 authentication.])
 
235
if test "x$enable_md5" = "xno"; then
 
236
  AC_DEFINE([NETSNMP_DISABLE_MD5], 1, 
 
237
            [Define if MD5 authentication should not be supported])
 
238
fi
 
239
AC_ARG_WITH(md5,,
 
240
        AC_MSG_ERROR([ Invalid option. Use --enable-md5/--disable-md5 instead ]) )
 
241
 
 
242
AC_ARG_ENABLE(internal-md5,
 
243
[  --enable-internal-md5           Use the internal MD5 support.])
 
244
if test "x$enable_internal_md5" = "xyes"; then
 
245
  if test "x$enable_md5" = "xno"; then
 
246
    AC_MSG_ERROR(You can not specify both --enable-internal-md5 and --disable-md5)
 
247
  else
 
248
    AC_DEFINE(NETSNMP_USE_INTERNAL_MD5)
 
249
  fi
 
250
fi
 
251
AC_ARG_WITH(internal-md5,,
 
252
        AC_MSG_ERROR([ Invalid option. Use --enable-internal-md5/--disable-internal-md5 instead ]) )
 
253
 
 
254
AC_ARG_ENABLE(ipv6,
 
255
[  --enable-ipv6                   Generate IPv6 ready version.],
 
256
    [if test "x$enable_ipv6" = "xyes"; then
 
257
      AC_DEFINE(NETSNMP_ENABLE_IPV6)
 
258
    fi])
 
259
AC_ARG_WITH(ipv6,,
 
260
        AC_MSG_ERROR([ Invalid option. Use --enable-ipv6/--disable-ipv6 instead ]) )
 
261
 
 
262
AC_ARG_ENABLE(local-smux,
 
263
[  --enable-local-smux             Restrict SMUX connections to localhost (by default).],
 
264
    [if test "x$enable_local_smux" = "xyes"; then
 
265
      AC_DEFINE(NETSNMP_ENABLE_LOCAL_SMUX)
 
266
    fi])
 
267
AC_ARG_WITH(local-smux,,
 
268
        AC_MSG_ERROR([ Invalid option. Use --enable-local-smux/--disable-local-smux instead ]) )
 
269
 
 
270
AC_ARG_ENABLE(debugging,
 
271
[  --enable-debugging              Outputs extra debugging information at all
 
272
                                  times.  Normally, you should not enable this,
 
273
                                  but instead use the -D flag of the commands,
 
274
                                  which toggles debuging output at runtime.
 
275
  --disable-debugging             Disallows debugging code to be built in.
 
276
                                  This might provide some speed benefits.],
 
277
    AC_DEFINE(NETSNMP_ALWAYS_DEBUG))
 
278
AC_ARG_WITH(debugging,,
 
279
        AC_MSG_ERROR([ Invalid option. Use --enable-debugging/--disable-debugging instead ]) )
 
280
 
 
281
AC_ARG_ENABLE(developer,
 
282
[  --enable-developer              Turns on super-duper-extra-compile-warnings
 
283
                                  when using gcc.],
 
284
    developer=yes)
 
285
AC_ARG_WITH(developer,,
 
286
        AC_MSG_ERROR([ Invalid option. Use --enable-developer/--disable-developer instead ]) )
 
287
 
 
288
if test "x$enable_debugging" = "xno"; then
 
289
    AC_DEFINE(NETSNMP_NO_DEBUGGING)
 
290
fi
 
291
 
 
292
AC_ARG_WITH(dmalloc,
 
293
[  --with-dmalloc=PATH             Use dmalloc library (www.dmalloc.com)],
 
294
    if test "x$withval" = "xyes"; then
 
295
      LIBS="$LIBS -ldmalloc"
 
296
      AC_DEFINE(HAVE_DMALLOC_H)
 
297
    elif test -d "$withval"; then
 
298
      AC_ADD_SEARCH_PATH($withval)
 
299
      LIBS="$LIBS -ldmalloc"
 
300
      AC_DEFINE(HAVE_DMALLOC_H)
 
301
    fi
 
302
)
 
303
AC_SUBST(HAVE_DMALLOC_H)
 
304
AC_ARG_ENABLE(dmalloc,,
 
305
        AC_MSG_ERROR([ Invalid option. Use --with-dmalloc/--without-dmalloc instead ]) )
 
306
 
 
307
AC_ARG_WITH(efence,
 
308
[  --with-efence                   Look for and use libefence (malloc).],
 
309
      use_efence="$withval")
 
310
AC_ARG_ENABLE(efence,,
 
311
        AC_MSG_ERROR([ Invalid option. Use --with-efence/--without-efence instead ]) )
 
312
 
 
313
tryrsaref=no
 
314
AC_ARG_WITH(rsaref,
 
315
[  --with-rsaref=PATH              Look for librsaref in PATH/lib.],
 
316
    if test "x$withval" = "xyes"; then
 
317
      tryrsaref=yes
 
318
    elif test "x$withval" = "xno"; then
 
319
      tryrsaref=no
 
320
    elif test -d "$withval"; then
 
321
      AC_ADD_SEARCH_PATH($withval)
 
322
      tryrsaref=yes
 
323
    fi,
 
324
)
 
325
AC_ARG_ENABLE(rsaref,,
 
326
        AC_MSG_ERROR([ Invalid option. Use --with-rsaref/--without-rsaref instead ]) )
 
327
 
 
328
tryopenssl=defaultyes
 
329
askedopenssl=no
 
330
AC_ARG_WITH(openssl,
 
331
[  --with-openssl=PATH             Look for openssl in PATH/lib.],
 
332
    if test "x$withval" = "xyes"; then
 
333
      tryopenssl=yes
 
334
      askedopenssl=yes
 
335
    elif test "x$withval" = "xno"; then
 
336
      tryopenssl=no
 
337
    elif test -d "$withval"; then
 
338
      AC_ADD_SEARCH_PATH($withval)
 
339
      tryopenssl=yes
 
340
      askedopenssl=yes
 
341
    fi,
 
342
)
 
343
if test "x$tryopenssl" = "xdefaultyes"; then
 
344
      AC_ADD_SEARCH_PATH(/usr/local/ssl)
 
345
      tryopenssl=yes
 
346
fi
 
347
AC_ARG_ENABLE(openssl,,
 
348
        AC_MSG_ERROR([ Invalid option. Use --with-openssl/--without-openssl instead ]) )
 
349
AC_ARG_WITH(ssl,,
 
350
        AC_MSG_ERROR([ Invalid option. Use --with-openssl/--without-openssl instead ]) )
 
351
AC_ARG_ENABLE(ssl,,
 
352
        AC_MSG_ERROR([ Invalid option. Use --with-openssl/--without-openssl instead ]) )
 
353
 
 
354
trykrb5=defaultyes
 
355
askedkrb5=no
 
356
AC_ARG_WITH(krb5,
 
357
[  --with-krb5=PATH                Look for krb5 in PATH/lib.],
 
358
    if test "x$withval" = "xyes"; then
 
359
      trykrb5=yes
 
360
      askedkrb5=yes
 
361
      krb5path=undef
 
362
    elif test "x$withval" = "xno"; then
 
363
      trykrb5=no
 
364
      krb5path=undef
 
365
    elif test -d "$withval"; then
 
366
      trykrb5=yes
 
367
      askedkrb5=yes
 
368
      krb5path=$withval
 
369
    fi,
 
370
)
 
371
if test "x$trykrb5" = "xdefaultyes"; then
 
372
      trykrb5=yes
 
373
      krb5path=/usr/kerberos
 
374
fi
 
375
AC_ARG_ENABLE(krb5,,
 
376
        AC_MSG_ERROR([ Invalid option. Use --with-krb5/--without-krb5 instead ]) )
 
377
 
 
378
AC_ARG_WITH(rpm,
 
379
[  --without-rpm                   Don't include support for the RPM package
 
380
                                  management system when building the host MIB
 
381
                                  module.])
 
382
AC_ARG_ENABLE(rpm,,
 
383
        AC_MSG_ERROR([ Invalid option. Use --with-rpm/--without-rpm instead ]) )
 
384
 
 
385
AC_ARG_ENABLE(agentx-dom-sock-only,
 
386
[  --enable-agentx-dom-sock-only   Disable UDP/TCP transports for agentx.],
 
387
AC_DEFINE(NETSNMP_AGENTX_DOM_SOCK_ONLY))
 
388
AC_ARG_WITH(agentx-dom-sock-only,,
 
389
        AC_MSG_ERROR([ Invalid option. Use --enable-agentx-dom-sock-only/--disable-agentx-dom-sock-only instead ]) )
 
390
 
 
391
AC_ARG_ENABLE(snmptrapd-subagent,
 
392
[  --disable-snmptrapd-subagent    Disable agentx subagent code in snmptrapd.])
 
393
if test "x$enable_snmptrapd_subagent" = "xno"; then
 
394
  AC_DEFINE(NETSNMP_SNMPTRAPD_DISABLE_AGENTX)
 
395
fi
 
396
AC_ARG_WITH(snmptrapd-subagent,,
 
397
        AC_MSG_ERROR([ Invalid option. Use --enable-snmptrapd-subagent/--disable-snmptrapd-subagent instead ]) )
 
398
 
 
399
AC_ARG_WITH(opaque-special-types,
 
400
[  --without-opaque-special-types  Don't use special opaque encodings.
 
401
                                  SNMP normally cannot handle
 
402
                                  floating numbers, nor large 64 bit
 
403
                                  integers well.  By default, the
 
404
                                  net-snmp package compiles in
 
405
                                  support for these extra datatypes
 
406
                                  (in a legal way)])
 
407
AC_ARG_ENABLE(opaque-special-types,,
 
408
        AC_MSG_ERROR([ Invalid option. Use --with-opaque-special-types/--without-opaque-special-types instead ]) )
 
409
 
 
410
AC_ARG_WITH(mibdirs,
 
411
[  --with-mibdirs="dir1:dir2:"   Default directories to look for mibs.
 
412
                                  (Default: \$HOME/.snmp/mibs:DATADIR/snmp/mibs)],
 
413
    [NETSNMP_DEFAULT_MIBDIRS="$with_mibdirs"
 
414
    AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_MIBDIRS,"$with_mibdirs")])
 
415
AC_ARG_ENABLE(mibdirs,,
 
416
        AC_MSG_ERROR([ Invalid option. Use --with-mibdirs/--without-mibdirs instead ]) )
 
417
 
 
418
AC_ARG_WITH(mibs,
 
419
[  --with-mibs="item1:item2:"    Default mib IDs to read.
 
420
                                  (The default list is "IP-MIB:IF-MIB:
 
421
                                  TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB"
 
422
                                  with the addition of any mibs used
 
423
                                  by the mib modules the agent is
 
424
                                  configured with)],
 
425
    NETSNMP_DEFAULT_MIBS="$with_mibs")
 
426
# enable-mibs is valid too, but means something else
 
427
 
 
428
AC_ARG_WITH(mibfiles,
 
429
[  --with-mibfiles="file1:file2" Default mib files to load.
 
430
                                  (Default:  none.  uses IDs above instead.)],
 
431
    AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_MIBFILES,"$with_mibfiles"))
 
432
AC_ARG_ENABLE(mibfiles,,
 
433
        AC_MSG_ERROR([ Invalid option. Use --with-mibfiles/--without-mibfiles instead ]) )
 
434
 
 
435
AC_ARG_ENABLE(mib-config-checking,
 
436
[  --enable-mib-config-checking    Turns on extra checks during configuration
 
437
                                  of mib modules. Any conflicts will cause
 
438
                                  configure to abort (default is to issue a
 
439
                                  warning and continue.)],
 
440
    with_mib_cfg_checks="yes",with_mib_cfg_checks="no")
 
441
AC_ARG_WITH(mib-config-checking,,
 
442
        AC_MSG_ERROR([ Invalid option. Use --enable-mib-config-checking/--disable-mib-config-checking instead ]) )
 
443
 
 
444
AC_ARG_ENABLE(mib-config-debug,
 
445
[  --enable-mib-config-debug       Turns on verbose output during mib module
 
446
                                  configure processing.)],
 
447
    with_mib_cfg_debug="yes",with_mib_cfg_debug="no")
 
448
AC_ARG_WITH(mib-config-checking,,
 
449
        AC_MSG_ERROR([ Invalid option. Use --enable-mib-config-checking/--disable-mib-config-checking instead ]) )
 
450
 
 
451
AC_ARG_ENABLE(mfd-rewrites,
 
452
[  --enable-mfd-rewrites           Use new MFD rewrites of mib modules,
 
453
                                  where available. (default is to use
 
454
                                  original mib module code).])
 
455
if test "x$enable_mfd_rewrites" = "xyes"; then
 
456
   AC_DEFINE(NETSNMP_ENABLE_MFD_REWRITES)
 
457
fi
 
458
AC_ARG_WITH(mfd-rewrites,,
 
459
        AC_MSG_ERROR([ Invalid option. Use --enable-mfd-rewrites/--disable-mfd-rewrites instead ]) )
 
460
 
 
461
askedpkcs=no
 
462
AC_ARG_WITH(pkcs,
 
463
[  --with-pkcs=PATH                Look for pkcs11 in PATH/lib.],
 
464
    if test "x$withval" = "xyes"; then
 
465
      askedpkcs=yes
 
466
    elif test "x$withval" = "xno"; then
 
467
      askedpkcs=no
 
468
    elif test -d "$withval"; then
 
469
      AC_ADD_SEARCH_PATH($withval)
 
470
      askedpkcs=yes
 
471
    fi,
 
472
)
 
473
AC_ARG_ENABLE(pkcs,,
 
474
        AC_MSG_ERROR([ Invalid option. Use --with-pkcs/--without-pkcs instead ]) )
 
475
 
 
476
AC_ARG_ENABLE(testing-code,
 
477
[  --enable-testing-code           Enables some code sections that should 
 
478
                                  only be used for testing of certain
 
479
                                  SNMP functionalities.  This should *not* 
 
480
                                  be turned on for production use.  Ever.],
 
481
    AC_DEFINE(NETSNMP_ENABLE_TESTING_CODE))
 
482
AC_ARG_WITH(testing-code,,
 
483
        AC_MSG_ERROR([ Invalid option. Use --enable-testing-code/--disable-testing-code instead ]) )
 
484
 
 
485
AC_ARG_ENABLE(reentrant,
 
486
[  --enable-reentrant              Enables locking functions that protect
 
487
                                  library resources in some multi-threading
 
488
                                  environments.  This does not guarantee
 
489
                                  thread-safe operation.
 
490
                                  Currently an experimental setting.],
 
491
    with_res_locks="yes",with_res_locks="no")
 
492
AC_ARG_WITH(reentrant,,
 
493
        AC_MSG_ERROR([ Invalid option. Use --enable-reentrant/--disable-reentrant instead ]) )
 
494
 
 
495
AC_ARG_WITH(root-access,
 
496
[
 
497
Configuring the agent:
 
498
  --without-root-access           The snmpd agent won't require root access to
 
499
                                  run it.  The information it returns in the
 
500
                                  mib-II tree may not be correct, however.])
 
501
AC_ARG_ENABLE(root-access,,
 
502
        AC_MSG_ERROR([ Invalid option. Use --with-root-access/--without-root-access instead ]) )
 
503
 
 
504
AC_ARG_WITH(kmem-usage,
 
505
[  --without-kmem-usage            Do not include any code related to the use
 
506
                                  of kmem.])
 
507
AC_ARG_ENABLE(kmem-usage,,
 
508
        AC_MSG_ERROR([ Invalid option. Use --with-kmem-usage/--without-kmem-usage instead ]) )
 
509
 
 
510
AC_ARG_WITH(dummy-values,
 
511
[  --with-dummy-values             Provide 'placeholder' dummy values where
 
512
                                  the necessary information is not available.
 
513
                                  This is technically not compliant with the
 
514
                                  SNMP specifications, but was how the agent
 
515
                                  operated for versions < 4.0.])
 
516
AC_ARG_ENABLE(dummy-values,,
 
517
        AC_MSG_ERROR([ Invalid option. Use --with-dummy-values/--without-dummy-values instead ]) )
 
518
 
 
519
AC_ARG_WITH(persistent-directory,
 
520
[  --with-persistent-directory="directory"
 
521
                                  Default directory for persistent data storage.],ac_cv_user_prompt_NETSNMP_PERSISTENT_DIRECTORY="$with_persistent_directory")
 
522
AC_ARG_ENABLE(persistent-directory,,
 
523
        AC_MSG_ERROR([ Invalid option. Use --with-persistent-directory/--without-persistent-directory instead ]) )
 
524
 
 
525
default_persistent_mask=077
 
526
AC_ARG_WITH(persistent-mask,
 
527
[  --with-persistent-mask="mask"  Default mask for persistent data storage.
 
528
                                  (Default: 077)],[
 
529
  if test "$withval" = yes; then
 
530
    AC_MSG_ERROR([ Please provide a mask value ]);
 
531
  fi
 
532
  AC_MSG_RESULT(using default persistent mask $withval)
 
533
  AC_DEFINE_UNQUOTED(NETSNMP_PERSISTENT_MASK,$withval)
 
534
],[
 
535
  AC_MSG_RESULT(using default persistent mask $default_persistent_mask)
 
536
  AC_DEFINE_UNQUOTED(NETSNMP_PERSISTENT_MASK,$default_persistent_mask)
 
537
])
 
538
AC_ARG_ENABLE(persistent-mask,,
 
539
        AC_MSG_ERROR([ Invalid option. Use --with-persistent-mask instead ]) )
 
540
 
 
541
AC_ARG_WITH(copy_persistent_files,
 
542
[  --with-copy-persistent-files="no" Don't copy persistent files
 
543
                                     (or use "yes" to copy them).
 
544
                                     (Default: yes)],
 
545
    ac_cv_user_prompt_COPY_PERSISTENT_FILES="$with_copy_persistent_files")
 
546
AC_ARG_ENABLE(copy_persistent_files,,
 
547
        AC_MSG_ERROR([ Invalid option. Use --with-copy_persistent_files/--without-copy_persistent_files instead ]) )
 
548
 
 
549
default_temp_file_pattern="/tmp/snmpdXXXXXX"
 
550
AC_ARG_WITH(temp-file-pattern,
 
551
[  --with-temp-file-pattern=PATTERN  Pattern of temporary files (Default: /tmp/snmpdXXXXXX)],[
 
552
  if test "$withval" = yes; then
 
553
    AC_MSG_ERROR([ Please provide a pattern ]);
 
554
  fi
 
555
  AC_MSG_RESULT(using temporary file pattern $withval)
 
556
  AC_DEFINE_UNQUOTED(NETSNMP_TEMP_FILE_PATTERN,"$withval",[Pattern of temporary files])
 
557
],[
 
558
  AC_MSG_RESULT(using default temporary file pattern $default_temp_file_pattern)
 
559
  AC_DEFINE_UNQUOTED(NETSNMP_TEMP_FILE_PATTERN,"$default_temp_file_pattern",[Pattern of temporary files])
 
560
])
 
561
AC_ARG_ENABLE(temp-file-pattern,,
 
562
        AC_MSG_ERROR([ Invalid option. Use --with-temp-file-pattern instead ]) )
 
563
 
 
564
default_agentx_socket="/var/agentx/master"
 
565
AC_ARG_WITH(agentx-socket,
 
566
[  --with-agentx-socket=FILE         AgentX socket (Default: /var/agentx/master as specified in RFC2741)],[
 
567
  if test "$withval" = yes; then
 
568
    AC_MSG_ERROR([ Please provide a full path ]);
 
569
  fi
 
570
  AC_MSG_RESULT(using AgentX socket $withval)
 
571
  AC_DEFINE_UNQUOTED(NETSNMP_AGENTX_SOCKET,"$withval",[Unix domain socket for AgentX master-subagent communication])
 
572
],[
 
573
  AC_MSG_RESULT(using default AgentX socket $default_agentx_socket)
 
574
  AC_DEFINE_UNQUOTED(NETSNMP_AGENTX_SOCKET,"$default_agentx_socket",[Unix domain socket for AgentX master-subagent communication])
 
575
])
 
576
AC_ARG_ENABLE(agentx-socket,,
 
577
        AC_MSG_ERROR([ Invalid option. Use --with-agentx-socket instead ]) )
 
578
 
 
579
AC_ARG_WITH(default-snmp-version,
 
580
[  --with-default-snmp-version="3" Default version of SNMP to use.
 
581
                                    (Default: 3)
 
582
                                    Legal values: 1, 2 (for SNMPv2c) or 3.],
 
583
    ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION="$with_default_snmp_version")
 
584
AC_ARG_ENABLE(default-snmp-version,,
 
585
        AC_MSG_ERROR([ Invalid option. Use --with-default-snmp-version/--without-default-snmp-version instead ]) )
 
586
 
 
587
# we test this now and later as well.  we test it now so configure can die
 
588
# early on with an error rather than waiting till the end of the script.
 
589
if test "x$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "x"; then
 
590
  if test "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" = "2c"; then
 
591
    ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION="2"
 
592
  fi
 
593
  if test "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "3"; then
 
594
    AC_MSG_ERROR(Illegal version number passed to --with-default-snmp-version)
 
595
  fi
 
596
fi
 
597
 
 
598
AC_ARG_WITH(sys_contact,
 
599
[  --with-sys-contact="who@where"  Default system contact.
 
600
                                    (Default: LOGIN@DOMAINNAME)],
 
601
    ac_cv_user_prompt_NETSNMP_SYS_CONTACT="$with_sys_contact")
 
602
AC_ARG_ENABLE(sys_contact,,
 
603
        AC_MSG_ERROR([ Invalid option. Use --with-sys-contact/--without-sys-contact instead ]) )
 
604
 
 
605
AC_ARG_WITH(sys_location,
 
606
[  --with-sys-location="location"  Default system location.
 
607
                                    (Default: Unknown)],
 
608
    ac_cv_user_prompt_NETSNMP_SYS_LOC="$with_sys_location")
 
609
AC_ARG_ENABLE(sys_location,,
 
610
        AC_MSG_ERROR([ Invalid option. Use --with-sys-location/--without-sys-location instead ]) )
 
611
 
 
612
AC_ARG_WITH(logfile,
 
613
[  --with-logfile="location"       Default log file location for snmpd.],
 
614
    ac_cv_user_prompt_NETSNMP_LOGFILE="$with_logfile")
 
615
AC_ARG_ENABLE(logfile,,
 
616
        AC_MSG_ERROR([ Invalid option. Use --with-logfile/--without-logfile instead ]) )
 
617
if test "$ac_cv_user_prompt_NETSNMP_LOGFILE" = "no"; then
 
618
    ac_cv_user_prompt_NETSNMP_LOGFILE="none"
 
619
fi
 
620
 
 
621
AC_ARG_WITH(transports,
 
622
[  --with-transports="t1 t2 ..."   Compile in the given SNMP transport
 
623
                                    modules (space separated list).])
 
624
AC_ARG_WITH(out_transports,
 
625
[  --with-out-transports="t1 ..."  Exclude listed SNMP transports
 
626
                                    (space separated list).
 
627
 
 
628
  Available SNMP transport modules are:
 
629
 
 
630
    UDP         support for SNMP over UDP/IP.
 
631
                This transport is always compiled in.
 
632
    UDPIPv6     support for SNMP over UDP/IPv6.
 
633
                This transport is available for Linux, Solaris and
 
634
                FreeBSD at least.
 
635
                It is never compiled in by default.
 
636
    TCPIPv6     support for SNMP over UDP/IPv6.
 
637
                This transport is available for Linux, Solaris and
 
638
                FreeBSD at least.
 
639
                It is never compiled in by default.
 
640
    TCP         support for SNMP over TCP/IP.
 
641
                This transport is compiled in by default, but may be omitted.
 
642
    Unix        support for SNMP over Unix domain protocols.
 
643
                This transport is compiled in by default except on Win32
 
644
                platforms, and may be omitted.
 
645
    Callback    support for SNMP over an internal locally connected pair
 
646
                of snmp_sessions.
 
647
    AAL5PVC     support for SNMP over AAL5 PVCs.
 
648
                This transport is presently only available for Linux,
 
649
                is never compiled in by default and may be omitted.
 
650
    IPX         support for SNMP over IPX per RFC 1420.
 
651
                This transport is presently only available for Linux,
 
652
                is never compiled in by default and may be omitted.
 
653
])
 
654
 
 
655
#
 
656
# Catch common mistakes in transport options
 
657
#
 
658
AC_ARG_WITH(transport,,    AC_MSG_ERROR([ Invalid option. Use --with-transports/--without-transports instead ])     )
 
659
AC_ARG_WITH(out-transport,,AC_MSG_ERROR([ Invalid option. Use --with-out-transports/--without-out-transports instead ]) )
 
660
 
 
661
#
 
662
# security modules
 
663
#
 
664
 
 
665
AC_ARG_WITH(security-modules,
 
666
[  --with-security-modules="s1 s2 ..."   Compile in the given SNMP security
 
667
                                    module services (space separated list).
 
668
 
 
669
  Available SNMP security services:
 
670
 
 
671
        usm                support for user based SNMP security
 
672
                           (required and always compiled in)
 
673
        ksm                support for kerberos based SNMP security
 
674
])
 
675
AC_ARG_ENABLE(security-modules,,
 
676
        AC_MSG_ERROR([ Invalid option. Use --with-security-modules/--without-security-modules instead ]) )
 
677
 
 
678
#
 
679
# mib modules
 
680
#
 
681
 
 
682
AC_ARG_WITH(mib_modules,
 
683
[  --with-mib-modules="item1 ..."  Compile with additional mib modules
 
684
                                    (Space separated list).])
 
685
AC_ARG_ENABLE(mib_modules,,
 
686
        AC_MSG_ERROR([ Invalid option. Use --with-mib-modules/--without-mib-modules instead ]) )
 
687
 
 
688
AC_ARG_WITH(out_mib_modules,
 
689
[  --with-out-mib-modules="list"   Compile without these mib modules.
 
690
 
 
691
  Default mib modules compiled into the agent (which can be removed):
 
692
  
 
693
    mibII                  support for the mib-II tree.
 
694
    snmpv3mibs             support for the snmpv3 mib modules.
 
695
    ucd_snmp               UCD-SNMP-MIB specific extensions.
 
696
    agent_mibs             NET-SNMP-AGENT-MIB extensions
 
697
    agentx                 AgentX support (see below)
 
698
    notification           mibs supporting specification of trap destinations.
 
699
    target                 Support for the SNMP WGs TARGET-MIB.
 
700
    utilities              general agent configuration utilities.
 
701
    disman/event           support for the DISMAN-EVENT-MIB
 
702
                             (supports self monitoring and notification 
 
703
                              delivery when error conditions are found)
 
704
    disman/schedule        support for the DISMAN-SCHEDULE-MIB
 
705
                             (trigger SET requests at specified times)
 
706
    host                   host resources mib support.
 
707
                             (only on major supported platforms)
 
708
 
 
709
  Optional mib modules that can be built into the agent include:
 
710
    smux                   smux support to allow subagents to attach to snmpd.
 
711
    mibII/mta_sendmail     Sendmail statistics monitoring (MTA-MIB)
 
712
    ucd-snmp/diskio        Table of io-devices and how much data they have
 
713
                           read/written.  (only tested on Solaris, Linux)
 
714
    disman/old-event-mib   previous implementation of the DISMAN-EVENT-MIB
 
715
 
 
716
  Optional modules for specific platforms
 
717
    Linux
 
718
      ucd-snmp/lmSensors   hardware monitoring (LM-SENSORS-MIB)
 
719
      ip-mib/ipv4InterfaceTable  (experimental)
 
720
      ip-mib/ipv6InterfaceTable  (experimental)
 
721
      tunnel               Linux TUNNEL-MIB support (ifTable extension)
 
722
      mibII/interfaces     (old ifTable implementation)
 
723
      misc/ipfwacc         accounting rules IP firewall information
 
724
      ipfwchains/ipfwchains  firewall chains under ipfw
 
725
                             (See agent/mibgroup/ipfwchains/README)
 
726
      sctp-mib             support for the SCTP-MIB
 
727
 
 
728
    Solaris
 
729
      ucd-snmp/lmSensors   hardware monitoring (LM-SENSORS-MIB)
 
730
      if-mib               IF-MIB rewrite (add --enable-mfd-rewrites)
 
731
      tcp-mib              TCP-MIB rewrite (tcpConnectionTable and
 
732
                             tcpListenerTable; add --enable-mfd-rewrites)
 
733
      udp-mib              UDP-MIB rewrite (udpEndpointTable;
 
734
                             add --enable-mfd-rewrites)
 
735
 
 
736
    FreeBSD/OpenBSD
 
737
      if-mib               IF-MIB rewrite (add --enable-mfd-rewrites)
 
738
 
 
739
  AgentX support:
 
740
    agentx/subagent        allows the agent to run as either a snmp agent
 
741
                           or as an agentX sub-agent.
 
742
    agentx/master          makes the agent run as an agentX master agent
 
743
                           as well as a normal snmp agent.
 
744
    agentx                 includes both agentx/master and agentx/client.
 
745
 
 
746
  Optional modules for C coders to look at and/or include as extension examples:
 
747
  
 
748
    examples/ucdDemoPublic  SNMPv3 interoperability testing mib.
 
749
    examples/example        example C code extension.])
 
750
AC_ARG_ENABLE(out_mib_modules,,
 
751
        AC_MSG_ERROR([ Invalid option. Use --with-out-mib-modules/--without-out-mib-modules instead ]) )
 
752
 
 
753
 
 
754
#
 
755
AC_ARG_WITH(enterprise-oid,
 
756
[Enterprise OIDs:  (warning: this should be used with caution.)
 
757
 
 
758
  --with-enterprise-oid              The enterprise number assigned to the
 
759
                                     vendor by IANA.  See
 
760
                                     http://www.iana.org/cgi-bin/enterprise.pl
 
761
                                     to get one, though using the default is
 
762
                                     probably the right choice is most cases.
 
763
                                     (default 8072 = "enterprise.net-snmp")],[
 
764
  if test "$withval" = yes; then
 
765
    AC_MSG_ERROR([ Please provide a value for the enterprise number ]);
 
766
  fi
 
767
  AC_DEFINE_UNQUOTED(NETSNMP_ENTERPRISE_OID, $withval)
 
768
  ent_oid="1,3,6,1,4,1,$withval"
 
769
  AC_DEFINE_UNQUOTED(NETSNMP_ENTERPRISE_MIB, $ent_oid)
 
770
  ent_dot_oid="1.3.6.1.4.1.$withval"
 
771
  AC_DEFINE_UNQUOTED(NETSNMP_ENTERPRISE_DOT_MIB, $ent_dot_oid)
 
772
  AC_MSG_RESULT(using enterprise number $withval)
 
773
],[
 
774
  AC_MSG_RESULT(using default "enterprise.net-snmp")
 
775
])
 
776
AC_ARG_ENABLE(enterprise-oid,,
 
777
        AC_MSG_ERROR([ Invalid option. Use --with-enterprise-oid/--without-enterprise-oid instead ]) )
 
778
 
 
779
AC_ARG_WITH(enterprise-sysoid,
 
780
[
 
781
  --with-enterprise-sysoid           The base OID for the sysObjectID
 
782
                                     of the system group
 
783
                                     (default .1.3.6.1.4.1.8072.3.2... = 
 
784
                                      "netSnmpAgentOIDs...")],[
 
785
  if test "$withval" = yes; then
 
786
    AC_MSG_ERROR([ Please provide a base OID value ]);
 
787
  fi
 
788
  sys_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'`
 
789
  AC_DEFINE_UNQUOTED(NETSNMP_SYSTEM_MIB, $sys_oid)
 
790
  sys_dot_oid=`echo "$withval" | sed 's/^\.//'`
 
791
  AC_DEFINE_UNQUOTED(NETSNMP_SYSTEM_DOT_MIB, $sys_dot_oid)
 
792
  sysoid_len=`echo "$withval" | sed 's/[^\.]//g' | awk -F\. '{ print NF }'`
 
793
  AC_DEFINE_UNQUOTED(NETSNMP_SYSTEM_DOT_MIB_LENGTH, $sysoid_len)
 
794
  AC_MSG_RESULT(using enterprise sysOID $withval ....)
 
795
],[
 
796
  AC_MSG_RESULT(using default enterprise sysOID "NET-SNMP-MIB::netSnmpAgentOIDs...")
 
797
])
 
798
AC_ARG_ENABLE(enterprise-sysoid,,
 
799
        AC_MSG_ERROR([ Invalid option. Use --with-enterprise-sysoid/--without-enterprise-sysoid instead ]) )
 
800
 
 
801
AC_ARG_WITH(enterprise-notification-oid,
 
802
[
 
803
  --with-enterprise-notification-oid The OID used for the root of
 
804
                                     enterprise specific notifications.
 
805
                                     (default .1.3.6.1.4.1.8072.4 = 
 
806
                                      "netSnmpNotificationPrefix")],[
 
807
  if test "$withval" = yes; then
 
808
    AC_MSG_ERROR([ Please provide a base OID value ]);
 
809
  fi
 
810
  notification_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'`
 
811
  AC_DEFINE_UNQUOTED(NETSNMP_NOTIFICATION_MIB, $notification_oid)
 
812
  notification_dot_oid=`echo "$withval" | sed 's/^\.//'`
 
813
  AC_DEFINE_UNQUOTED(NETSNMP_NOTIFICATION_DOT_MIB, $notification_dot_oid)
 
814
  notificationoid_len=`echo "$withval" | sed 's/[^\.]//g' | awk -F\. '{ print NF }'`
 
815
  AC_DEFINE_UNQUOTED(NETSNMP_NOTIFICATION_DOT_MIB_LENGTH, $notificationoid_len)
 
816
  AC_MSG_RESULT(using enterprise notifications $withval)
 
817
],[
 
818
  AC_MSG_RESULT(using default notifications "NET-SNMP-MIB::netSnmpNotifications")
 
819
])
 
820
AC_ARG_ENABLE(enterprise-notification-oid,,
 
821
        AC_MSG_ERROR([ Invalid option. Use --with-enterprise-notification-oid/--without-enterprise-notification-oid instead ]) )
 
822
#
 
823
# Catch common mistakes in configure options
 
824
#
 
825
AC_ARG_WITH(mib-module,,    AC_MSG_ERROR([ Invalid option1. Use --with-mib-modules instead ])     )
 
826
AC_ARG_WITH(module,,
 
827
        AC_MSG_ERROR([ Invalid option3. Use --with-mib-modules instead ]) )
 
828
AC_ARG_WITH(modules,,
 
829
        AC_MSG_ERROR([ Invalid option4. Use --with-mib-modules instead ]) )
 
830
 
 
831
AC_ARG_WITH(out-mib-module,,AC_MSG_ERROR([ Invalid option5. Use --with-out-mib-modules instead ]) )
 
832
AC_ARG_WITH(out-modules,,
 
833
        AC_MSG_ERROR([ Invalid option7. Use --with-out-mib-modules instead ]) )
 
834
AC_ARG_WITH(out-module,,
 
835
        AC_MSG_ERROR([ Invalid option8. Use --with-out-mib-modules instead ]) )
 
836
 
 
837
#
 
838
# Perl specific
 
839
#
 
840
AC_ARG_WITH(perl-modules,
 
841
[
 
842
Perl:
 
843
  --with-perl-modules[=ARGS]      Install the Perl modules along with the rest
 
844
                                  of the net-snmp toolkit.  If ARGS is
 
845
                                  specified, they're passed to the
 
846
                                  Makefile.PL script.],[
 
847
    if test "$withval" = "no"; then
 
848
      install_perl="no"
 
849
    else
 
850
      install_perl="yes"
 
851
      if test "$withval" != "yes"; then
 
852
        PERLARGS="$withval"
 
853
      fi
 
854
    fi
 
855
], install_perl="try")
 
856
 
 
857
AC_ARG_ENABLE(embedded-perl,
 
858
[  --disable-embedded-perl         Disable embedded Perl in the SNMP agent and
 
859
                                  snmptrapd. [enabled by default]],
 
860
    embed_perl="$enableval", embed_perl="try")
 
861
 
 
862
AC_ARG_ENABLE(perl-cc-checks,
 
863
[  --disable-perl-cc-checks        Disable configure checks for whether Perl's
 
864
                                  C Compiler is compatible with ours when
 
865
                                  embedded Perl is enabled.])
 
866
 
 
867
# Common perl mistakes
 
868
AC_ARG_ENABLE(perl-modules,,
 
869
        AC_MSG_ERROR([ Invalid option. Use --with-perl-modules/--without-perl-modules instead ]) )
 
870
AC_ARG_WITH(embedded-perl,,
 
871
        AC_MSG_ERROR([ Invalid option. Use --enable-embedded-perl/--disable-embedded-perl instead ]) )
 
872
AC_ARG_WITH(perl-cc-checks,,
 
873
        AC_MSG_ERROR([ Invalid option. Use --enable-perl-cc-checks/--disable-perl-cc-checks instead ]) )
 
874
 
 
875
 
 
876
#
 
877
# Python specific
 
878
#
 
879
AC_ARG_WITH(python-modules,
 
880
[
 
881
Python:
 
882
  --with-python-modules[=ARGS]    Install the python bindings along with the
 
883
                                  rest of the net-snmp toolkit.  If ARGS is
 
884
                                  specified, they're passed to the
 
885
                                  setup.py script as arguments.],[
 
886
    install_python="yes"
 
887
    if test "$withval" = "yes"; then
 
888
      PYTHONARGS=""
 
889
    elif test "$withval" = "no"; then
 
890
      PYTHONARGS=""
 
891
      install_python="no"
 
892
    else
 
893
      PYTHONARGS="$withval"
 
894
    fi
 
895
], install_python="no")
 
896
 
 
897
# other flags
 
898
 
 
899
AC_ARG_WITH(server-send-buf,
 
900
[
 
901
Network Buffers:
 
902
  --with-server-send-buf[=ARG]    Use ARG for the default UDP/TCP send buffer instead
 
903
                                  of the OS buffer for server sockets that are
 
904
                                  created (snmpd, snmptrapd).  
 
905
                                  This default can be overridden in the runtime 
 
906
                                  configuration files.
 
907
                                  The ARG should be the size in bytes],[
 
908
   if test "$withval" = yes; then
 
909
    AC_MSG_ERROR([ Please provide a positive number for the server send buffer ])
 
910
   fi
 
911
   AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_SERVER_SEND_BUF, $withval)],
 
912
   AC_MSG_RESULT([using OS default send buffer size for server sockets]) )
 
913
AC_ARG_ENABLE(server-send-buf,,
 
914
        AC_MSG_ERROR([ Invalid option. Use --with-server-send-buf/--without-server-send-buf instead ]) )
 
915
 
 
916
AC_ARG_WITH(server-recv-buf,
 
917
[  --with-server-recv-buf[=ARG]    Similar as previous option, but for receive buffer],[
 
918
  if test "$withval" = yes; then
 
919
    AC_MSG_ERROR([ Please provide a positive number for the server recv buffer ])
 
920
  fi
 
921
  AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_SERVER_RECV_BUF, $withval)],
 
922
  AC_MSG_RESULT([using OS default recv buffer size for server sockets]) )
 
923
AC_ARG_ENABLE(server-recv-buf,,
 
924
        AC_MSG_ERROR([ Invalid option. Use --with-server-recv-buf/--without-server-recv-buf instead ]) )
 
925
 
 
926
AC_ARG_WITH(client-send-buf,
 
927
[  --with-client-send-buf[=ARG]    Similar as previous options, but for the
 
928
                                  receive buffer of client sockets],[
 
929
  if test "$withval" = yes; then
 
930
    AC_MSG_ERROR([ Please provide a positive number for the client send buffer ])
 
931
  fi
 
932
  AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_CLIENT_SEND_BUF, $withval)],
 
933
  AC_MSG_RESULT([using OS default send buffer size for client sockets]) )
 
934
AC_ARG_ENABLE(client-send-buf,,
 
935
        AC_MSG_ERROR([ Invalid option. Use --with-client-send-buf/--without-client-send-buf instead ]) )
 
936
 
 
937
AC_ARG_WITH(client-recv-buf,
 
938
[  --with-client-recv-buf[=ARG]    Similar as previous options, but for the send buffer],[
 
939
  if test "$withval" = yes; then
 
940
    AC_MSG_ERROR([ Please provide a positive number for the client recv buffer ])
 
941
  fi
 
942
  AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_CLIENT_RECV_BUF, $withval)],
 
943
  AC_MSG_RESULT([using OS default recv buffer size for client sockets]) )
 
944
AC_ARG_ENABLE(client-recv-buf,,
 
945
        AC_MSG_ERROR([ Invalid option. Use --with-client-recv-buf/--without-client-recv-buf instead ]) )
 
946
 
 
947
#
 
948
# otherwise prompted information
 
949
#
 
950
AC_ARG_WITH(defaults,
 
951
[
 
952
Miscellaneous:
 
953
  --with-defaults         Use defaults for prompted values.],
 
954
    defaults="yes",defaults="no")
 
955
AC_ARG_ENABLE(defaults,,
 
956
        AC_MSG_ERROR([ Invalid option. Use --with-defaults/--without-defaults instead ]) )
 
957
 
 
958
AC_ARG_ENABLE(ucd-snmp-compatibility,
 
959
[  --enable-ucd-snmp-compatibility Install ucd-snmp look-alike headers and libs.
 
960
])
 
961
AC_ARG_WITH(ucd-snmp-compatibility,,
 
962
        AC_MSG_ERROR([ Invalid option. Use --enable-ucd-snmp-compatibility/--disable-ucd-snmp-compatibility instead ]) )
 
963
 
 
964
#
 
965
# setup install targets
 
966
#
 
967
if test "x$enable_ucd_snmp_compatibility" = "xyes" ; then       
 
968
  installucdheaders=installucdheaders
 
969
  installucdlibs=installucdlibs
 
970
  AC_MSG_CACHE_ADD(UCD-SNMP compatability:     enabled)
 
971
fi
 
972
AC_SUBST(installucdheaders)
 
973
AC_SUBST(installucdlibs)
 
974
 
 
975
# Only define if specifically chosen as --without (i.e., default to true). 
 
976
if test "x$with_root_access" = "xno"; then
 
977
  AC_DEFINE(NETSNMP_NO_ROOT_ACCESS)
 
978
fi
 
979
 
 
980
# Only define if specifically chosen as --without (i.e., default to true).
 
981
if test "x$with_kmem_usage" = "xno"; then
 
982
  AC_DEFINE(NETSNMP_NO_KMEM_USAGE)
 
983
fi
 
984
 
 
985
# Define unless specifically suppressed (i.e., option defaults to false). 
 
986
if test "x$with_dummy_values" != "xyes"; then
 
987
  AC_DEFINE(NETSNMP_NO_DUMMY_VALUES)
 
988
fi
 
989
 
 
990
# Only define if specifically chosen as --without (i.e., default to true). 
 
991
if test "x$with_opaque_special_types" != "xno"; then
 
992
  AC_DEFINE(NETSNMP_WITH_OPAQUE_SPECIAL_TYPES)
 
993
fi
 
994
 
 
995
 
 
996
# overflow problems with hpux's sh
 
997
# taken from Perl's Configure script 
 
998
 
 
999
AC_MSG_CHECKING([if I need to feed myself to ksh])
 
1000
if test -f /hp-ux -a -f /bin/ksh; then
 
1001
  if (PATH=.; alias -x) >/dev/null 2>&1; then
 
1002
    AC_MSG_RESULT(no)
 
1003
  else
 
1004
    AC_MSG_RESULT(yes)
 
1005
    if test "x$1" = "x"; then
 
1006
      exec /bin/ksh $0
 
1007
    else
 
1008
      exec /bin/ksh $0 "$@"
 
1009
    fi
 
1010
  fi
 
1011
else
 
1012
  AC_MSG_RESULT(no)
 
1013
fi
 
1014
 
 
1015
if test "x$developer" != "xno" -a -f $srcdir/remove-files; then
 
1016
  # turn on the developer flag when taken from a SVN checkout (not a release)
 
1017
  developer="yes"
 
1018
fi
 
1019
 
 
1020
AC_LANG([C])
 
1021
AC_PROG_CC
 
1022
AC_PROG_CPP
 
1023
LINKCC=${LINKCC-"$CC"}
 
1024
AC_SUBST(LINKCC)
 
1025
AC_AIX
 
1026
 
 
1027
# system check
 
1028
AC_CANONICAL_TARGET
 
1029
changequote(, )
 
1030
PARTIALTARGETOS=`echo $target_os | sed 's/[-._].*//'`
 
1031
changequote([, ])
 
1032
 
 
1033
# platform-specific compiler flags
 
1034
if test "x$PARTIALTARGETOS" = "xmingw32msvc"; then
 
1035
        CFLAGS="$CFLAGS -Dmingw32"
 
1036
fi
 
1037
 
 
1038
# platform-specific linker flags
 
1039
case $target_os in
 
1040
    aix4.2*|aix4.3*|aix5*|aix6*)
 
1041
        AC_MSG_CHECKING([what linker flags to add to enable runtime linking on AIX])
 
1042
        for ld_flag in $LDFLAGS; do
 
1043
            if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
 
1044
                netsnmp_aix_runtimelinking_flags_ok=yes
 
1045
                break
 
1046
            fi
 
1047
        done
 
1048
        if test "X$netsnmp_aix_runtimelinking_flags_ok" != "Xyes"; then
 
1049
            if test "x$GCC" = "xyes"; then
 
1050
                netsnmp_aix_ldflags="-Wl,-brtl"
 
1051
            else
 
1052
                netsnmp_aix_ldflags="-brtl"
 
1053
            fi
 
1054
            LDFLAGS="$netsnmp_aix_ldflags $LDFLAGS"
 
1055
            AC_MSG_RESULT($netsnmp_aix_ldflags)
 
1056
        else
 
1057
            AC_MSG_RESULT([none])
 
1058
        fi
 
1059
        ;;
 
1060
    darwin8*|darwin9*)
 
1061
        AC_MSG_CHECKING([whether darwin ld might need -flat_namespace])
 
1062
        if test -z "$MACOSX_DEPLOYMENT_TARGET"; then
 
1063
                LDFLAGS="-flat_namespace $LDFLAGS"
 
1064
                AC_MSG_RESULT([yes])
 
1065
        else
 
1066
                AC_MSG_RESULT([no])
 
1067
        fi
 
1068
        ;;
 
1069
    *)
 
1070
        ;;
 
1071
esac
 
1072
 
 
1073
# libtool stuff for shared/static libraries.
 
1074
AC_LIBTOOL_DLOPEN
 
1075
AC_LIBTOOL_WIN32_DLL
 
1076
AC_PROG_LIBTOOL
 
1077
AC_SUBST(LIBTOOL_DEPS)
 
1078
 
 
1079
# Checks for programs.
 
1080
AC_PROG_INSTALL
 
1081
AC_PROG_LN_S
 
1082
AC_PROG_MAKE_SET
 
1083
AC_PROG_EGREP
 
1084
AC_PATH_PROG([PSPROG],ps)
 
1085
AC_PATH_PROG([PERLPROG],perl)
 
1086
AC_PATH_PROG([PYTHONPROG],python)
 
1087
AC_CHECK_PROGS(WHOAMI, whoami logname, whoami)
 
1088
AC_CHECK_PROGS(SED,sed gsed)
 
1089
AC_CHECK_PROGS(FIND,find)
 
1090
AC_PATH_PROG(AUTOCONF, autoconf)
 
1091
AC_PATH_PROG(AUTOHEADER, autoheader)
 
1092
if test "x$ac_cv_prog_AUTOCONF" = "x"; then
 
1093
        AUTOCONF=":"
 
1094
        AC_SUBST(AUTOCONF)
 
1095
fi
 
1096
if test "x$ac_cv_prog_AUTOHEADER" = "x"; then
 
1097
        AUTOHEADER=":"
 
1098
        AC_SUBST(AUTOHEADER)
 
1099
fi
 
1100
 
 
1101
AC_PATH_PROG([UNAMEPROG],uname)
 
1102
AC_DEFINE_UNQUOTED(UNAMEPROG,"$UNAMEPROG")
 
1103
 
 
1104
AC_C_CONST
 
1105
AC_C_INLINE
 
1106
 
 
1107
 
 
1108
# get version number.
 
1109
AC_MSG_CHECKING([for net-snmp version number])
 
1110
VERSION=`grep NetSnmpVersionInfo.*= $srcdir/snmplib/snmp_version.c | sed 's/";.*//;s/.*"//;'`
 
1111
 
 
1112
# create the release version number....  I'm not sure this is used
 
1113
# anywhere any longer.
 
1114
_release_version=`echo $VERSION | sed 's/";.*//;s/.*"//;s/pre/0./;'`
 
1115
changequote(, )
 
1116
RELEASEVERSION=`echo $_release_version | sed 's/^\([0-9]\)\.\([0-9]\)/\1:\2:0/'`
 
1117
changequote([, ])
 
1118
 
 
1119
AC_SUBST(VERSION)
 
1120
AC_SUBST(RELEASEVERSION)
 
1121
AC_MSG_RESULT($VERSION)
 
1122
AC_MSG_CACHE_ADD(Net-SNMP Version:           $VERSION)
 
1123
 
 
1124
# super type checking
 
1125
# WWWXXX
 
1126
AC_MSG_CHECKING([for developer gcc flags])
 
1127
if test "x$developer" = "xyes" -a "x$GCC" = "xyes"; then
 
1128
  DEVFLAGS="-Wall -Winline -Wstrict-prototypes -Wwrite-strings -Wcast-qual -Wno-char-subscripts"
 
1129
else
 
1130
  DEVFLAGS=""
 
1131
fi
 
1132
AC_MSG_RESULT($DEVFLAGS)
 
1133
AC_SUBST(DEVFLAGS)
 
1134
 
 
1135
#
 
1136
# hacks for building outside of the source directory
 
1137
#
 
1138
# 1) make sure build include paths are before source
 
1139
# 2) check for GNU make to use vpath instead of VPATH
 
1140
#
 
1141
NON_GNU_VPATH="VPATH ="
 
1142
GNU_vpath="#vpath"
 
1143
#
 
1144
# define include paths relative to top_srcdir
 
1145
# tweak includes if we're building outside of the source dir
 
1146
if test "x$srcdir" = "x."; then
 
1147
TOP_INCLUDES=SRC_TOP_INCLUDES
 
1148
SNMPLIB_INCLUDES=SRC_SNMPLIB_INCLUDES
 
1149
AGENT_INCLUDES=SRC_AGENT_INCLUDES
 
1150
HELPER_INCLUDES=SRC_HELPER_INCLUDES
 
1151
MIBGROUP_INCLUDES=SRC_MIBGROUP_INCLUDES
 
1152
else
 
1153
TOP_INCLUDES=BLD_TOP_INCLUDES
 
1154
SNMPLIB_INCLUDES=BLD_SNMPLIB_INCLUDES
 
1155
AGENT_INCLUDES=BLD_AGENT_INCLUDES
 
1156
HELPER_INCLUDES=BLD_HELPER_INCLUDES
 
1157
MIBGROUP_INCLUDES=BLD_MIBGROUP_INCLUDES
 
1158
make -v -f /dev/null 2>/dev/null | grep GNU >/dev/null
 
1159
have_gnu_make=$?
 
1160
if test $have_gnu_make -eq 0 ; then
 
1161
    NON_GNU_VPATH="#VPATH ="
 
1162
    GNU_vpath="vpath"
 
1163
fi
 
1164
fi
 
1165
AC_SUBST(TOP_INCLUDES)
 
1166
AC_SUBST(SNMPLIB_INCLUDES)
 
1167
AC_SUBST(AGENT_INCLUDES)
 
1168
AC_SUBST(HELPER_INCLUDES)
 
1169
AC_SUBST(MIBGROUP_INCLUDES)
 
1170
AC_SUBST(GNU_vpath)
 
1171
AC_SUBST(NON_GNU_VPATH)
 
1172
 
 
1173
 
 
1174
#
 
1175
# Check whether we can use -Ux -Dx=x with the expected behaviour
 
1176
#
 
1177
AC_MSG_CHECKING([whether to un-define target system token (before redefining)])
 
1178
OLD_CPPFLAGS="$CPPFLAGS"
 
1179
CPPFLAGS="-U$PARTIALTARGETOS -D$PARTIALTARGETOS=$PARTIALTARGETOS"
 
1180
 
 
1181
AC_EGREP_CPP(yes,[[
 
1182
#ifdef $PARTIALTARGETOS
 
1183
yes
 
1184
#endif
 
1185
]],
 
1186
[PARTIALTARGETFLAGS="-U$PARTIALTARGETOS -D$PARTIALTARGETOS=$PARTIALTARGETOS"
 
1187
 AC_MSG_RESULT([yes])],
 
1188
[PARTIALTARGETFLAGS="-D$PARTIALTARGETOS=$PARTIALTARGETOS"
 
1189
 AC_MSG_RESULT([no])])
 
1190
CFLAGS="$CFLAGS $PARTIALTARGETFLAGS"
 
1191
CPPFLAGS="$OLD_CPPFLAGS"
 
1192
AC_MSG_CACHE_ADD(Building for:               $PARTIALTARGETOS)
 
1193
 
 
1194
 
 
1195
#
 
1196
# check for special includes and pick one
 
1197
#
 
1198
 
 
1199
AC_MSG_CHECKING([for system include file])
 
1200
changequote(, )
 
1201
filebase=$target_os
 
1202
# ignore binary format indication
 
1203
filebase=`echo $filebase | sed 's/elf//'`
 
1204
filebase=`echo $filebase | sed 's/aout//'`
 
1205
filebase=`echo $filebase | sed 's/ecoff//'`
 
1206
filebase=`echo $filebase | sed 's/coff//'`
 
1207
while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/system/$filebase.h
 
1208
do
 
1209
    last=$filebase
 
1210
    filebase=`echo $filebase | sed 's/[-._][^-._]*$//'`
 
1211
    if test "x$filebase" = "x$last"; then
 
1212
        filebase=`echo $filebase | sed 's/[0-9]*$//'`
 
1213
    fi
 
1214
done
 
1215
 
 
1216
if test "x$filebase" = "x$last"; then
 
1217
    filebase="generic"
 
1218
fi
 
1219
ac_cv_NETSNMP_SYSTEM_INCLUDE_FILE="net-snmp/system/$filebase.h"
 
1220
 
 
1221
changequote([, ])
 
1222
AC_MSG_RESULT($ac_cv_NETSNMP_SYSTEM_INCLUDE_FILE)
 
1223
AC_DEFINE_UNQUOTED(NETSNMP_SYSTEM_INCLUDE_FILE, "$ac_cv_NETSNMP_SYSTEM_INCLUDE_FILE")
 
1224
 
 
1225
# second part, the CPU type.
 
1226
 
 
1227
AC_MSG_CHECKING([for machine-type include file])
 
1228
changequote(, )
 
1229
filebase=$target_cpu
 
1230
while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/machine/$filebase.h
 
1231
do
 
1232
    last=$filebase
 
1233
    filebase=`echo $filebase | sed 's/[-._][^-._]*$//'`
 
1234
done
 
1235
 
 
1236
if test "x$filebase" = "x$last"; then
 
1237
    filebase="generic"
 
1238
fi
 
1239
ac_cv_NETSNMP_MACHINE_INCLUDE_FILE="net-snmp/machine/$filebase.h"
 
1240
changequote([, ])
 
1241
AC_MSG_RESULT([$ac_cv_NETSNMP_MACHINE_INCLUDE_FILE])
 
1242
 
 
1243
AC_DEFINE_UNQUOTED(NETSNMP_MACHINE_INCLUDE_FILE, "$ac_cv_NETSNMP_MACHINE_INCLUDE_FILE")
 
1244
 
 
1245
AC_PATH_PROG([CCPATH],$CC)
 
1246
# watch out for /usr/ucb/cc on solaris, it doesn't work with this package.
 
1247
case $target_os in
 
1248
    bsdi*)
 
1249
        if test "x$CCPATH" = "x/usr/ucb/cc" -o "x$CCPATH" = "x/usr/bin/cc"; then
 
1250
            AC_MSG_ERROR([
 
1251
 
 
1252
*** The BSDI /usr/ucb/cc compiler does not work with this package.  
 
1253
*** Please run configure with --with-cc=gcc
 
1254
])
 
1255
        fi
 
1256
    ;;
 
1257
    solaris*)
 
1258
        if test "x$CCPATH" = "x/usr/ucb/cc"; then
 
1259
            AC_MSG_ERROR([
 
1260
 
 
1261
*** The solaris /usr/ucb/cc compiler does not work with this package.  
 
1262
*** Please put a different compiler in your path first or run
 
1263
*** configure with --with-cc=XX, where XX is the compiler you want to use.
 
1264
])
 
1265
        fi
 
1266
    ;;
 
1267
esac
 
1268
    
 
1269
AC_MSG_CHECKING([for additional cpp flags])
 
1270
# gcc extra CPPFLAGS
 
1271
if test "x$GCC" = "xyes" -a "x$CPP" = "x$CC -E"; then
 
1272
  # extra cpp flags for gnu c compiler to allow .in file extensions.
 
1273
  EXTRACPPFLAGS="-x c"
 
1274
else
 
1275
  EXTRACPPFLAGS=""
 
1276
fi
 
1277
 
 
1278
# Solaris extra cpp flags.
 
1279
if test "x$GCC" != "xyes"; then
 
1280
  case $target_os in
 
1281
    solaris*) EXTRACPPFLAGS="$EXTRACPPFLAGS -Xs" ;;
 
1282
  esac
 
1283
fi
 
1284
 
 
1285
AC_SUBST(EXTRACPPFLAGS)
 
1286
AC_MSG_RESULT($EXTRACPPFLAGS)
 
1287
 
 
1288
# Prefixes must begin with "/" or [A-Z] followed by colon.
 
1289
 
 
1290
if test "x$prefix" = "xNONE"; then
 
1291
  prefix=/usr/local
 
1292
fi
 
1293
 
 
1294
fch=`echo $prefix | sed 's/\(.\).*/\1/'`
 
1295
if test "x$fch" != "x/" ; then
 
1296
   sch=`echo $prefix | sed 's/.\(.\).*/\1/'`
 
1297
   if test "x$sch" != "x:" ; then
 
1298
      prefix=`pwd`/$prefix
 
1299
      echo "adjusting prefix to $prefix"
 
1300
   fi
 
1301
fi
 
1302
 
 
1303
if test "x$exec_prefix" = "xNONE"; then
 
1304
  exec_prefix=$prefix
 
1305
fi
 
1306
 
 
1307
fch=`echo $exec_prefix | sed 's/\(.\).*/\1/'`
 
1308
if test "x$fch" != "x/" ; then
 
1309
   sch=`echo $exec_prefix | sed 's/.\(.\).*/\1/'`
 
1310
   if test "x$sch" != "x:" ; then
 
1311
      exec_prefix=`pwd`/$exec_prefix
 
1312
      echo "adjusting exec_prefix to $exec_prefix"
 
1313
   fi
 
1314
fi
 
1315
 
 
1316
# Set SNMPLIBPATH & SNMPSHAREPATH
 
1317
 
 
1318
SNMPLIBPATH=""
 
1319
tmpset="$libdir/snmp"
 
1320
while test "x$tmpset" != "x$SNMPLIBPATH"; do
 
1321
  SNMPLIBPATH="$tmpset"
 
1322
  eval tmpset="$tmpset"
 
1323
done
 
1324
AC_DEFINE_UNQUOTED(SNMPLIBPATH,"$SNMPLIBPATH")
 
1325
AC_SUBST(SNMPLIBPATH)
 
1326
AC_DEFINE_UNQUOTED(SNMPDLMODPATH,"$SNMPLIBPATH/dlmod")
 
1327
 
 
1328
SNMPSHAREPATH=""
 
1329
tmpset="$datadir/snmp"
 
1330
while test "x$tmpset" != "x$SNMPSHAREPATH"; do
 
1331
  SNMPSHAREPATH="$tmpset"
 
1332
  eval tmpset="$tmpset"
 
1333
done
 
1334
AC_DEFINE_UNQUOTED(SNMPSHAREPATH,"$SNMPSHAREPATH")
 
1335
AC_SUBST(SNMPSHAREPATH)
 
1336
 
 
1337
if test "x$NETSNMP_DEFAULT_MIBDIRS" = "x"; then
 
1338
  NETSNMP_DEFAULT_MIBDIRS="\$HOME/.snmp/mibs:$SNMPSHAREPATH/mibs"
 
1339
  if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc" -o "x$PARTIALTARGETOS" = "xcygwin"; then
 
1340
    NETSNMP_DEFAULT_MIBDIRS=`echo "$NETSNMP_DEFAULT_MIBDIRS" | $SED 's/:/;/g'`
 
1341
  fi
 
1342
  AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_MIBDIRS,"$NETSNMP_DEFAULT_MIBDIRS")
 
1343
fi
 
1344
AC_SUBST(NETSNMP_DEFAULT_MIBDIRS)
 
1345
 
 
1346
SNMPCONFPATH=""
 
1347
tmpset="$sysconfdir/snmp"
 
1348
while test "x$tmpset" != "x$SNMPCONFPATH"; do
 
1349
  SNMPCONFPATH="$tmpset"
 
1350
  eval tmpset="$tmpset"
 
1351
done
 
1352
AC_DEFINE_UNQUOTED(SNMPCONFPATH,"$SNMPCONFPATH")
 
1353
AC_SUBST(SNMPCONFPATH)
 
1354
 
 
1355
AC_CHECK_SIZEOF(short)
 
1356
AC_CHECK_SIZEOF(int)
 
1357
AC_CHECK_SIZEOF(long)
 
1358
AC_CHECK_SIZEOF(long long)
 
1359
AC_CHECK_SIZEOF(intmax_t)
 
1360
AC_CHECK_TYPES([int8_t,  uint8_t,  u_int8_t])
 
1361
AC_CHECK_TYPES([int16_t, uint16_t, u_int16_t])
 
1362
AC_CHECK_TYPES([int32_t, uint32_t, u_int32_t])
 
1363
AC_CHECK_TYPES([int64_t, uint64_t, u_int64_t])
 
1364
AC_CHECK_TYPES([intmax_t, uintmax_t])
 
1365
AC_CHECK_TYPES([off64_t])
 
1366
AC_CHECK_TYPES([uintptr_t, intptr_t])
 
1367
 
 
1368
# solaris specific type
 
1369
AC_CHECK_TYPES([Counter64],,,[#include <inet/mib2.h>])
 
1370
 
 
1371
# guess IPv6 stack type.
 
1372
if test "x$enable_ipv6" = "xyes"; then
 
1373
        v6type=unknown
 
1374
        v6lib=none
 
1375
        v6trylibc=no
 
1376
 
 
1377
        AC_MSG_CHECKING([[ipv6 stack type]])
 
1378
        for i in v6d toshiba kame inria zeta linux-glibc linux-inet6 generic; do
 
1379
                case $i in
 
1380
                v6d)
 
1381
                        AC_EGREP_CPP(yes, [
 
1382
#include </usr/local/v6/include/sys/types.h>
 
1383
#ifdef __V6D__
 
1384
yes
 
1385
#endif],
 
1386
                                [v6type=$i; v6lib=v6;
 
1387
                                v6libdir=/usr/local/v6/lib;
 
1388
                                CFLAGS="-I/usr/local/v6/include $CFLAGS"])
 
1389
                        ;;
 
1390
                toshiba)
 
1391
                        AC_EGREP_CPP(yes, [
 
1392
#include <sys/param.h>
 
1393
#ifdef _TOSHIBA_INET6
 
1394
yes
 
1395
#endif],
 
1396
                                [v6type=$i; v6lib=inet6;
 
1397
                                v6libdir=/usr/local/v6/lib;
 
1398
                                CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"])
 
1399
                        ;;
 
1400
                kame)
 
1401
                        AC_EGREP_CPP(yes, [
 
1402
#include <netinet/in.h>
 
1403
#ifdef __KAME__
 
1404
yes
 
1405
#endif],
 
1406
                                [v6type=$i; v6lib=inet6;
 
1407
                                v6libdir=/usr/local/v6/lib;
 
1408
                                v6trylibc=yes;
 
1409
                                CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"])
 
1410
                        ;;
 
1411
                inria)
 
1412
                        AC_EGREP_CPP(yes, [
 
1413
#include <netinet/in.h>
 
1414
#ifdef IPV6_INRIA_VERSION
 
1415
yes
 
1416
#endif],
 
1417
                                [v6type=$i;
 
1418
                                v6lib=dummy;
 
1419
                                v6libdir=none;
 
1420
                                v6trylibc=yes;
 
1421
                                CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"])
 
1422
                        ;;
 
1423
                zeta)
 
1424
                        AC_EGREP_CPP(yes, [
 
1425
#include <sys/param.h>
 
1426
#ifdef _ZETA_MINAMI_INET6
 
1427
A
 
1428
yes
 
1429
#endif],
 
1430
                                [v6type=$i; v6lib=inet6;
 
1431
                                v6libdir=/usr/local/v6/lib;
 
1432
                                CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"])
 
1433
                        ;;
 
1434
                linux-glibc)
 
1435
                        AC_EGREP_CPP(yes, [
 
1436
#include <features.h>
 
1437
#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC_ > 2))
 
1438
yes
 
1439
#endif],
 
1440
                                [v6type=$i;
 
1441
                                v6lib=dummy;
 
1442
                                v6libdir=none;
 
1443
                                v6trylibc=yes;
 
1444
                                CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"])
 
1445
                        ;;
 
1446
                linux-inet6)
 
1447
                        if test -d /usr/inet6; then
 
1448
                                v6type=$i
 
1449
                                v6lib=inet6
 
1450
                                v6libdir=/usr/inet6/lib
 
1451
                                CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"
 
1452
                        fi
 
1453
                        ;;
 
1454
                generic)
 
1455
                        AC_MSG_RESULT([[postponed]])
 
1456
                        AC_CHECK_STRUCT_FOR([
 
1457
#include <sys/types.h>
 
1458
#include <sys/param.h>
 
1459
#include <sys/socket.h>
 
1460
#include <netinet/in.h>
 
1461
], sockaddr_in6, sin6_addr, no)
 
1462
                        AC_MSG_CHECKING([[ipv6 stack type]])
 
1463
                        if test "x$ac_cv_struct_sockaddr_in6_has_sin6_addr" = "xyes"; then
 
1464
                                v6type=$i
 
1465
                                v6lib=dummy
 
1466
                                v6libdir=none
 
1467
                                v6trylibc=yes
 
1468
                                CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"
 
1469
                        fi
 
1470
                        ;;
 
1471
                esac
 
1472
                if test "$v6type" != "unknown"; then
 
1473
                        break
 
1474
                fi
 
1475
        done
 
1476
 
 
1477
        if test "$v6lib" != "none"; then
 
1478
                if test -d $v6libdir -a -f $v6libdir/lib$v6lib.a; then
 
1479
                        LIBS="-L$v6libdir -l$v6lib $LIBS"
 
1480
                        enable_ipv6="yes"
 
1481
                        AC_MSG_RESULT(["$v6type, $enable_ipv6, using lib$v6lib"])
 
1482
                elif test "$v6trylibc" = "yes"; then
 
1483
                        enable_ipv6="yes"
 
1484
                        AC_MSG_RESULT(["$v6type, $enable_ipv6, using libc"])
 
1485
                else
 
1486
                        AC_MSG_ERROR(no IPv6 library lib$v6lib.a found.)
 
1487
                        exit 1
 
1488
                fi
 
1489
        else
 
1490
                enable_ipv6="no"
 
1491
                AC_MSG_RESULT(["$v6type, $enable_ipv6"])
 
1492
        fi
 
1493
fi
 
1494
 
 
1495
#
 
1496
# Maybe add library extensions for thread mutex locking.
 
1497
#
 
1498
 
 
1499
if test "x$with_res_locks" = "xyes"; then
 
1500
  AC_DEFINE(NETSNMP_REENTRANT)
 
1501
 
 
1502
    case $target_os in
 
1503
 
 
1504
    aix*)
 
1505
        CC_RUNTIME_ARG="$CC_RUNTIME_ARG -lpthreads"
 
1506
        ;;
 
1507
 
 
1508
    *)
 
1509
        ;;
 
1510
 
 
1511
    esac
 
1512
fi
 
1513
 
 
1514
#
 
1515
# Add platform-specific source files.
 
1516
#
 
1517
AC_MSG_CHECKING([for platform-specific source])
 
1518
other_src_list=""
 
1519
other_objs_list=""
 
1520
other_lobjs_list=""
 
1521
other_agentobjs=""
 
1522
other_lagentobjs=""
 
1523
other_trapd_objects=""
 
1524
 
 
1525
# Win32 service code
 
1526
if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc"; then
 
1527
  other_src_list="$other_src_list winservice.c winservicerc.rc"
 
1528
  other_objs_list="$other_objs_list winservice.o winservicerc.o"
 
1529
  other_lobjs_list="$other_lobjs_list winservice.lo winservicerc.lo"
 
1530
  other_agentobjs="../snmplib/winservicerc.o"
 
1531
  other_lagentobjs="../snmplib/winservicerc.lo"
 
1532
  other_trapd_objects="../snmplib/winservicerc.o" 
 
1533
fi
 
1534
  
 
1535
# Win32 pipes
 
1536
if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc" -o "x$PARTIALTARGETOS" = "xcygwin"; then
 
1537
  other_src_list="$other_src_list winpipe.c"
 
1538
  other_objs_list="$other_objs_list winpipe.o"
 
1539
  other_lobjs_list="$other_lobjs_list winpipe.lo"
 
1540
fi
 
1541
 
 
1542
AC_SUBST(other_src_list)
 
1543
AC_SUBST(other_objs_list)
 
1544
AC_SUBST(other_lobjs_list)
 
1545
AC_SUBST(other_agentobjs)
 
1546
AC_SUBST(other_lagentobjs)
 
1547
AC_SUBST(other_trapd_objects)
 
1548
 
 
1549
AC_MSG_RESULT([$other_src_list $other_objs_list $other_lobjs_list])
 
1550
AC_MSG_RESULT([$other_agentobjs $other_lagentobjs $other_trapd_objects])
 
1551
  
 
1552
#
 
1553
# Do transport module processing.
 
1554
#
 
1555
AC_MSG_CHECKING([for and configuring transport modules to use])
 
1556
transport_src_list=""
 
1557
transport_hdr_list=""
 
1558
transport_def_list=""
 
1559
transport_result_list=""
 
1560
transport_add_list=""
 
1561
transport_callback_disabled=""
 
1562
new_with_transport_list=`echo $with_transports | sed 's/,/ /g;'`
 
1563
new_with_out_transport_list=`echo $with_out_transports | sed 's/,/ /g;'`
 
1564
 
 
1565
#
 
1566
# Add the default transports to the list
 
1567
#
 
1568
if test "x$PARTIALTARGETOS" = "xcygwin"; then
 
1569
  transport_default_list="UDP TCP Callback"
 
1570
elif test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc"; then 
 
1571
  transport_default_list="UDP TCP Callback"
 
1572
else
 
1573
  transport_default_list="UDP TCP Unix Callback"
 
1574
fi
 
1575
if test "x$enable_ipv6" = "xyes"; then
 
1576
  transport_default_list="UDPIPv6 TCPIPv6 $transport_default_list"
 
1577
fi
 
1578
for i in $transport_default_list; do
 
1579
  if echo " $new_with_transport_list " | grep " $i " >/dev/null; then
 
1580
    :
 
1581
  else
 
1582
    transport_add_list="$i $transport_add_list"
 
1583
  fi
 
1584
done
 
1585
new_transport_list="$transport_add_list $new_with_transport_list"
 
1586
 
 
1587
for i in $new_transport_list; do
 
1588
  if echo " $new_with_out_transport_list " | grep " $i " >/dev/null; then
 
1589
    if test "x$i" = "xUDP"; then
 
1590
      echo
 
1591
      AC_MSG_ERROR(It is not possible to compile without UDP/IP support.)
 
1592
    elif test "x$i" = "xCallback"; then
 
1593
      echo
 
1594
      transport_callback_disabled="yes"
 
1595
    fi
 
1596
  else
 
1597
    if test "x$i" = "xAAL5PVC"; then
 
1598
      if test "x$PARTIALTARGETOS" != "xlinux"; then
 
1599
        echo
 
1600
        AC_MSG_ERROR(AAL5 PVC support unavailable for this platform (Linux only))
 
1601
      fi
 
1602
    fi
 
1603
    if test "x$i" = "xIPX"; then
 
1604
      if test "x$PARTIALTARGETOS" != "xlinux"; then
 
1605
        echo
 
1606
        AC_MSG_ERROR(IPX support unavailable for this platform (Linux only))
 
1607
      fi
 
1608
    fi
 
1609
    if test "x$i" = "xUnix"; then
 
1610
      if test "x$PARTIALTARGETOS" = "xcygwin"; then
 
1611
        echo
 
1612
        AC_MSG_ERROR(Unix domain protocol support unavailable for this platform)
 
1613
      elif test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc"; then
 
1614
        echo
 
1615
        AC_MSG_ERROR(Unix domain protocol support unavailable for this platform)
 
1616
      fi
 
1617
    fi
 
1618
    if test ! "x$enable_ipv6" = "xyes"; then
 
1619
        if test "x$i" = "xUDPIPv6" -o "x$i" = "xTCPIPv6"; then
 
1620
            echo
 
1621
            AC_MSG_ERROR(IPv6 transports not available if IPv6 support is not enabled)
 
1622
        fi
 
1623
    fi
 
1624
    transport_src="snmp"$i"Domain.c"
 
1625
    transport_hdr="snmp"$i"Domain.h"
 
1626
    rel_transport_src="snmplib/"$transport_src
 
1627
    rel_transport_hdr="include/net-snmp/library/"$transport_hdr
 
1628
    if test -f "$srcdir/$rel_transport_src"; then
 
1629
      transport_result_list="$transport_result_list $i"
 
1630
      transport_src_list="$transport_src $transport_src_list"
 
1631
      if test -f "$srcdir/$rel_transport_hdr"; then
 
1632
        transport_hdr_list="$transport_hdr $transport_hdr_list"
 
1633
      fi
 
1634
      transport_def=`echo $i | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
 
1635
      transport_def_list="NETSNMP_TRANSPORT_"$transport_def"_DOMAIN $transport_def_list"
 
1636
    else
 
1637
      echo
 
1638
      AC_MSG_ERROR(Cannot find file $srcdir/$rel_transport_src to support SNMP transport domain $i.)
 
1639
    fi
 
1640
  fi
 
1641
done
 
1642
transport_obj_list=`echo " $transport_src_list " | sed 's/\.c/\.o/g'`    
 
1643
transport_lobj_list=`echo " $transport_src_list " | sed 's/\.c/\.lo/g'`
 
1644
 
 
1645
## win32 platforms require inet_ntop etc.
 
1646
if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc"; then
 
1647
  if echo "$transport_def_list" | grep "IPV6" >/dev/null; then
 
1648
    transport_obj_list="$transport_obj_list inet_ntop.o inet_pton.o"
 
1649
    transport_lobj_list="$transport_lobj_list inet_ntop.lo inet_pton.lo"
 
1650
  fi
 
1651
fi
 
1652
 
 
1653
AC_SUBST(transport_hdr_list)
 
1654
AC_SUBST(transport_src_list)
 
1655
AC_SUBST(transport_obj_list)
 
1656
AC_SUBST(transport_lobj_list)
 
1657
for i in $transport_def_list; do
 
1658
  AC_DEFINE_UNQUOTED($i)
 
1659
done
 
1660
AC_MSG_RESULT($transport_result_list.)
 
1661
AC_MSG_CACHE_ADD(Network transport support: $transport_result_list)
 
1662
 
 
1663
#
 
1664
# Security modules to use
 
1665
 
1666
 
 
1667
AC_MSG_CHECKING([for security modules to use])
 
1668
security_def_list="usm"
 
1669
security_src_list=""
 
1670
security_obj_list=""     
 
1671
security_lobj_list=""
 
1672
security_init_file="snmplib/snmpsm_init.h"
 
1673
security_incl_file="include/net-snmp/library/snmpv3-security-includes.h"
 
1674
new_with_security=`echo $with_security_modules | sed 's/,/ /g;'`
 
1675
new_with_out_security=`echo $with_out_security_modules | sed 's/,/ /g;'`
 
1676
 
 
1677
if test ! -d include; then
 
1678
  mkdir include
 
1679
fi
 
1680
if test ! -d include/net-snmp; then
 
1681
  mkdir include/net-snmp
 
1682
fi
 
1683
if test ! -d include/net-snmp/agent; then
 
1684
  mkdir include/net-snmp/agent
 
1685
fi
 
1686
if test ! -d include/net-snmp/library; then
 
1687
  mkdir include/net-snmp/library
 
1688
fi
 
1689
if test ! -d include/ucd-snmp; then
 
1690
  mkdir include/ucd-snmp
 
1691
fi
 
1692
 
 
1693
if test ! -d snmplib; then
 
1694
  mkdir snmplib
 
1695
fi
 
1696
echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $security_init_file
 
1697
echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $security_incl_file
 
1698
 
 
1699
for i in $security_def_list; do
 
1700
  if echo " $new_with_out_security " | grep " $i " > /dev/null; then
 
1701
    if test "x$i" = "xusm"; then
 
1702
        echo
 
1703
        AC_MSG_ERROR(The USM security module is mandatory)
 
1704
    fi
 
1705
  else
 
1706
    new_with_security="$new_with_security $i"
 
1707
  fi
 
1708
done
 
1709
 
 
1710
for i in $new_with_security; do
 
1711
  cfile="snmp"$i".c"
 
1712
  hfile="snmp"$i".h"
 
1713
 
 
1714
  # make sure support exists for it
 
1715
  if test -f $srcdir"/snmplib/"$cfile -a -f $srcdir"/include/net-snmp/library/"$hfile; then
 
1716
    :
 
1717
  else
 
1718
    echo
 
1719
    AC_MSG_ERROR(No such security module: $i / $cfile / $hfile)
 
1720
  fi
 
1721
 
 
1722
  # define a bunch of stuff to enable it
 
1723
  security_src_list="$security_src_list $cfile"
 
1724
  security_hdr_list="$security_hdr_list $hfile"
 
1725
  security_obj_list="$security_obj_list snmp"$i".o"      
 
1726
  security_lobj_list="$security_lobj_list snmp"$i".lo"
 
1727
  def_name="NETSNMP_SECMOD_"`echo $i | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
 
1728
  echo "init_"$i"();" >> $security_init_file
 
1729
  echo "#include <net-snmp/library/$hfile>" >> $security_incl_file
 
1730
  AC_DEFINE_UNQUOTED($def_name)
 
1731
done
 
1732
 
 
1733
AC_SUBST(security_src_list)
 
1734
AC_SUBST(security_hdr_list)
 
1735
AC_SUBST(security_obj_list)      
 
1736
AC_SUBST(security_lobj_list)
 
1737
AC_MSG_RESULT($new_with_security)
 
1738
AC_MSG_CACHE_ADD(SNMPv3 Security Modules:    $new_with_security)
 
1739
 
 
1740
#
 
1741
# Handle the special case of KSM to see which crypto API we support
 
1742
#
 
1743
 
 
1744
ac_cv_NETSNMP_USE_KERBEROS_MIT=no
 
1745
rebuilt_new_with_security=
 
1746
already_checked_krb5=no
 
1747
 
 
1748
for sec in $new_with_security
 
1749
do
 
1750
  if test "x$sec" = "xksm" -a "xyes" = "x$already_checked_krb5"; then
 
1751
    continue
 
1752
  fi
 
1753
  already_checked_krb5=yes
 
1754
 
 
1755
  if test x$sec != xksm; then
 
1756
    rebuilt_new_with_security="$rebuilt_new_with_security $sec"
 
1757
  else
 
1758
    if test no = $trykrb5; then
 
1759
      AC_MSG_NOTICE([configured not to use krb5. disabling ksm])
 
1760
      continue
 
1761
    fi
 
1762
 
 
1763
    AC_PATH_PROG([krb5_config],krb5-config,[no],$krb5path/bin:$PATH)
 
1764
 
 
1765
    if test no != $krb5_config; then
 
1766
      CPPFLAGS="$CPPFLAGS `$krb5_config --cflags`"
 
1767
      LIBS="$LIBS `$krb5_config --libs`"
 
1768
    elif test $krb5path != no; then
 
1769
      AC_ADD_SEARCH_PATH($krb5path)
 
1770
    else
 
1771
      AC_ADD_SEARCH_PATH(/usr/kerberos)
 
1772
    fi
 
1773
 
 
1774
    AC_MSG_CHECKING([for krb5])
 
1775
    AC_CACHE_VAL(ac_cv_have_krb5,
 
1776
      AC_CHECK_LIB(krb5, krb5_init_context,
 
1777
        ac_cv_have_krb5=yes, ac_cv_have_krb5=no
 
1778
      )
 
1779
    )
 
1780
 
 
1781
    if test $ac_cv_have_krb5 = no; then
 
1782
      if test "x$askedkrb5" = "xyes"; then
 
1783
        AC_MSG_ERROR(Asked to use krb5 but I couldn't find it.)
 
1784
      fi
 
1785
      AC_MSG_RESULT(no. disabling ksm)
 
1786
      continue
 
1787
    fi
 
1788
      
 
1789
    AC_MSG_RESULT(yes)
 
1790
    rebuilt_new_with_security="$rebuilt_new_with_security ksm"
 
1791
 
 
1792
    AC_MSG_CHECKING([[for heimdal]])
 
1793
    AC_CACHE_VAL(ac_cv_heimdal,
 
1794
    [AC_TRY_COMPILE(
 
1795
      [#include <krb5.h>],
 
1796
      [const char *v = heimdal_version;],
 
1797
      ac_cv_heimdal=yes,
 
1798
      ac_cv_heimdal=no
 
1799
    )])
 
1800
    AC_MSG_RESULT($ac_cv_heimdal)
 
1801
    if test $ac_cv_heimdal = yes; then
 
1802
      AC_DEFINE(NETSNMP_USE_KERBEROS_HEIMDAL)
 
1803
      if test no = $krb5_config; then
 
1804
        LIBS="$LIBS -lkrb5 -lasn1 -lcom_err -lroken"
 
1805
      fi
 
1806
    elif test no = $krb5_config; then
 
1807
        LIBS="$LIBS -lkrb5 -lcom_err"
 
1808
    fi
 
1809
 
 
1810
    AC_MSG_CHECKING([to see which crypto API we need to use])
 
1811
    AC_CHECK_FUNC(krb5_c_encrypt,[
 
1812
    AC_CACHE_VAL(ac_cv_NETSNMP_USE_KERBEROS_MIT,
 
1813
      AC_CHECK_LIB(k5crypto, krb5_init_context,
 
1814
        ac_cv_NETSNMP_USE_KERBEROS_MIT=yes, ac_cv_MIT_NEW_CRYPTo=no
 
1815
      )
 
1816
    )
 
1817
 
 
1818
    if test yes = $ac_cv_NETSNMP_USE_KERBEROS_MIT; then
 
1819
      AC_MSG_RESULT(new MIT crypto API)
 
1820
      AC_DEFINE(NETSNMP_USE_KERBEROS_MIT)
 
1821
      if test no = $krb5_config; then
 
1822
        LIBS="$LIBS -lk5crypto"
 
1823
      fi
 
1824
    else
 
1825
      AC_MSG_RESULT(old MIT crypto API)])
 
1826
    fi
 
1827
  fi
 
1828
done
 
1829
 
 
1830
new_with_security=$rebuilt_new_with_security
 
1831
 
 
1832
#
 
1833
# generate empty files
 
1834
#
 
1835
# Create include file list for snmp_vars.h to use.
 
1836
mibdir="agent/mibgroup"
 
1837
if test ! -d agent; then
 
1838
  mkdir agent
 
1839
fi
 
1840
if test ! -d agent/mibgroup; then
 
1841
  mkdir agent/mibgroup
 
1842
fi
 
1843
j="$mibdir/mib_module_includes.h  $mibdir/agent_module_includes.h \
 
1844
   $mibdir/mib_module_inits.h     $mibdir/agent_module_inits.h    \
 
1845
   $mibdir/mib_module_shutdown.h  $mibdir/agent_module_shutdown.h \
 
1846
   include/net-snmp/agent/mib_module_config.h                     \
 
1847
                   include/net-snmp/agent/agent_module_config.h   \
 
1848
   $mibdir/mib_module_dot_conf.h  $mibdir/agent_module_dot_conf.h"
 
1849
 
 
1850
for i in $j; do
 
1851
  rm -f $i
 
1852
  echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $i
 
1853
done
 
1854
 
 
1855
#
 
1856
# Do hairy agent module processing.
 
1857
#
 
1858
AC_MSG_CHECKING([for and configuring mib modules to use])
 
1859
 
 
1860
# set up the CPP command
 
1861
MODULECPP="$CPP $PARTIALTARGETFLAGS -I${srcdir}/include -I${srcdir}/agent/mibgroup"
 
1862
if test "x$enable_mfd_rewrites" = "xyes"; then
 
1863
  MODULECPP="$MODULECPP -DNETSNMP_ENABLE_MFD_REWRITES"
 
1864
fi
 
1865
 
 
1866
module_list=""
 
1867
mib_module_list=""
 
1868
agent_module_list=""
 
1869
new_with_mib_modules=`echo $with_mib_modules | sed 's/,/ /g;'`
 
1870
new_with_out_mib_modules=`echo $with_out_mib_modules | sed 's/,/ /g;'`
 
1871
 
 
1872
# set up initial module list
 
1873
new_module_list="$new_with_mib_modules default_modules"
 
1874
 
 
1875
# minor modifications
 
1876
if test "x$enable_agent" = "xno"; then
 
1877
   # minimum mib module list for snmptrapd
 
1878
   new_module_list="mibII/vacm_vars mibII/vacm_conf utilities/execute $new_with_mib_modules"
 
1879
   default_mibs=SNMPv2-MIB:RFC1213-MIB
 
1880
   default_mibs_install=" "
 
1881
elif test "x$mini_agent" = "xyes"; then
 
1882
   # define the mini agent flag to reduce our load list from default_mibs.h
 
1883
   MODULECPP="$MODULECPP -DNETSNMP_MINI_AGENT"
 
1884
fi
 
1885
 
 
1886
test_modules="$new_module_list"
 
1887
new_module_list=""
 
1888
 
 
1889
# remove modules that were explicitly excluded
 
1890
for i in $test_modules
 
1891
 do
 
1892
  if echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
 
1893
    mib_cfg_msg="mib module '$i' is both included and excluded."
 
1894
    AC_MSG_WARN([mib module conflict])
 
1895
    if test "x$with_mib_cfg_checks" = "xyes"; then
 
1896
      AC_MSG_WARN([user with    : $with_mib_modules])
 
1897
      AC_MSG_WARN([final with   : $new_module_list])
 
1898
      AC_MSG_WARN([user without : $with_out_mib_modules])
 
1899
      AC_MSG_WARN([final without: $new_with_out_mib_modules])
 
1900
      AC_MSG_ERROR([$mib_cfg_msg])
 
1901
    else
 
1902
      AC_MSG_WARN([$mib_cfg_msg It will be excluded])
 
1903
      AC_MSG_CACHE_ADD([*** MIB Module warning *** $mib_cfg_msg It has been excluded.])
 
1904
    fi
 
1905
  else
 
1906
    new_module_list="$new_module_list $i"
 
1907
  fi
 
1908
done
 
1909
 
 
1910
AC_MSG_RESULT([$new_module_list.])
 
1911
 
 
1912
#---------------------
 
1913
# loop over module list
 
1914
#
 
1915
all_warnings=""
 
1916
if test "x$with_mib_cfg_debug" = "xyes"; then
 
1917
   module_debug=1
 
1918
else
 
1919
   module_debug=0
 
1920
fi
 
1921
first_pass=1
 
1922
output_to=normal
 
1923
 
 
1924
if test ! -d mk ; then
 
1925
  mkdir mk
 
1926
fi
 
1927
 
 
1928
 
 
1929
module_rules=mk/module_rules.mk
 
1930
echo "# contents below built automatically by configure; do not edit by hand" > $module_rules
 
1931
 
 
1932
#
 
1933
# make file sub-pieces
 
1934
#
 
1935
for i in module_list_deps mib_module_list_deps agent_module_list_deps ; do
 
1936
  eval "$i=mk/${i}.mk"
 
1937
  echo "# contents below built automatically by configure; do not edit by hand" > mk/${i}.mk
 
1938
done
 
1939
 
 
1940
#
 
1941
# variable settings sub-pieces
 
1942
#
 
1943
for i in module_list_code mib_module_list_code agent_module_list_code module_list mib_module_list agent_module_list ; do
 
1944
  eval "$i=mk/${i}.mk"
 
1945
  echo "# contents below built automatically by configure; do not edit by hand" > mk/${i}.mk
 
1946
  echo "$i= \\" >> mk/${i}.mk
 
1947
done
 
1948
 
 
1949
echo $ECHO_N "echo " $ECHO_C > mk/MODULE_LIST.mk
 
1950
MODULE_LIST=mk/MODULE_LIST.mk
 
1951
 
 
1952
 
 
1953
#---------------------
 
1954
# until we have an empty module list...
 
1955
#   (modules may add new modules, and until all dependencies are done...)
 
1956
#
 
1957
while test "x$new_module_list" != "x"; do
 
1958
  AC_MSG_MODULE_DBG(-e,"\n****************************************************************")
 
1959
  AC_MSG_MODULE_DBG("nml: $new_module_list")
 
1960
 
 
1961
  #---------------------
 
1962
  # loop over all the modules in the current list
 
1963
  #
 
1964
  for j in $new_module_list
 
1965
    do
 
1966
 
 
1967
    #---------------------
 
1968
    # figure out which sub-blocks to build in parts
 
1969
    if echo "$j" | grep "=" ; then
 
1970
       # build a shared object file
 
1971
       # format: sofilename=module1:module2
 
1972
       # XXX: currently doesn't do this
 
1973
       dl_name=`echo $j | sed 's/=.*//'`
 
1974
       dl_names="$dl_names $dl_name"
 
1975
       dl_objects=`echo $j | sed 's/.*=//'`
 
1976
       module_sublist=`echo $dl_objects | sed 's/:/ /g'`
 
1977
       saved_sublist=""
 
1978
       saved_sublist_code=""
 
1979
       output_to=separate
 
1980
 
 
1981
       # create output files
 
1982
       # these actually get nuked later
 
1983
       output_inits="agent/mibgroup/${dl_name}-dll.c"
 
1984
       output_hdrs="agent/mibgroup/${dl_name}-hdrs.h"
 
1985
    else
 
1986
       # not a special token invocation
 
1987
       module_sublist=$j
 
1988
       output_to=normal
 
1989
       output_t=
 
1990
    fi
 
1991
 
 
1992
    while test "x$module_sublist" != "x" ; do
 
1993
 
 
1994
    #---------------------
 
1995
    # loop over all the modules in the sub list
 
1996
    for i in $module_sublist
 
1997
    do
 
1998
 
 
1999
    AC_MSG_MODULE_DBG(-e "\n================================================================")
 
2000
    AC_MSG_MODULE_DBG("testing $i")
 
2001
    need_header=0
 
2002
 
 
2003
    #---------------------
 
2004
    # build a pseudo include header that includes current config and
 
2005
    # system symbols:
 
2006
    AC_LANG_CONFTEST(AC_LANG_SOURCE([[
 
2007
#include NETSNMP_SYSTEM_INCLUDE_FILE
 
2008
#include "$srcdir/$mibdir/$i.h"]]))
 
2009
    mv conftest.$ac_ext module_tmp_header.h
 
2010
 
 
2011
    #---------------------
 
2012
    # macro: config_belongs_in(ARG)
 
2013
    #   ARG: either
 
2014
    #     - mib_module   => libnetsnmpmibs   (default)
 
2015
    #     - agent_module => libnetsnmpagent
 
2016
    #
 
2017
    module_type=mib_module
 
2018
    if test -f $srcdir/$mibdir/$i.h; then
 
2019
      changequote(, )
 
2020
      module_type=`$MODULECPP module_tmp_header.h | grep config_belongs_in | sed 's@.*config_belongs_in(\([^)]*\)).*@\1@'`
 
2021
      changequote([, ])
 
2022
    fi
 
2023
    if test "x$module_type" = "x" ; then
 
2024
      module_type=mib_module
 
2025
    fi
 
2026
    if test "x$output_to" = "xnormal" ; then
 
2027
        output_inits="$mibdir/${module_type}_inits.h"
 
2028
        output_hdrs="$mibdir/${module_type}_includes.h"
 
2029
    fi
 
2030
 
 
2031
    #--------------------
 
2032
    # check for duplicates within the dll system. 
 
2033
    #   - if found in a dll, then remove from the dll and add to main
 
2034
    dblfix=""
 
2035
    for dltest in $dl_names ; do
 
2036
      eval mod_files="\"\$dl_${dltest}_files\""
 
2037
      if echo " $mod_files " | grep " $i " > /dev/null; then
 
2038
        # some dll module has already seen this, unload it from that list
 
2039
        # and include it in the core (again)
 
2040
        AC_MSG_MODULE_DBG("removing $i from $dltest")
 
2041
        mod_files=`echo " $mod_files " | sed "s@ $i @@"`
 
2042
        dblfix="__XXX__"
 
2043
        eval "dl_${dltest}_files=\"$mod_files\""
 
2044
 
 
2045
        module_list="$module_list $i"
 
2046
        echo "read_config.lo: mibgroup/$i.h" >> $module_list_deps
 
2047
        if test $module_type = "agent_module" ; then
 
2048
            echo "snmp_vars.lo: mibgroup/$i.h" >> $agent_module_list_deps
 
2049
        else
 
2050
            echo "mib_modules.lo: mibgroup/$i.h" >> $mib_module_list_deps
 
2051
        fi
 
2052
        eval ${module_type}_list="\"\$${module_type}_list $i\""
 
2053
        echo "  $i \\" >> $module_list_code
 
2054
        echo $ECHO_N " $i" $ECHO_C >> $MODULE_LIST
 
2055
        eval tmpfilevar=\$`echo ${module_type}_list_code`
 
2056
        echo "  $i \\" >> $tmpfilevar
 
2057
 
 
2058
        # XXX: add this to the main init list; this is possible not
 
2059
        # quite in the right spot any longer but we're stuck with it.
 
2060
        # Adding it back to the original ordered spot would be a
 
2061
        # nightmare.  Ok, we're already in nightmare code so that
 
2062
        # wolud have to be a night-terror.
 
2063
        mnm=`echo $i | sed 's/.*\///;s/\.c$//;'`
 
2064
        output_inits_tmp="$mibdir/${module_type}_inits.h"
 
2065
        echo "  if (should_init(\"$mnm\")) init_$mnm();" >> $output_inits_tmp
 
2066
        # XXX: even worse, we loose whether the header is needed or not.
 
2067
        output_hdrs_tmp="$mibdir/${module_type}_includes.h"
 
2068
        echo '#include "'"mibgroup/$i.h"'"' >> $output_hdrs_tmp
 
2069
      fi
 
2070
    done
 
2071
 
 
2072
    #---------------------
 
2073
    # make sure module wasn't explicitly excluded, or already added
 
2074
    #
 
2075
    if test "x$dblfix" != "x" ; then
 
2076
      AC_MSG_MODULE_DBG("$i was duplicated -- putting into main")
 
2077
    elif echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
 
2078
      AC_MSG_MODULE_DBG("$i was excluded")
 
2079
    elif echo " $module_list " | grep " $i " > /dev/null; then
 
2080
      AC_MSG_MODULE_DBG("$i already tested")
 
2081
    else
 
2082
 
 
2083
      #---------------------
 
2084
      # process modules header, checking for config_ pseudo-macros
 
2085
      #
 
2086
 
 
2087
      #---------------------
 
2088
      # does the header file for the module exist?
 
2089
      #   macros are only processed if it does
 
2090
      if test -f $srcdir/$mibdir/$i.h; then
 
2091
        new_list=""
 
2092
 
 
2093
        #---------------------
 
2094
        # macro: config_exclude(modules)
 
2095
        #  - lists conflicts with other modules
 
2096
        #    - EG: new MIB implementations exclude old and vice-versa
 
2097
        #
 
2098
        # check if $i has any conflicts
 
2099
        #
 
2100
        new_list_excl=`$MODULECPP module_tmp_header.h | grep config_exclude | sed 's/.*config_exclude(\(.*\)).*/\1/'`
 
2101
        if test "x$new_list_excl" != "x"; then
 
2102
          AC_MSG_MODULE_DBG("$i excludes $new_list_excl")
 
2103
          for j in $new_list_excl
 
2104
            do
 
2105
            if echo " $module_list $new_mib_module_list $new_list_two " | grep " $j " > /dev/null; then
 
2106
              mib_cfg_msg="mib module '$i' excludes module '$j' but another module requires it"
 
2107
              AC_MSG_WARN([mib module error])
 
2108
              if test "x$with_mib_cfg_checks" = "xyes"; then
 
2109
                AC_MSG_ERROR([$mib_cfg_msg])
 
2110
              else
 
2111
                AC_MSG_WARN([$mib_cfg_msg])
 
2112
                AC_MSG_CACHE_ADD([*** MIB Module warning *** $mib_cfg_msg])
 
2113
              fi
 
2114
            else
 
2115
              new_with_out_mib_modules="$j $new_with_out_mib_modules"
 
2116
              AC_MSG_MODULE_DBG("$j added to excluded list")
 
2117
            fi
 
2118
          done
 
2119
        fi
 
2120
 
 
2121
        #---------------------
 
2122
        # macro: config_arch_require(ARCH,modules)
 
2123
        #  - lists modules required for a given ARCH
 
2124
        #
 
2125
        # check if $i has any architecture specific requirements
 
2126
        #
 
2127
        changequote(, )
 
2128
        new_list_arch=`$MODULECPP module_tmp_header.h | grep config_arch_require | sed 's/.*config_arch_require( *\([^ ]*\) *, *\([^ ]*\) *).*/\1-xarchx-\2/'`
 
2129
        changequote([, ])
 
2130
        if test "x$new_list_arch" != "x"; then
 
2131
          for j in $new_list_arch
 
2132
            do
 
2133
            archtest=`echo $j | sed 's/-xarchx-.*//'`
 
2134
            # target_os may have been changed to a #define of 1...
 
2135
            if test "x$archtest" = "x1" -o "x$target_os" = "x$archtest" -o "x$PARTIALTARGETOS" = "x$archtest"; then
 
2136
              new_list="$new_list `echo $j | sed 's/.*-xarchx-//'`"
 
2137
              AC_MSG_MODULE_DBG(" $i required adding arch files: `echo $j | sed 's/.*-xarchx-//'`")
 
2138
            fi
 
2139
          done
 
2140
        fi
 
2141
        AC_MSG_MODULE_DBG(" $i required arch files: $new_list")
 
2142
 
 
2143
        #---------------------
 
2144
        # macro: config_require(modules)
 
2145
        #  - lists modules required for this module
 
2146
        #
 
2147
        # check if $i has any other required modules
 
2148
        #
 
2149
        new_list="$new_list `$MODULECPP module_tmp_header.h | grep config_require | sed 's/.*config_require(\(.*\)).*/\1/'`"
 
2150
        AC_MSG_MODULE_DBG(" $i will test: $new_list")
 
2151
        if test "x$new_list" != "x"; then
 
2152
          for j in $new_list
 
2153
            do
 
2154
            AC_MSG_MODULE_DBG(-n " $i wants to add $j: ")
 
2155
            if test ! -f $srcdir/$mibdir/$j.h -a ! -f $srcdir/$mibdir/$j.c; then
 
2156
              AC_MSG_WARN([mib module error])
 
2157
              AC_MSG_ERROR([mib module "$i" requires module "$j" but $j.h or $j.c could not be found in $srcdir/$mibdir])
 
2158
            elif echo " $new_with_out_mib_modules " | grep " $j " > /dev/null; then
 
2159
              if test "x$i" != "xdefault_modules" ; then
 
2160
                mib_cfg_msg="mib module '$i' requires module '$j' but someone told me to compile without it"
 
2161
                AC_MSG_WARN([mib module error])
 
2162
                if test "x$with_mib_cfg_checks" = "xyes"; then
 
2163
                  AC_MSG_ERROR([$mib_cfg_msg])
 
2164
                else
 
2165
                  AC_MSG_WARN([$mib_cfg_msg])
 
2166
                  AC_MSG_CACHE_ADD([*** MIB Module warning *** $mib_cfg_msg])
 
2167
                fi
 
2168
#           elif echo " $module_list $new_list_two $new_module_list " | grep " $j " > /dev/null; then
 
2169
#              AC_MSG_MODULE_DBG("  $j included previously")
 
2170
              fi
 
2171
            else
 
2172
              new_list_two="$new_list_two $j"
 
2173
              AC_MSG_MODULE_DBG("  $j included")
 
2174
            fi
 
2175
          done
 
2176
        fi
 
2177
 
 
2178
        #---------------------
 
2179
        # macro: config_add_mib(SOME-MIB)
 
2180
        #  - lists MIBs to be added to the default to-load list.
 
2181
        #
 
2182
        # check if $i has any mibs to add
 
2183
        #
 
2184
        new_mibs=`$MODULECPP module_tmp_header.h | grep config_add_mib | sed 's/.*config_add_mib(\(.*\)).*/\1/'`
 
2185
        if test "x$new_mibs" != "x"; then
 
2186
            for j in $new_mibs
 
2187
                do
 
2188
                if test "x`echo :$default_mibs: | grep :$j:`" = "x"; then
 
2189
                    default_mibs="$default_mibs:$j"
 
2190
                fi
 
2191
                if test -f $srcdir/mibs/$j.txt; then
 
2192
                    if echo $default_mibs_install | grep " $j " > /dev/null; then
 
2193
                            :
 
2194
                    else
 
2195
                            default_mibs_install="$default_mibs_install $j.txt"
 
2196
                    fi
 
2197
                fi
 
2198
            done
 
2199
        fi # new mibs
 
2200
 
 
2201
        #-------------------
 
2202
        # add the current module to the list of stuff to compile, etc.
 
2203
        #
 
2204
        # add $i to module list
 
2205
        #
 
2206
        AC_MSG_MODULE_DBG("  $i added (based on $i.h)")
 
2207
        module_list="$module_list $i"
 
2208
        eval ${module_type}_list="\"\$${module_type}_list $i\""
 
2209
 
 
2210
        echo "read_config.lo: mibgroup/$i.h" >> $module_list_deps
 
2211
        if test $module_type = "agent_module" ; then
 
2212
            echo "snmp_vars.lo: mibgroup/$i.h" >> $agent_module_list_deps
 
2213
        else
 
2214
            echo "mib_modules.lo: mibgroup/$i.h" >> $mib_module_list_deps
 
2215
        fi
 
2216
 
 
2217
        #-------------------
 
2218
        # check for unsupported config_load_mib
 
2219
        #
 
2220
        if $MODULECPP module_tmp_header.h | grep config_load_mib > /dev/null 2>&1; then
 
2221
          AC_MSG_WARN([mib module error])
 
2222
          AC_MSG_WARN([mib module "$i" uses the "config_load_mib" directive, which is no longer supported.  It probably won't work.])
 
2223
        fi # grep config_load_mib
 
2224
 
 
2225
        #-------------------
 
2226
        # check for config_parse_dot_conf
 
2227
        #  (generally not used any longer; old auto-load a .conf token)
 
2228
        #
 
2229
        changequote(, )
 
2230
        $MODULECPP module_tmp_header.h | grep config_parse_dot_conf | sed 's@.*config_parse_dot_conf(\([^)]*\), *\([^),]*\), *\([^),]*\), *\([^),]*\)).*@register_config_handler("snmpd",\1, \2, \3, \4);@' >> $mibdir/mib_module_dot_conf.h
 
2231
        changequote([, ])
 
2232
 
 
2233
        #---------------------
 
2234
        # macro: config_error(error text)
 
2235
        #  - used to signal a configuration error from a module
 
2236
        #
 
2237
        # check if $i has any errors, or warnings
 
2238
        #
 
2239
        error=`$MODULECPP module_tmp_header.h | grep config_error | sed 's/.*config_error(\(.*\)).*/\1/'`
 
2240
        if test "x$error" != "x"; then
 
2241
          echo
 
2242
          echo
 
2243
          AC_MSG_ERROR([$i: *** $error ***])
 
2244
        fi
 
2245
 
 
2246
        #---------------------
 
2247
        # macro: config_warning(warning text)
 
2248
        #  - used to signal a configuration "warning" to be printed to the user
 
2249
        #
 
2250
        warning=`$MODULECPP module_tmp_header.h | grep config_warning | sed 's/.*config_warning(\(.*\)).*/\1/'`
 
2251
        if test "x$warning" != "x"; then
 
2252
          all_warnings="$all_warnings $warning
 
2253
"
 
2254
        fi
 
2255
 
 
2256
      #---------------------
 
2257
      # Check for a .c file if the .h didn't exist
 
2258
      #
 
2259
      elif test -f $srcdir/$mibdir/$i.c; then
 
2260
        if echo " $module_list $new_list_two $new_module_list " | grep " $i      " > /dev/null; then
 
2261
           AC_MSG_MODULE_DBG("  $i already included")
 
2262
        else
 
2263
           AC_MSG_MODULE_DBG("  $i added (based on $i.c)")
 
2264
           module_list="$module_list $i"
 
2265
           mib_module_list="$mib_module_list $i"
 
2266
        fi
 
2267
 
 
2268
      #---------------------
 
2269
      # No .h or .c = error!  (typo?)
 
2270
      #
 
2271
      else # no $i.h or $i.c
 
2272
        AC_MSG_WARN([mib module error])
 
2273
        AC_MSG_ERROR([module files $i.h or $i.c could not be found in $srcdir/$mibdir])
 
2274
      fi # no $i.h
 
2275
 
 
2276
      #-------------------
 
2277
      # check for init/shutdown routines too
 
2278
      #
 
2279
      has_c_code=no
 
2280
      if test -f $srcdir/$mibdir/$i.c; then
 
2281
        if test "x$output_to" = "xnormal" ; then
 
2282
          echo "        $i \\" >> $module_list_code
 
2283
          echo $ECHO_N " $i" $ECHO_C >> $MODULE_LIST
 
2284
          eval tmpfilevar=\$`echo ${module_type}_list_code`
 
2285
          echo "        $i \\" >> $tmpfilevar
 
2286
        else
 
2287
          eval "dl_${dl_name}_files=\"\$dl_${dl_name}_files $i\""
 
2288
          saved_sublist_code="$saved_sublist_code $i"
 
2289
        fi
 
2290
        mnm=`echo $i | sed 's/.*\///;s/\.c$//;'`
 
2291
        AC_MSG_MODULE_DBG(-e "\nchecking '$srcdir/$mibdir/$i.c' ($mnm/`basename $i`) C file for init/shutdown")
 
2292
        if test "x$mnm" != "x`basename $i`"; then
 
2293
           AC_MSG_WARN([mib module error])
 
2294
           AC_MSG_ERROR([conflicting names: $mnm != `basename $i`])
 
2295
        fi
 
2296
        temp_init=`grep init_$mnm $srcdir/$mibdir/$i.c | grep -v _init_$mnm`
 
2297
        if test "x$temp_init" != "x"; then
 
2298
            AC_MSG_MODULE_DBG(-e "adding init_$mnm() to list")
 
2299
            need_header=1
 
2300
            echo "  if (should_init(\"$mnm\")) init_$mnm();" >> $output_inits
 
2301
        fi
 
2302
        grep shutdown_$mnm $srcdir/$mibdir/$i.c > /dev/null
 
2303
        if test $? -eq 0 ; then
 
2304
            if test $module_debug -eq 1; then
 
2305
              echo -e "\nadding shutdown_$mnm() to list"
 
2306
            fi
 
2307
            need_header=1
 
2308
            echo "  if (should_init(\"$mnm\")) shutdown_$mnm();" >> $mibdir/${module_type}_shutdown.h
 
2309
        fi
 
2310
      fi # test -f $srcdir/$mibdir/$i.c
 
2311
 
 
2312
      #-------------------
 
2313
      # if there is a shutdown/init list,
 
2314
      #
 
2315
      if test $need_header -eq 1 ; then
 
2316
         echo '#include "'"mibgroup/$i.h"'"' >> $output_hdrs
 
2317
      else
 
2318
         echo '/*#include "'"mibgroup/$i.h"'"*/' >> $output_hdrs
 
2319
      fi
 
2320
 
 
2321
      #-------------------
 
2322
      # check for output directory (for building outside of source tree
 
2323
      #
 
2324
      changequote(, )
 
2325
      if test "x`echo $i | sed 's/\///g;'`" != "x$i"; then
 
2326
        mnd=`echo $i | sed 's/\/[^/]*$//;'`
 
2327
        if test ! -d ./$mibdir/$mnd; then
 
2328
            module_directories="$module_directories ./$mibdir/$mnd"
 
2329
        fi
 
2330
      fi # module directory test
 
2331
      changequote([, ])
 
2332
 
 
2333
      #-------------------
 
2334
      # define USING_*_MODULE
 
2335
      #
 
2336
      changequote(, )
 
2337
      sym="`echo ${i} | sed 's/[^a-zA-Z0-9_]/_/g' | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`"
 
2338
      changequote([, ])
 
2339
      echo "/* Define if compiling with the ${i} module files.  */" >> include/net-snmp/agent/${module_type}_config.h
 
2340
      echo "#define USING_${sym}_MODULE 1" >> include/net-snmp/agent/${module_type}_config.h
 
2341
      echo " " >> include/net-snmp/agent/${module_type}_config.h
 
2342
 
 
2343
      #-------------------
 
2344
      echo $ECHO_N " $i$ECHO_C"
 
2345
    fi #
 
2346
    done # for i in $module_sublist
 
2347
 
 
2348
    if test "$output_to" = "separate" ; then
 
2349
      if test "x$new_list_two" = "x" ; then
 
2350
        # no new sub-modules to add to the current target
 
2351
        output_to="normal"
 
2352
 
 
2353
        dllcleans="$saved_sublist_o $dllcleans"
 
2354
        output_inits=""
 
2355
        module_sublist=""
 
2356
      else
 
2357
        # a module had sub-modules required; keep goin'
 
2358
        saved_sublist="$saved_sublist $module_sublist"
 
2359
        module_sublist="$new_list_two"
 
2360
        new_list_two=""
 
2361
      fi
 
2362
    else
 
2363
      module_sublist=""
 
2364
    fi
 
2365
 
 
2366
    done # while module_sublist
 
2367
  done # for j in $new_module_list
 
2368
 
 
2369
  # remember the top level modules for later reporting
 
2370
  if test $first_pass = 1 ; then
 
2371
    # remember this list for later reporting
 
2372
    top_level_modules="$new_module_list => $new_list_two"
 
2373
    first_pass=0
 
2374
  fi
 
2375
  #-------------------
 
2376
  # if $i added new modules vis config_*,
 
2377
  # check those modules for requirements too
 
2378
  #
 
2379
  # transfer the new module to check list to the normal variable
 
2380
  #
 
2381
  if test "x$new_list_two" ; then
 
2382
    output_to=normal
 
2383
  fi
 
2384
  new_module_list="$new_list_two"
 
2385
  new_list_two=""
 
2386
done # while test "x$new_module_list" != "x"; do
 
2387
echo ""
 
2388
 
 
2389
#--------------------
 
2390
# construct the dll code files and make rules.  This can't be done
 
2391
# until now because dulpicate use of a module means it gets removed
 
2392
# from the dll and put into the main agent.
 
2393
#
 
2394
for i in $dl_names ; do
 
2395
  eval mod_files="\"\$dl_${i}_files\""
 
2396
  echo "components in the $i dll: $mod_files"
 
2397
 
 
2398
  output_inits="agent/mibgroup/${i}-dll.c"
 
2399
  output_hdrs="agent/mibgroup/${i}-hdrs.h"
 
2400
 
 
2401
  AC_MSG_MODULE_DBG("creating dll file: $output_inits")
 
2402
  for ofile in $output_inits $output_hdrs ; do
 
2403
    if test -f $ofile ; then
 
2404
      if grep "this file created automatically by configure" $ofile > /dev/null 2>&1 ; then
 
2405
        :
 
2406
      else
 
2407
        AC_MSG_ERROR([$ofile already existed ; can't build dll object $i])
 
2408
      fi
 
2409
    fi
 
2410
    cat > $ofile << EOFIF
 
2411
/* xDo not edit; this file created automatically by configure */
 
2412
EOFIF
 
2413
  done
 
2414
 
 
2415
  cat >> $output_inits << EOFOC
 
2416
#include <net-snmp/net-snmp-config.h>
 
2417
#include <net-snmp/net-snmp-includes.h>
 
2418
#include <net-snmp/agent/net-snmp-agent-includes.h>
 
2419
#include "${i}-hdrs.h"
 
2420
void
 
2421
init_$i(void) {
 
2422
EOFOC
 
2423
 
 
2424
  # create the .so rule
 
2425
  saved_sublist_o=`echo "$mod_files " | sed 's/^ *//g;s/  */.o /g;'`
 
2426
 
 
2427
  # create the rules for each object
 
2428
  for j in $mod_files ; do
 
2429
    cat >> $module_rules << EOFR
 
2430
$j.o: $j.c
 
2431
        \$(CC) -c \$(CPPFLAGS) \$(CFLAGS) \$(DLFLAGS) -o \$@ \$<
 
2432
 
 
2433
EOFR
 
2434
    mnm=`echo $j | sed 's/.*\///;s/\.c$//;'`
 
2435
    echo "  if (should_init(\"$mnm\")) init_$mnm();" >> $output_inits
 
2436
  done
 
2437
 
 
2438
  # create the rule for the .so and wrapper code
 
2439
  cat >> $module_rules << EOFM
 
2440
${i}-dll.o: ${i}-dll.c
 
2441
        \$(CC) -c \$(CPPFLAGS) \$(CFLAGS) \$(DLFLAGS) -o \$@ \$<
 
2442
 
 
2443
${i}.so: $saved_sublist_o ${i}-dll.o
 
2444
        \$(CC) \$(CPPFLAGS) \$(CFLAGS) \$(DLFLAGS) -o \$@ $saved_sublist_o ${i}-dll.o
 
2445
 
 
2446
EOFM
 
2447
        cat >> $output_inits << EOFOCFIN
 
2448
}
 
2449
EOFOCFIN
 
2450
 
 
2451
done
 
2452
 
 
2453
# cleanup
 
2454
rm -f module_tmp_header.h
 
2455
 
 
2456
#-------------------
 
2457
# build module lists for Makefiles
 
2458
#
 
2459
changequote(, )
 
2460
 
 
2461
for i in module_list_o module_list_c module_list_lo mib_module_list_o mib_module_list_c mib_module_list_lo mibgroup_list_o mibgroup_list_lo agent_module_list_o agent_module_list_c agent_module_list_lo agentgroup_list_o agentgroup_list_lo ; do
 
2462
  eval "$i=mk/${i}.mk"
 
2463
done
 
2464
 
 
2465
sed 's/^module_list_code/module_list_o/;s/\([^=]\)  *\\/\1.o \\/g'  < $module_list_code  > $module_list_o
 
2466
sed 's/^module_list_code/module_list_c/;s/\([^=]\)  *\\/\1.c \\/g'  < $module_list_code  > $module_list_c
 
2467
sed 's/^module_list_code/module_list_lo/;s/\([^=]\)  *\\/\1.lo \\/g' < $module_list_code  > $module_list_lo
 
2468
 
 
2469
sed 's/^mib_module_list_code/mib_module_list_o/;s/\([^=]\)  *\\/\1.o \\/g'  < $mib_module_list_code  > $mib_module_list_o
 
2470
sed 's/^mib_module_list_code/mib_module_list_c/;s/\([^=]\)  *\\/\1.c \\/g'  < $mib_module_list_code  > $mib_module_list_c
 
2471
sed 's/^mib_module_list_code/mib_module_list_lo/;s/\([^=]\)  *\\/\1.lo \\/g' < $mib_module_list_code  > $mib_module_list_lo
 
2472
 
 
2473
sed 's/^mib_module_list_o/mibgroup_list_o/;s@\([^       ]*\)\.o@mibgroup/\1.o@g' < $mib_module_list_o > $mibgroup_list_o
 
2474
sed 's/^mib_module_list_lo/mibgroup_list_lo/;s@\([^     ]*\)\.lo@mibgroup/\1.lo@g' < $mib_module_list_lo > $mibgroup_list_lo
 
2475
 
 
2476
sed 's/^agent_module_list_code/agent_module_list_o/;s/\([^=]\)  *\\/\1.o \\/g'  < $agent_module_list_code  > $agent_module_list_o
 
2477
sed 's/^agent_module_list_code/agent_module_list_c/;s/\([^=]\)  *\\/\1.c \\/g'  < $agent_module_list_code  > $agent_module_list_c
 
2478
sed 's/^agent_module_list_code/agent_module_list_lo/;s/\([^=]\)  *\\/\1.lo \\/g' < $agent_module_list_code  > $agent_module_list_lo
 
2479
 
 
2480
sed 's/^agent_module_list_o/agentgroup_list_o/;s@\([^   ]*\)\.o@mibgroup/\1.o@g' < $agent_module_list_o > $agentgroup_list_o
 
2481
sed 's/^agent_module_list_lo/agentgroup_list_lo/;s@\([^         ]*\)\.lo@mibgroup/\1.lo@g' < $agent_module_list_lo > $agentgroup_list_lo
 
2482
 
 
2483
for i in module_list_o module_list_c module_list_lo mib_module_list_o mib_module_list_c mib_module_list_lo mibgroup_list_o mibgroup_list_lo agent_module_list_o agent_module_list_c agent_module_list_lo agentgroup_list_o agentgroup_list_lo ; do
 
2484
        # hpux make (at least) doesn't like a trailing \ on the last
 
2485
        # line even when the next line contains nothing but
 
2486
        # whitespace.
 
2487
        lasttoken=`tail -1 mk/$i.mk | awk '{print $1}'`
 
2488
        sed "s#$lasttoken \\\\#$lasttoken#" < mk/$i.mk > mk/$i.mk.tmp
 
2489
        mv mk/$i.mk.tmp mk/$i.mk
 
2490
 
 
2491
        # add a closing comment
 
2492
        echo "" >> mk/$i.mk
 
2493
        echo "# end configure generated code" >> mk/$i.mk
 
2494
done
 
2495
 
 
2496
changequote([, ])
 
2497
 
 
2498
if test $module_debug -eq 1; then
 
2499
   echo -e "\nFinal module list: $module_list_code"
 
2500
   exit
 
2501
fi
 
2502
if test "x$with_mib_cfg_checks" = "xyes"; then
 
2503
  AC_MSG_CACHE_ADD([Agent Module list: $module_list_code])
 
2504
fi
 
2505
AC_SUBST_FILE(MODULE_LIST)
 
2506
AC_SUBST_FILE(module_list_c)
 
2507
AC_SUBST_FILE(module_list_o)
 
2508
AC_SUBST_FILE(module_list_lo)
 
2509
AC_SUBST_FILE(mib_module_list_c)
 
2510
AC_SUBST_FILE(mib_module_list_o)
 
2511
AC_SUBST_FILE(mib_module_list_lo)
 
2512
AC_SUBST_FILE(agent_module_list_c)
 
2513
AC_SUBST_FILE(agent_module_list_o)
 
2514
AC_SUBST_FILE(agent_module_list_lo)
 
2515
AC_SUBST_FILE(mibgroup_list_o)
 
2516
AC_SUBST_FILE(mibgroup_list_lo)
 
2517
AC_SUBST_FILE(agentgroup_list_o)
 
2518
AC_SUBST_FILE(agentgroup_list_lo)
 
2519
AC_SUBST_FILE(agent_module_list)
 
2520
 
 
2521
#AC_SUBST_FILE(mib_module_list)
 
2522
#AC_SUBST(module_list)
 
2523
AC_SUBST(default_mibs_install)
 
2524
AC_SUBST(dllcleans)
 
2525
AC_SUBST_FILE(module_rules)
 
2526
AC_SUBST_FILE(module_list_deps)
 
2527
AC_SUBST_FILE(mib_module_list_deps)
 
2528
AC_SUBST_FILE(agent_module_list_deps)
 
2529
 
 
2530
AC_MSG_RESULT(.)
 
2531
 
 
2532
if test $module_debug -eq 1; then
 
2533
AC_MSG_CACHE_ADD(Agent MIB code:            $module_list)
 
2534
fi
 
2535
AC_MSG_CACHE_ADD(Agent MIB code:            $top_level_modules)
 
2536
 
 
2537
# end hairy agent module processing
 
2538
 
 
2539
AC_MSG_CHECKING([if directories need to be created])
 
2540
for i in $module_directories; do
 
2541
  $srcdir/mkinstalldirs $i
 
2542
done
 
2543
AC_MSG_RESULT(.)
 
2544
 
 
2545
#-------------------
 
2546
# Define default mibs
 
2547
#
 
2548
AC_MSG_CHECKING([default mib files to read])
 
2549
if test "x$NETSNMP_DEFAULT_MIBS" = "x"; then
 
2550
  NETSNMP_DEFAULT_MIBS="$default_mibs"
 
2551
fi
 
2552
if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc" -o "x$PARTIALTARGETOS" = "xcygwin"; then
 
2553
  # mingw32 and cygwin use ';' as the environment variable separator char
 
2554
  ENV_SEPARATOR=";"
 
2555
  NETSNMP_DEFAULT_MIBS=`echo "$NETSNMP_DEFAULT_MIBS" | sed 's/:/;/g'`
 
2556
  default_mibs=`echo "$default_mibs" | sed 's/:/;/g'`
 
2557
else
 
2558
  ENV_SEPARATOR=":"
 
2559
fi
 
2560
AC_SUBST(ENV_SEPARATOR)
 
2561
AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_MIBS,"$NETSNMP_DEFAULT_MIBS")
 
2562
AC_SUBST(NETSNMP_DEFAULT_MIBS)
 
2563
AC_MSG_RESULT($NETSNMP_DEFAULT_MIBS)
 
2564
 
 
2565
AC_MSG_CHECKING([whether we have to build PIC code])
 
2566
echo " $module_list " | grep " ucd-snmp/dlmod " >/dev/null
 
2567
if test $? -eq 0 ; then
 
2568
        LIB_CFLAGS="$LIB_CFLAGS $SHLIB_CFLAGS"
 
2569
        AC_MSG_RESULT(yes)
 
2570
else
 
2571
        DLLIBS=""
 
2572
        AC_MSG_RESULT(no)
 
2573
fi
 
2574
 
 
2575
#
 
2576
# Check for kernel location
 
2577
#
 
2578
 
 
2579
AC_CACHE_CHECK(for location of system kernel,ac_cv_KERNEL_LOC,
 
2580
[ac_cv_KERNEL_LOC="unknown"
 
2581
# First determine if test expects a -f or a -c (character device (SYSV))
 
2582
 
 
2583
if test -c /dev/null; then
 
2584
  CFLAG="-c"
 
2585
elif test -f /dev/null; then
 
2586
  CFLAG="-f"
 
2587
else
 
2588
  # fall back
 
2589
  CFLAG="-f"
 
2590
fi
 
2591
for i in /vmunix /hp-ux /stand/vmunix /dev/ksyms /kernel/unix /kernel/genunix /netbsd /unix /kernel /bsd /mach_kernel /boot/kernel/kernel
 
2592
  do
 
2593
  if test -f $i -o $CFLAG $i; then
 
2594
    ac_cv_KERNEL_LOC="$i"
 
2595
    break;
 
2596
  fi
 
2597
done
 
2598
if test $i = "unknown"; then
 
2599
  AC_MSG_WARN([Can't find system kernel...  Setting to /vmunix])
 
2600
  ac_cv_KERNEL_LOC="/vmunix"
 
2601
fi
 
2602
])
 
2603
 
 
2604
AC_DEFINE_UNQUOTED(KERNEL_LOC,"$ac_cv_KERNEL_LOC")
 
2605
 
 
2606
#
 
2607
# Check for mount table location
 
2608
#
 
2609
 
 
2610
AC_CACHE_CHECK(for mount table location,ac_cv_ETC_MNTTAB,
 
2611
[ac_cv_ETC_MNTTAB="unknown"
 
2612
AC_ARG_WITH(mnttab,
 
2613
[  --with-mnttab=\"/etc/mnttab\"  Mount table location.
 
2614
                                 The default is to autodetect this.],
 
2615
        [ac_cv_ETC_MNTTAB="$with_mnttab"])
 
2616
if test "$ac_cv_ETC_MNTTAB" = "unknown"; then
 
2617
  for i in /etc/mnttab /etc/mtab /etc/filesystems /dev/mnttab
 
2618
    do
 
2619
    if test -f $i -o -c $i; then
 
2620
      ac_cv_ETC_MNTTAB="$i"
 
2621
      break;
 
2622
    fi
 
2623
  done
 
2624
fi
 
2625
])
 
2626
 
 
2627
AC_DEFINE_UNQUOTED(ETC_MNTTAB,"$ac_cv_ETC_MNTTAB")
 
2628
 
 
2629
# Check for /dev/dmem or /dev/drum location
 
2630
AC_CACHE_CHECK(for location of swap device,ac_cv_DMEM_LOC,
 
2631
[
 
2632
# First determine if test expects a -f or a -c (character device (SYSV))
 
2633
 
 
2634
if test -f /dev/kmem; then
 
2635
  CTEST="test -f"
 
2636
elif test -c /dev/kmem; then
 
2637
  CTEST="test -c"
 
2638
else
 
2639
  # fall back
 
2640
  CTEST="test -f"
 
2641
fi
 
2642
 
 
2643
if $CTEST /dev/dmem; then
 
2644
  ac_cv_DMEM_LOC="/dev/dmem"
 
2645
elif $CTEST /dev/drum; then
 
2646
  ac_cv_DMEM_LOC="/dev/drum"
 
2647
else
 
2648
  ac_cv_DMEM_LOC="none"
 
2649
fi
 
2650
])
 
2651
 
 
2652
if test "x$ac_cv_DMEM_LOC" != "xnone"; then
 
2653
  AC_DEFINE_UNQUOTED(DMEM_LOC,"$ac_cv_DMEM_LOC")
 
2654
fi
 
2655
 
 
2656
# forced efence turned off.
 
2657
# if test "x$developer" = "xyes" -a "x$use_efence" != "xno"; then
 
2658
#    use_efence="yes"
 
2659
# fi
 
2660
 
 
2661
if test "x$use_efence" = "xyes"; then
 
2662
    AC_CHECK_LIB(efence, EF_Exit)
 
2663
fi
 
2664
 
 
2665
# Checks for libraries.
 
2666
# AC_CHECK_LIB(des, main)
 
2667
# AC_CHECK_LIB(m, asin)
 
2668
 
 
2669
AC_ARG_WITH(elf,
 
2670
        [AS_HELP_STRING(--without-elf,[use elf libraries])],,
 
2671
        [AC_ARG_ENABLE(elf,,
 
2672
                [AC_MSG_ERROR([ Invalid option. Use --with-elf/--without-elf instead ])])])
 
2673
 
 
2674
if test "x$with_elf" != "xno"; then
 
2675
# nlist is needed for uptime on some sytems in the generic library
 
2676
# add hosts which don't use nlist to the blank first line
 
2677
case $target_os in
 
2678
        linux*) ;;
 
2679
        irix*) # Check for nlist in mld (irix)
 
2680
                AC_CHECK_LIB(elf, nlist)
 
2681
                AC_CHECK_LIB(elf, nlist64)
 
2682
                AC_CHECK_LIB(mld, nlist)
 
2683
                ;;
 
2684
        *) # default
 
2685
                AC_CHECK_LIB(elf, nlist)
 
2686
                ;;
 
2687
esac
 
2688
fi
 
2689
 
 
2690
 
 
2691
# On some platforms (Irix) libnsl and libsocket should not be used.
 
2692
AC_CHECK_FUNC(gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME),
 
2693
        AC_CHECK_LIB(nsl, gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME)
 
2694
        LIBS="${LIBS} -lnsl"))
 
2695
 
 
2696
# SCO Unixware 7.1.4 finds gethostbyname() in -lsocket
 
2697
AC_CHECK_FUNC(gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME),
 
2698
        AC_CHECK_LIB(socket, gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME)
 
2699
        LIBS="${LIBS} -lsocket"))
 
2700
 
 
2701
# Solaris kstat
 
2702
AC_CHECK_LIB(kstat, kstat_lookup,
 
2703
        AC_DEFINE(HAVE_LIBKSTAT, 1, [Define to 1 if you have the `kstat' library (-lkstat).])
 
2704
        LNETSNMPLIBS="${LNETSNMPLIBS} -lkstat")
 
2705
 
 
2706
# Check for libraries that the agent needs
 
2707
# saving old libraries
 
2708
NONAGENTLIBS=$LIBS
 
2709
 
 
2710
# Check for security related functions
 
2711
if test "x$tryopenssl" != "xno"; then
 
2712
    if test "x$askedopenssl" != "xyes" -a "x$askedpkcs" = "xyes"; then
 
2713
      AC_CHECK_LIB(pkcs11, C_Initialize, AC_DEFINE(HAVE_LIBPKCS11, 1, [Define to 1 if you have the `pkcs11' library (-lpkcs11).])
 
2714
              LIBPKCS11="-lpkcs11")
 
2715
    else 
 
2716
      if test "x$tryrsaref" != "xno"; then
 
2717
         AC_CHECK_LIB(rsaref, RSAPrivateDecrypt)
 
2718
         AC_CHECK_LIB(RSAglue, RSA_PKCS1_RSAref)
 
2719
      fi
 
2720
 
 
2721
      AC_CHECK_LIB(crypto, EVP_md5, AC_DEFINE(HAVE_LIBCRYPTO, 1, [Define to 1 if you have the `crypto' library (-lcrypto).])
 
2722
              LIBCRYPTO="-lcrypto")
 
2723
      AC_CHECK_LIB(crypto, AES_cfb128_encrypt, 
 
2724
              AC_DEFINE(HAVE_AES_CFB128_ENCRYPT, 1, [Define to 1 if you have the `AES_cfb128_encrypt' function.]))
 
2725
    fi
 
2726
elif test "x$askedpkcs" = "xyes"; then
 
2727
    AC_CHECK_LIB(pkcs11, C_Initialize, AC_DEFINE(HAVE_LIBPKCS11)
 
2728
            LIBPKCS11="-lpkcs11")
 
2729
fi
 
2730
 
 
2731
LIBS=$NONAGENTLIBS
 
2732
 
 
2733
# check for tcp wrapper support
 
2734
_cppflags="${CPPFLAGS}"
 
2735
_ldflags="${LDFLAGS}"
 
2736
 
 
2737
AC_ARG_WITH(libwrap,
 
2738
[  --with-libwrap[=LIBPATH]  Compile in libwrap (tcp_wrappers) support.],[
 
2739
  if test "$with_libwrap" != "no"; then
 
2740
    if test "$with_libwrap" != "yes"; then
 
2741
      CPPFLAGS="${CPPFLAGS} -I$with_libwrap/include"
 
2742
      LDFLAGS="${LDFLAGS} -L$with_libwrap/lib"
 
2743
    fi
 
2744
 
 
2745
    _libs=${LIBS}
 
2746
    AC_CHECK_HEADER(tcpd.h, ,
 
2747
            AC_MSG_ERROR([Asked to use libwrap but I couldn't find tcpd.h.]))
 
2748
 
 
2749
    LIBS="$LIBS -lwrap"
 
2750
        AC_MSG_CHECKING([for TCP wrappers library -lwrap])
 
2751
        # XXX: should check for hosts_ctl
 
2752
        AC_TRY_LINK([#include <sys/types.h>
 
2753
                     #include <tcpd.h>
 
2754
                     int allow_severity = 0;
 
2755
                     int deny_severity  = 0;
 
2756
                    ],[hosts_access((void *)0)],[
 
2757
 
 
2758
            AC_MSG_RESULT([yes])
 
2759
            AC_DEFINE(NETSNMP_USE_LIBWRAP)
 
2760
            test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap/lib"
 
2761
            _wraplibs="$_wraplibs -lwrap"],
 
2762
        [
 
2763
            AC_MSG_RESULT([no])
 
2764
            # Linux RedHat 6.1 won't link libwrap without libnsl
 
2765
            AC_CHECK_FUNC(yp_get_default_domain, ,
 
2766
                AC_CHECK_LIB(nsl, yp_get_default_domain))
 
2767
            AC_MSG_CHECKING([for TCP wrappers library -lwrap linked with -lnsl])
 
2768
            AC_TRY_LINK([#include <sys/types.h>
 
2769
                         #include <tcpd.h>
 
2770
                         int allow_severity = 0;
 
2771
                         int deny_severity  = 0;
 
2772
                        ],[hosts_access((void *)0)],
 
2773
 
 
2774
                        AC_MSG_RESULT(yes)
 
2775
                        AC_DEFINE(NETSNMP_USE_LIBWRAP)
 
2776
                        test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap/lib"
 
2777
                        _wraplibs="$_wraplibs -lwrap -lnsl",
 
2778
 
 
2779
                        AC_MSG_RESULT(no)
 
2780
                        AC_MSG_ERROR(Asked to use libwrap but I couldn't find it.))])
 
2781
    LAGENTLIBS="$_wraplibs"
 
2782
    CPPFLAGS=${_cppflags}
 
2783
    LDFLAGS=${_ldflags}
 
2784
    LIBS=${_libs}
 
2785
  fi
 
2786
])
 
2787
 
 
2788
AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h)
 
2789
 
 
2790
AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no)
 
2791
AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no)
 
2792
 
 
2793
if test "x$rpmheader_h" = "xno" -o "x$rpmlib_h" = "xno" ; then
 
2794
  if test "x$with_rpm" = "xyes" ; then
 
2795
    AC_MSG_ERROR([Could not find either the RPM header files needed and was specifically asked to use RPM support])
 
2796
  else
 
2797
    with_rpm=no
 
2798
  fi
 
2799
fi
 
2800
 
 
2801
#
 
2802
# rpm libraries only needed for the host resources mib software
 
2803
# installed tables (on linux in particular)
 
2804
#
 
2805
if test "x$with_rpm" != "xno" && \
 
2806
        echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
 
2807
  # ARG.  RPM is a real pain.
 
2808
  # FWIW librpm.la, librpmio.la, and libpopt.la have correct dependencies.
 
2809
  _rpmlibs=""
 
2810
 
 
2811
  # zlib is required for newer versions of rpm
 
2812
  _cppflags="${CPPFLAGS}"
 
2813
  _ldflags="${LDFLAGS}"
 
2814
 
 
2815
  AC_ARG_WITH(zlib,
 
2816
  [  --with-zlib[=DIR]         use libz in DIR],[
 
2817
    if test -d "$withval"; then
 
2818
      CPPFLAGS="${CPPFLAGS} -I$withval/include"
 
2819
      LDFLAGS="${LDFLAGS} -L$withval/lib"
 
2820
    fi
 
2821
  ])
 
2822
 
 
2823
  # dunno if this is needed for rpm-4.0.x, earlier probably needs.
 
2824
  AC_CHECK_HEADER(zlib.h,
 
2825
      AC_CHECK_LIB(z, gzread, , CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
 
2826
      CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
 
2827
 
 
2828
  # two variants of bzip2 need checking.
 
2829
  AC_ARG_WITH(bzip2,
 
2830
  [  --with-bzip2[=DIR]        use libbz2 in DIR],[
 
2831
    if test -d "$withval"; then
 
2832
      CPPFLAGS="${CPPFLAGS} -I$withval/include"
 
2833
      LDFLAGS="${LDFLAGS} -L$withval/lib"
 
2834
    fi
 
2835
    if test "x$with_bzip2" != "xno"; then
 
2836
  AC_CHECK_LIB(bz2, bzread, [_rpmlibs="$_rpmlibs -lbz2"],
 
2837
     AC_CHECK_LIB(bz2, BZ2_bzread, [_rpmlibs="$_rpmlibs -lbz2"],))
 
2838
    fi
 
2839
  ])
 
2840
 
 
2841
 
 
2842
  # two variants of db1 need checking.
 
2843
  AC_CHECK_LIB(db1, dbopen, [_rpmlibs="-ldb1 $_rpmlibs"],
 
2844
     AC_CHECK_LIB(db, dbopen, [_rpmlibs="-ldb $_rpmlibs"]))
 
2845
 
 
2846
  # two variants of db3 need checking.
 
2847
  AC_CHECK_LIB(db-3.1, db_create, [_rpmlibs="-ldb-3.1 $_rpmlibs"],
 
2848
    AC_CHECK_LIB(db-3.0, db_create, [_rpmlibs="-ldb-3.0 $_rpmlibs"]))
 
2849
  
 
2850
  # rpm-3.0.5 and later needs popt.
 
2851
  AC_CHECK_LIB(popt, poptParseArgvString, [_rpmlibs="-lpopt $_rpmlibs"])
 
2852
  
 
2853
  # rpm-4.0.x needs rpmio.
 
2854
  AC_CHECK_LIB(rpmio, Fopen, [_rpmlibs="-lrpmio $_rpmlibs"],,$_rpmlibs)
 
2855
  
 
2856
  # now check for rpm using the appropriate libraries.
 
2857
  AC_CHECK_LIB(rpm, rpmGetFilesystemList,[
 
2858
    AC_DEFINE(HAVE_LIBRPM)
 
2859
    LMIBLIBS="-lrpm $_rpmlibs $LMIBLIBS"
 
2860
    CFLAGS="$CFLAGS -I/usr/include/rpm"
 
2861
  ],[
 
2862
    # rpm-4.0.3 librpmdb actually contains what we need.
 
2863
    AC_CHECK_LIB(rpmdb, rpmdbOpen,[
 
2864
      AC_DEFINE(HAVE_LIBRPM)
 
2865
      LMIBLIBS="-lrpmdb -lrpm $_rpmlibs $LMIBLIBS"
 
2866
      CFLAGS="$CFLAGS -I/usr/include/rpm"
 
2867
    ],,-lrpm $_rpmlibs)
 
2868
  ])
 
2869
 
 
2870
  # rpm 4.6 has incompatible API, turn on the legacy one
 
2871
  AC_CHECK_DECL([headerGetEntry],
 
2872
    : ,
 
2873
    AC_DEFINE([_RPM_4_4_COMPAT], [], [Define if you have RPM 4.6 or newer to turn on legacy API]),
 
2874
    [[#include <rpm/rpmlib.h>]]
 
2875
  )
 
2876
fi
 
2877
 
 
2878
# libkvm
 
2879
AC_CHECK_LIB(kvm, kvm_read, [_libkvm="-lkvm"])
 
2880
AC_CHECK_FUNC(kvm_openfiles, AC_DEFINE(HAVE_KVM_OPENFILES, 1, [Define to 1 if you have the `kvm_openfiles' function.]),
 
2881
        AC_CHECK_LIB(kvm, kvm_openfiles, AC_DEFINE(HAVE_KVM_OPENFILES, 1, [Define to 1 if you have the `kvm_openfiles' function.])
 
2882
        _libkvm="-lkvm"))
 
2883
AC_CHECK_FUNC(kvm_getprocs, AC_DEFINE(HAVE_KVM_GETPROCS, 1, [Define to 1 if you have the `kvm_getprocs' function.]),
 
2884
        AC_CHECK_LIB(kvm, kvm_getprocs, AC_DEFINE(HAVE_KVM_GETPROCS, 1, [Define to 1 if you have the `kvm_getprocs' function.])
 
2885
        _libkvm="-lkvm"))
 
2886
AC_CHECK_FUNC(kvm_getswapinfo, AC_DEFINE(HAVE_KVM_GETSWAPINFO, 1, [Define to 1 if you have the `kvm_getswapinfo' function.]),
 
2887
        AC_CHECK_LIB(kvm, kvm_getswapinfo, AC_DEFINE(HAVE_KVM_GETSWAPINFO, 1, [Define to 1 if you have the `kvm_getswapinfo' function.])
 
2888
        _libkvm="-lkvm"))
 
2889
if test "x${_libkvm}" != "x"; then
 
2890
        AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the `kvm' library (-lkvm).])
 
2891
        LAGENTLIBS="$LAGENTLIBS ${_libkvm}"
 
2892
fi
 
2893
 
 
2894
# DYNAMIC MODULE SUPPORT
 
2895
AC_CHECK_FUNC(dlopen, AC_DEFINE(HAVE_DLOPEN, 1, [Define to 1 if you have the `dlopen' function.]),
 
2896
        AC_CHECK_LIB(dl, dlopen, AC_DEFINE(HAVE_DLOPEN, 1, [Define to 1 if you have the `dlopen' function.])
 
2897
        AC_DEFINE(HAVE_LIBDL, 1, [Define to 1 if you have the `dl' library (-ldl).])
 
2898
        LMIBLIBS="${LMIBLIBS} -ldl"))
 
2899
 
 
2900
# nlist
 
2901
AC_CHECK_FUNCS(nlist nlist64 knlist)
 
2902
 
 
2903
# whether we need -ldevstat for diskio MIB
 
2904
echo " $module_list " | grep " ucd-snmp/diskio " >/dev/null
 
2905
if test $? -eq 0 ; then
 
2906
        AC_CHECK_FUNC(getdevs, AC_DEFINE(HAVE_GETDEVS),
 
2907
                AC_CHECK_LIB(devstat, getdevs, AC_DEFINE(HAVE_GETDEVS)
 
2908
                LMIBLIBS="${LMIBLIBS} -ldevstat"))
 
2909
        AC_CHECK_FUNC(getdevs, AC_DEFINE(HAVE_DEVSTAT_GETDEVS),
 
2910
                AC_CHECK_LIB(devstat, devstat_getdevs, AC_DEFINE(HAVE_DEVSTAT_GETDEVS)
 
2911
                LMIBLIBS="${LMIBLIBS} -ldevstat"))
 
2912
fi
 
2913
 
 
2914
# LM-SENSORS-MIB support
 
2915
echo " $module_list " | grep " ucd-snmp/lmSensors " > /dev/null
 
2916
if test $? -eq 0 ; then
 
2917
        AC_MSG_CHECKING([for sensors support])
 
2918
        case $target_os in
 
2919
          solaris*)
 
2920
            AC_CHECK_HEADER(picl.h, LMIBLIBS="${LMIBLIBS} -lpicl",)
 
2921
            AC_CHECK_HEADERS(picl.h)
 
2922
            ;;
 
2923
        *)
 
2924
            AC_CHECK_HEADER(sensors/sensors.h,,
 
2925
                [AC_MSG_ERROR([asked to use lm_sensors but I couldn't find sensors/sensors.h])])
 
2926
            AC_CHECK_LIB(sensors, sensors_get_detected_chips, [
 
2927
                   LMIBLIBS="${LMIBLIBS} -lsensors" ;
 
2928
                ],
 
2929
                [AC_MSG_ERROR([asked to use lm_sensors but I couldn't find -lsensors])])
 
2930
            ;;
 
2931
        esac
 
2932
fi
 
2933
 
 
2934
######################################################################
 
2935
# PERL SUPPORT
 
2936
######################################################################
 
2937
 
 
2938
#
 
2939
# test to see if we can attempt to build embedded Perl so far
 
2940
#
 
2941
if test "x$embed_perl" = "xtry" ; then
 
2942
  if test "x$install_perl" = "xno" ; then
 
2943
    install_perl="try"
 
2944
  fi
 
2945
  if test "x$ac_cv_path_PERLPROG" = "x" -o "x$ac_cv_path_PERLPROG" = "xno" ; then
 
2946
    install_perl="no"
 
2947
    embed_perl="no"
 
2948
  fi
 
2949
fi
 
2950
 
 
2951
 
 
2952
#
 
2953
# Embedded Perl specific stuff
 
2954
#
 
2955
 
 
2956
# test perl prog
 
2957
if test "x$install_perl" != "xno" ; then
 
2958
    myperl=$ac_cv_path_PERLPROG
 
2959
    if test $myperl = "no" ; then
 
2960
      if test "x$install_perl" = "xtry" ; then
 
2961
        install_perl="no"
 
2962
      else
 
2963
        AC_MSG_ERROR(--enable-embedded-perl requested but no perl executable found)
 
2964
      fi
 
2965
    fi
 
2966
fi
 
2967
 
 
2968
# test for shared libraries support
 
2969
if test "x$install_perl" != "xno" ; then
 
2970
    # embedded Perl requires shared libraries
 
2971
    if test "x$enable_shared" != "xyes"; then
 
2972
      if test "x$install_perl" = "xtry" ; then
 
2973
        install_perl="no"
 
2974
      else
 
2975
        AC_MSG_ERROR(Perl support requires --enable-shared)
 
2976
      fi
 
2977
    fi
 
2978
fi
 
2979
 
 
2980
if test "x$install_perl" != "xno" ; then
 
2981
  AC_MSG_CHECKING([if we are in the source tree so we can install Perl modules])
 
2982
  if test "x$srcdir" = "x." -o -d perl/agent/default_store ; then
 
2983
    AC_MSG_RESULT([Yes])
 
2984
  else
 
2985
    if test "x$install_perl" = "xtry" ; then
 
2986
      install_perl="no"
 
2987
      AC_MSG_RESULT([No])
 
2988
    else
 
2989
      AC_MSG_ERROR([Perl modules can not be built outside the source directory])
 
2990
    fi
 
2991
  fi
 
2992
fi      
 
2993
 
 
2994
# check the Perl compiler name
 
2995
if test "x$install_perl" != "xno" ; then
 
2996
    #
 
2997
    # Perl cc checks
 
2998
    #
 
2999
    if test "xenable_perl_cc_checks" != "xno" ; then
 
3000
      AC_MSG_CHECKING([for Perl cc])
 
3001
      changequote(, )
 
3002
      PERLCC=`$myperl -V:cc | $myperl -n -e 'print if (s/^\s*cc=.([-=\w\s\/]+).;\s*/$1/);'`
 
3003
      changequote([, ])
 
3004
      if test "x$PERLCC" != "x" ; then
 
3005
        AC_MSG_RESULT([$PERLCC])
 
3006
      else
 
3007
        if test "x$install_perl" = "xtry" ; then
 
3008
          install_perl="no"
 
3009
        else
 
3010
          AC_MSG_ERROR([Could not determine the compiler that was used to build $myperl. Either set the environment variable PERLPROG to a different perl binary or use --without-perl-modules to build without Perl.])
 
3011
        fi
 
3012
      fi
 
3013
fi
 
3014
 
 
3015
# check the Perl compiler compatibility
 
3016
if test "x$install_perl" != "xno" ; then
 
3017
      AC_MSG_CHECKING([whether $PERLCC is a GNU C compiler])
 
3018
      OLDCC=$CC
 
3019
      CC="$PERLCC"
 
3020
      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
 
3021
#ifndef __GNUC__
 
3022
  choke me
 
3023
#endif
 
3024
      ]])], [perlcc_is_gnu=yes], [perlcc_is_gnu=no])
 
3025
      AC_MSG_RESULT([$perlcc_is_gnu])
 
3026
      CC=$OLDCC
 
3027
      if test "x$GCC" = "xyes" -a "x$perlcc_is_gnu" = "xno" ; then
 
3028
        if test "x$install_perl" = "xtry" ; then
 
3029
          install_perl="no"
 
3030
        else
 
3031
          AC_MSG_ERROR([This build is using a GNU C compiler ($CC) while Perl has been compiled with a non-GNU (or non-working) compiler ($PERLCC). This likely won't work for building with Perl support. Either specify a different compiler (--with-cc=PATH), disable this check (--disable-perl-cc-checks) or build without Perl (--without-perl-modules).])
 
3032
        fi
 
3033
      fi
 
3034
fi
 
3035
 
 
3036
# check if they're both gnu
 
3037
if test "x$install_perl" != "xno" ; then
 
3038
      if test "x$GCC" != "xyes" -a "x$perlcc_is_gnu" = "xyes" ; then
 
3039
        if test "x$install_perl" = "xtry" ; then
 
3040
          install_perl="no"
 
3041
        else
 
3042
          AC_MSG_ERROR([This build is using a non-GNU C compiler ($CC) while Perl has been compiled with a GNU compiler ($PERLCC). This likely won't work for building with Perl support. Either specify a different compiler (--with-cc=PATH), disable this check (--disable-perl-cc-checks) or build without Perl (--without-perl-modules).])
 
3043
        fi
 
3044
      fi
 
3045
fi
 
3046
 
 
3047
# we have enough support for installing the modules at least.
 
3048
if test "x$install_perl" = "xtry" ; then
 
3049
  install_perl="yes"
 
3050
else
 
3051
  if test "x$install_perl" = "xno" ; then
 
3052
    install_perl="no"
 
3053
    embed_perl="no"
 
3054
  fi
 
3055
fi
 
3056
 
 
3057
####################
 
3058
# on to embedding...
 
3059
 
 
3060
# check the compiler flags for illegal tokens
 
3061
case $target_os in
 
3062
    solaris*)
 
3063
      if test "x$embed_perl" != "xno" ; then
 
3064
          #
 
3065
          # Perl cc checks
 
3066
          #
 
3067
          AC_MSG_CHECKING([for problematic Perl cc flags on Suns])
 
3068
          if $myperl -V:ccflags | grep LARGEFILE > /dev/null ; then
 
3069
            if test "x$embed_perl" = "xtry" ; then
 
3070
              embed_perl="no"
 
3071
            else
 
3072
              AC_MSG_ERROR([Perl was compiled with LARGEFILE support which will break Net-SNMP. Either set the environment variable PERLPROG to a different perl binary or use --disable-embedded-perl to turn off embedded Perl functionality altogether.])
 
3073
            fi
 
3074
          else
 
3075
            AC_MSG_RESULT([none known])
 
3076
          fi
 
3077
      fi
 
3078
    ;;
 
3079
 
 
3080
    *)
 
3081
    ;;
 
3082
esac
 
3083
 
 
3084
 
 
3085
# check the cflags
 
3086
if test "x$embed_perl" != "xno" ; then
 
3087
    AC_MSG_CHECKING([for Perl CFLAGS])
 
3088
    perlcflags=`$myperl -MExtUtils::Embed -e ccopts`
 
3089
    if test "x$perlcflags" != "x" ; then
 
3090
      AC_MSG_RESULT([$perlcflags])
 
3091
      CFLAGS="$CFLAGS $perlcflags"
 
3092
    else
 
3093
      if test "x$embed_perl" = "xtry" ; then
 
3094
        embed_perl="no"
 
3095
      else
 
3096
        AC_MSG_ERROR([Could not determine the C compiler flags that were used to build $myperl. Either set the environment variable PERLPROG to a different Perl binary or use --disable-embedded-perl to turn off embedded Perl functionality altogether.])
 
3097
      fi
 
3098
    fi
 
3099
fi
 
3100
 
 
3101
# check the ldflags
 
3102
if test "x$embed_perl" != "xno" ; then
 
3103
    AC_MSG_CHECKING([for Perl LDFLAGS])
 
3104
    netsnmp_perlldopts=`$myperl -MExtUtils::Embed -e ldopts`
 
3105
    if test "x$netsnmp_perlldopts" != "x" ; then
 
3106
      AC_MSG_RESULT([$netsnmp_perlldopts])
 
3107
    else
 
3108
      if test "x$embed_perl" = "xtry" ; then
 
3109
        embed_perl="no"
 
3110
      else
 
3111
        AC_MSG_ERROR([Could not determine the linker options that were used to build $myperl. Either set the environment variable PERLPROG to a different Perl binary or use --disable-embedded-perl to turn off embedded Perl functionality altogether.])
 
3112
      fi
 
3113
    fi
 
3114
    if test "x$enable_as_needed" = "xyes" ; then
 
3115
      # link *libraries* with libperl
 
3116
      PERLLDOPTS_FOR_LIBS="$netsnmp_perlldopts"
 
3117
      # Perl ccdlflags (RPATH to libperl, hopefully)
 
3118
      AC_MSG_CHECKING([for Perl CCDLFLAGS])
 
3119
      changequote(, )
 
3120
      netsnmp_perlccdlflags=`$myperl -V:ccdlflags | $myperl -n -e 'print $1 '"if (/^\s*ccdlflags='([^']+)';/);"`
 
3121
      changequote([, ])
 
3122
      AC_MSG_RESULT([$netsnmp_perlccdlflags])
 
3123
      PERLLDOPTS_FOR_APPS="$netsnmp_perlccdlflags"
 
3124
    else
 
3125
      # link *applications* against libperl
 
3126
      PERLLDOPTS_FOR_APPS="$netsnmp_perlldopts"
 
3127
    fi
 
3128
fi
 
3129
 
 
3130
# check needed functions
 
3131
if test "x$embed_perl" != "xno" ; then
 
3132
    OLDLIBS="$LIBS"
 
3133
    LIBS="$LIBS $netsnmp_perlldopts"
 
3134
 
 
3135
    # newer perl vs older perl call functions
 
3136
    AC_CHECK_FUNCS(eval_pv)
 
3137
 
 
3138
    # sigh: this has a CAPITAL P in Perl, which ends up being the same
 
3139
    # autoconf define as the lower case so we have to treat them *BOTH*
 
3140
    # specially.  Wonderful.
 
3141
    AC_CHECK_FUNC(perl_eval_pv, AC_DEFINE(HAVE_PERL_EVAL_PV_LC))
 
3142
    AC_CHECK_FUNC(Perl_eval_pv, AC_DEFINE(HAVE_PERL_EVAL_PV_UC))
 
3143
 
 
3144
    LIBS="$OLDLIBS"
 
3145
 
 
3146
 
 
3147
    if test "x$ac_cv_func_perl_eval_pv" != "xyes" -a "x$ac_cv_func_Perl_eval_pv" != "xyes" -a "x$ac_cv_func_eval_pv" != "xyes" ; then
 
3148
      if test "x$embed_perl" = "xtry" ; then
 
3149
        embed_perl="no"
 
3150
      else
 
3151
        AC_MSG_ERROR([Could not find the eval_pv, perl_eval_pv or Perl_eval_pv functions needed for embedded Perl support. Either set the environment variable PERLPROG to a different perl binary or use --disable-embedded-perl to turn off embedded Perl functionality altogether.])
 
3152
      fi
 
3153
    else
 
3154
      AC_DEFINE(NETSNMP_EMBEDDED_PERL)
 
3155
      OTHERAGENTLIBOBJS="snmp_perl.o"
 
3156
      OTHERAGENTLIBLOBJS="snmp_perl.lo"
 
3157
 
 
3158
      EMBEDPERLINSTALL="embedperlinstall"
 
3159
      EMBEDPERLUNINSTALL="embedperluninstall"
 
3160
      # yay, we got here!
 
3161
      embed_perl="yes"
 
3162
    fi
 
3163
else
 
3164
      EMBEDPERLINSTALL=""
 
3165
      EMBEDPERLUNINSTALL=""
 
3166
      embed_perl="no"
 
3167
    fi
 
3168
fi
 
3169
AC_SUBST(EMBEDPERLINSTALL)
 
3170
AC_SUBST(EMBEDPERLUNINSTALL)
 
3171
AC_SUBST(PERLLDOPTS_FOR_LIBS)
 
3172
AC_SUBST(PERLLDOPTS_FOR_APPS)
 
3173
 
 
3174
# embedded Perl results
 
3175
AC_MSG_CHECKING([for potential embedded Perl support])
 
3176
if test "x$embed_perl" != "xyes" ; then
 
3177
  AC_MSG_CACHE_ADD(Embedded Perl support:      disabled)
 
3178
  AC_MSG_RESULT([disabled])
 
3179
else
 
3180
  AC_MSG_CACHE_ADD(Embedded Perl support:      enabled)
 
3181
  AC_MSG_RESULT([enabled])
 
3182
fi
 
3183
 
 
3184
# install Perl module results
 
3185
PERLTARGS=""
 
3186
PERLINSTALLTARGS=""
 
3187
PERLUNINSTALLTARGS=""
 
3188
AC_MSG_CHECKING([if we can install the Perl modules])
 
3189
if test "x$install_perl" = "xyes" ; then
 
3190
    PERLTARGS="perlmodules"
 
3191
    PERLINSTALLTARGS="perlinstall"
 
3192
    PERLUNINSTALLTARGS="perluninstall"
 
3193
    if test "x$embed_perl" = "xyes" ; then
 
3194
      AC_MSG_CACHE_ADD(SNMP Perl modules:          building -- embeddable)
 
3195
      AC_MSG_RESULT([yes -- and embeddable])
 
3196
    else
 
3197
      AC_MSG_CACHE_ADD(SNMP Perl modules:          building -- not embeddable)
 
3198
      AC_MSG_RESULT([yes -- not embeddable])
 
3199
    fi
 
3200
else
 
3201
    AC_MSG_RESULT([no])
 
3202
    AC_MSG_CACHE_ADD(SNMP Perl modules:          disabled)
 
3203
fi
 
3204
AC_SUBST(PERLTARGS)
 
3205
AC_SUBST(PERLINSTALLTARGS)
 
3206
AC_SUBST(PERLUNINSTALLTARGS)
 
3207
AC_SUBST(PERLARGS)
 
3208
 
 
3209
 
 
3210
 
 
3211
# reset libs
 
3212
AGENTLIBS=$LIBS
 
3213
LIBS=$NONAGENTLIBS
 
3214
 
 
3215
 
 
3216
 
 
3217
# python support
 
3218
PYTHONTARGS=""
 
3219
PYTHONINSTALLTARGS=""
 
3220
PYTHONUNINSTALLTARGS=""
 
3221
PYTHONCLEANTARGS=""
 
3222
AC_MSG_CHECKING([if we should install the python bindings])
 
3223
if test "x$install_python" = "xyes" ; then
 
3224
    PYTHONTARGS="pythonmodules"
 
3225
    PYTHONINSTALLTARGS="pythoninstall"
 
3226
    PYTHONUNINSTALLTARGS="pythonuninstall"
 
3227
    PYTHONCLEANTARGS="pythonclean"
 
3228
    AC_MSG_CACHE_ADD(SNMP Python modules:        building for $PYTHONPROG)
 
3229
    AC_MSG_RESULT([yes])
 
3230
else
 
3231
    AC_MSG_CACHE_ADD(SNMP Python modules:        disabled)
 
3232
    AC_MSG_RESULT([no])
 
3233
fi
 
3234
AC_SUBST(PYTHONTARGS)
 
3235
AC_SUBST(PYTHONINSTALLTARGS)
 
3236
AC_SUBST(PYTHONUNINSTALLTARGS)
 
3237
AC_SUBST(PYTHONCLEANTARGS)
 
3238
AC_SUBST(PYTHONARGS)
 
3239
 
 
3240
 
 
3241
 
 
3242
# Checks for header files.
 
3243
AC_HEADER_STDC
 
3244
AC_HEADER_DIRENT
 
3245
AC_HEADER_SYS_WAIT
 
3246
AC_CHECK_HEADERS(stdarg.h string.h fcntl.h limits.h sys/file.h sys/ioctl.h syslog.h unistd.h sys/dmap.h machine/pte.h xti.h sys/sockio.h sys/socket.h sys/param.h sys/uio.h)
 
3247
# at least Solaris 9 needs sys/socket.h to compile sys/socketvar.h
 
3248
AC_CHECK_HEADERS(sys/socketvar.h,,,
 
3249
AC_INCLUDES_DEFAULT([])
 
3250
[
 
3251
#if HAVE_SYS_SOCKET_H
 
3252
#include <sys/socket.h>
 
3253
#endif
 
3254
])
 
3255
# at least OpenBSD 3.4 needs sys/param.h (MAXPATHLEN) to compile sys/swap.h
 
3256
AC_CHECK_HEADERS(sys/swap.h,,,
 
3257
AC_INCLUDES_DEFAULT([])
 
3258
[
 
3259
#if HAVE_SYS_PARAM_H
 
3260
#include <sys/param.h>
 
3261
#endif
 
3262
])
 
3263
AC_CHECK_HEADERS(sys/timeout.h sys/un.h fstab.h sys/fs.h mtab.h ufs/fs.h sys/fixpoint.h machine/param.h sys/vm.h vm/vm.h sys/vmmeter.h sys/vmparam.h sys/vmmac.h sys/vmsystm.h sys/time.h sys/times.h sys/statvfs.h sys/vfs.h sys/mnttab.h sys/select.h mntent.h sys/mntent.h kstat.h utsname.h sys/utsname.h sys/cdefs.h getopt.h locale.h pthread.h sys/loadavg.h regex.h linux/tasks.h pwd.h grp.h utmpx.h)
 
3264
# Network headers
 
3265
AC_CHECK_HEADERS(arpa/inet.h netinet/in_systm.h netinet/in.h netinet/ip_var.h netinet/tcp.h netinet/tcpip.h netinet/udp.h net/if.h netinet/in_var.h netinet/ip.h netinet/ip_icmp.h net/if_arp.h net/if_mib.h net/if_var.h netinet/if_ether.h netinet/tcp_timer.h netinet/tcp_var.h netinet/udp_var.h netinet/icmp_var.h netdb.h net/route.h,,,
 
3266
[[
 
3267
#if HAVE_SYS_TYPES_H
 
3268
#include <sys/types.h>
 
3269
#endif
 
3270
#if HAVE_SYS_TIMEOUT_H
 
3271
#include <sys/timeout.h>
 
3272
#endif
 
3273
#if HAVE_SYS_SOCKET_H
 
3274
#include <sys/socket.h>
 
3275
#endif
 
3276
#if HAVE_SYS_SOCKETVAR_H
 
3277
#include <sys/socketvar.h>
 
3278
#endif
 
3279
#if HAVE_ARPA_INET_H
 
3280
#include <arpa/inet.h>
 
3281
#endif
 
3282
#if HAVE_NETINET_IN_SYSTM_H
 
3283
#include <netinet/in_systm.h>
 
3284
#endif
 
3285
#if HAVE_NETINET_IN_H
 
3286
#include <netinet/in.h>
 
3287
#endif
 
3288
#if HAVE_NETINET_IP_H
 
3289
#include <netinet/ip.h>
 
3290
#endif
 
3291
#if HAVE_NET_IF_H
 
3292
#include <net/if.h>
 
3293
#endif
 
3294
#if HAVE_NETINET_IP_VAR_H
 
3295
#include <netinet/ip_var.h>
 
3296
#endif
 
3297
#if HAVE_NETINET_IP_ICMP_H
 
3298
#include <netinet/ip_icmp.h>
 
3299
#endif
 
3300
#if HAVE_NETINET_TCP_H
 
3301
#include <netinet/tcp.h>
 
3302
#endif
 
3303
#if HAVE_NETINET_UDP_H
 
3304
#include <netinet/udp.h>
 
3305
#endif
 
3306
#if HAVE_NETINET_TCP_TIMER_H
 
3307
#include <netinet/tcp_timer.h>
 
3308
#endif
 
3309
]])
 
3310
# UFS headers
 
3311
AC_CHECK_HEADERS(ufs/ufs/dinode.h ufs/ufs/quota.h ufs/ufs/inode.h ufs/ffs/fs.h,,,
 
3312
[[
 
3313
#if HAVE_SYS_TYPES_H
 
3314
#include <sys/types.h>
 
3315
#endif
 
3316
#if HAVE_UFS_UFS_DINODE_H
 
3317
#include <ufs/ufs/dinode.h>
 
3318
#endif
 
3319
#if HAVE_UFS_UFS_QUOTA_H
 
3320
#include <ufs/ufs/quota.h>
 
3321
#endif
 
3322
]])
 
3323
# FreeBSD required headers
 
3324
AC_CHECK_HEADERS(malloc.h net/if_dl.h sys/sysctl.h stdlib.h net/if_types.h sys/queue.h osreldate.h machine/types.h sys/user.h sys/proc.h sys/mbuf.h sys/mount.h sys/dkstat.h sys/conf.h,,,
 
3325
[[
 
3326
#if HAVE_SYS_TYPES_H
 
3327
#include <sys/types.h>
 
3328
#endif
 
3329
#if HAVE_SYS_PARAM_H
 
3330
#include <sys/param.h>
 
3331
#endif
 
3332
]])
 
3333
# Linux
 
3334
AC_CHECK_HEADERS(netinet/tcp_fsm.h sys/protosw.h nlist.h ioctls.h asm/page.h asm/types.h netipx/ipx.h pci/pci.h)
 
3335
# Solaris
 
3336
AC_CHECK_HEADERS(inet/mib2.h)
 
3337
# NetBSD required headers
 
3338
AC_CHECK_HEADERS(kvm.h sys/pool.h uvm/uvm_param.h uvm/uvm_extern.h vm/vm_param.h vm/vm_extern.h)
 
3339
# BSDi2 headers
 
3340
AC_CHECK_HEADERS(vm/swap_pager.h,,,
 
3341
[[
 
3342
#if HAVE_VM_VM_H
 
3343
#include <vm/vm.h>
 
3344
#endif
 
3345
]])
 
3346
# linux ethtool
 
3347
# requires special hacks to get around various problems on older linux kernels.
 
3348
# major ugh....
 
3349
AC_CHECK_HEADERS([linux/ethtool.h],,,
 
3350
[[
 
3351
#include <linux/types.h>
 
3352
typedef __u64 u64;         /* hack, so we may include kernel's ethtool.h */
 
3353
typedef __u32 u32;         /* ditto */
 
3354
typedef __u16 u16;         /* ditto */
 
3355
typedef __u8 u8;           /* ditto */
 
3356
]])
 
3357
# BSDi3 headers
 
3358
AC_CHECK_HEADERS(sys/stat.h)
 
3359
# BSDi3/IRIX headers
 
3360
# at least IRIX 6.5 needs _KMEMUSER and sys/types.h (mprot_t) to compile 
 
3361
#   sys/vnode.h
 
3362
AC_CHECK_HEADERS(sys/vnode.h,,,
 
3363
[
 
3364
#define _KMEMUSER 1
 
3365
#if HAVE_SYS_TYPES_H
 
3366
#include <sys/types.h>
 
3367
#endif
 
3368
])
 
3369
# at least IRIX 6.5 needs sys/sema.h (mrlock_t) to compile sys/hashing.h
 
3370
AC_CHECK_HEADERS(sys/sema.h)
 
3371
AC_CHECK_HEADERS(sys/hashing.h,,,
 
3372
AC_INCLUDES_DEFAULT([])
 
3373
[
 
3374
#if HAVE_SYS_SEMA_H
 
3375
#include <sys/sema.h>
 
3376
#endif
 
3377
])
 
3378
# more IRIX headers
 
3379
AC_CHECK_HEADERS(sys/tcpipstats.h sys/sysmp.h sys/systeminfo.h sys/sysget.h)
 
3380
# AIX system configuration
 
3381
AC_CHECK_HEADERS(sys/systemcfg.h)
 
3382
# from smux stuff
 
3383
AC_CHECK_HEADERS(err.h sys/filio.h sgtty.h)
 
3384
# AIX needs this for statfs func
 
3385
AC_CHECK_HEADERS(sys/statfs.h)
 
3386
# for HostRes (HP-UX at least)
 
3387
AC_CHECK_HEADERS(sys/dkio.h sys/diskio.h sys/pstat.h linux/hdreg.h pkglocs.h)
 
3388
# for HostRes (Solaris 2.x at least)
 
3389
AC_CHECK_HEADERS(pkginfo.h,
 
3390
    AC_CHECK_LIB(adm, pkginfo, AC_DEFINE(HAVE_PKGINFO)
 
3391
    LMIBLIBS="${LMIBLIBS} -ladm"))
 
3392
 
 
3393
case $target_os in
 
3394
    aix*) # AIX perfstat library, needed for CPU/memory statistics
 
3395
        AC_CHECK_HEADERS(libperfstat.h,
 
3396
            AC_CHECK_LIB(perfstat, perfstat_cpu_total, AC_DEFINE(HAVE_PERFSTAT)
 
3397
            LMIBLIBS="${LMIBLIBS} -lperfstat"), AC_MSG_ERROR([
 
3398
 
 
3399
*** To monitor CPU/memory values in AIX you need to install
 
3400
*** libperfstat which can be found in bos.perf
 
3401
]))
 
3402
        ;;
 
3403
    hpux*) # HP-UX agent needs open_mib
 
3404
        AC_CHECK_LIB(nm, open_mib, AC_DEFINE(HAVE_LIBNM)
 
3405
            LMIBLIBS="${LMIBLIBS} -lnm")
 
3406
        ;;
 
3407
    *)
 
3408
        ;;
 
3409
esac
 
3410
# WIN32
 
3411
# (mingw32 must link winsock explicitly)
 
3412
AC_CHECK_HEADERS(winsock.h,[
 
3413
        AGENTLIBS="${AGENTLIBS} -liphlpapi"
 
3414
        case $target_os in
 
3415
                mingw*)
 
3416
                        LIBS="${LIBS} -lregex -lws2_32"
 
3417
                        AGENTLIBS="${AGENTLIBS} -lregex -lws2_32"
 
3418
                        ;;
 
3419
                *)
 
3420
                        ;;
 
3421
        esac
 
3422
])
 
3423
AC_CHECK_HEADERS(io.h)
 
3424
# SCO
 
3425
AC_CHECK_HEADERS(sys/stream.h)
 
3426
# KAME
 
3427
AC_CHECK_HEADERS(netinet/ip6.h netinet6/in6_var.h netinet6/in6_pcb.h netinet6/ip6_var.h netinet6/tcp6.h netinet6/tcp6_fsm.h netinet6/nd6.h netinet6/tcp6_timer.h netinet6/tcp6_var.h,,,
 
3428
[[
 
3429
#if HAVE_SYS_TYPES_H
 
3430
#include <sys/types.h>
 
3431
#endif
 
3432
#if HAVE_SYS_QUEUE_H
 
3433
#include <sys/queue.h>
 
3434
#endif
 
3435
#if HAVE_NETINET_IN_H
 
3436
#include <netinet/in.h>
 
3437
#endif
 
3438
#if HAVE_NETINET_IP6_H
 
3439
#include <netinet/ip6.h>
 
3440
#endif
 
3441
]])
 
3442
# DYNAMIC MODULE SUPPORT
 
3443
AC_CHECK_HEADERS(dlfcn.h)
 
3444
# table_array helper support
 
3445
AC_CHECK_HEADERS(search.h)
 
3446
 
 
3447
# RPM subdirectory path (sigh)
 
3448
if test "x$with_rpm" != "xno" && \
 
3449
        echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
 
3450
  AC_CHECK_HEADERS(rpm/rpmdb.h)
 
3451
fi
 
3452
 
 
3453
# OpenBSD 2.6 needs netinet/in.h before netinet/in_pcb.h
 
3454
AC_MSG_CHECKING([[for netinet/in_pcb.h]])
 
3455
AC_CACHE_VAL(cv_have_netinet_in_pcb_h,
 
3456
[ AC_TRY_CPP( [
 
3457
#include <netinet/in.h>
 
3458
#include <netinet/in_pcb.h>
 
3459
], cv_have_netinet_in_pcb_h=yes, cv_have_netinet_in_pcb_h=no)])
 
3460
AC_MSG_RESULT($cv_have_netinet_in_pcb_h)
 
3461
if test $cv_have_netinet_in_pcb_h = yes; then
 
3462
  AC_DEFINE(HAVE_NETINET_IN_PCB_H)
 
3463
fi
 
3464
 
 
3465
# NetBSD needs machine/types.h before sys/disklabel.h
 
3466
AC_MSG_CHECKING([[for sys/disklabel.h]])
 
3467
AC_CACHE_VAL(cv_have_sys_disklabel_h,
 
3468
[ AC_TRY_CPP( [
 
3469
#include <machine/types.h>
 
3470
#include <sys/disklabel.h>
 
3471
], cv_have_sys_disklabel_h=yes, cv_have_sys_disklabel_h=no)])
 
3472
AC_MSG_RESULT($cv_have_sys_disklabel_h)
 
3473
if test $cv_have_sys_disklabel_h = yes; then
 
3474
  AC_DEFINE(HAVE_SYS_DISKLABEL_H)
 
3475
fi
 
3476
 
 
3477
# OpenSSL
 
3478
AC_CHECK_HEADERS(openssl/hmac.h openssl/evp.h openssl/aes.h openssl/des.h openssl/dh.h)
 
3479
AC_CHECK_HEADERS(security/cryptoki.h)
 
3480
 
 
3481
# Printing
 
3482
AC_PATH_PROG([LPSTAT_PATH],lpstat)
 
3483
if test x$LPSTAT_PATH != x; then
 
3484
    AC_DEFINE_UNQUOTED(LPSTAT_PATH,"$LPSTAT_PATH")
 
3485
    AC_DEFINE(HAVE_LPSTAT)
 
3486
fi
 
3487
AC_CHECK_FUNCS(cgetnext)
 
3488
if test -r /etc/printcap; then
 
3489
    AC_DEFINE(HAVE_PRINTCAP)
 
3490
fi
 
3491
 
 
3492
AC_MSG_CHECKING([for authentication support])
 
3493
useopenssl=no
 
3494
usepkcs=no
 
3495
if test "x$ac_cv_lib_pkcs11_C_Initialize" != "xyes" -o "x$ac_cv_header_security_cryptoki_h" != "xyes"; then
 
3496
    if test "x$askedpkcs" = "xyes"; then
 
3497
       AC_MSG_ERROR(Asked to use PKCS11 but I couldn't find it.)
 
3498
    fi
 
3499
else
 
3500
    if test "x$askedpkcs" = "xyes"; then
 
3501
        usepkcs=yes
 
3502
    fi
 
3503
fi
 
3504
 
 
3505
if test "x$ac_cv_lib_crypto_EVP_md5" != "xyes" -o "x$ac_cv_header_openssl_hmac_h" != "xyes" -o "x$ac_cv_header_openssl_hmac_h" != "xyes"; then
 
3506
    if test "x$askedopenssl" = "xyes"; then
 
3507
        AC_MSG_ERROR(Asked to use OpenSSL but I couldn't find it.)
 
3508
    fi
 
3509
else
 
3510
    if test "x$askedopenssl" = "xyes"; then
 
3511
        useopenssl=yes
 
3512
    elif test "x$tryopenssl" = "xyes"; then
 
3513
        if test "x$usepkcs" != "xyes"; then
 
3514
            useopenssl=yes
 
3515
        fi
 
3516
    fi
 
3517
fi
 
3518
 
 
3519
if test "x$useopenssl" != "xno" ; then
 
3520
    authmodes="MD5 SHA1"
 
3521
    if test "x$enable_privacy" != "xno" ; then
 
3522
        if test "x$ac_cv_header_openssl_aes_h" = "xyes" ; then
 
3523
            encrmodes="DES AES"
 
3524
        else
 
3525
            encrmodes="DES"
 
3526
        fi
 
3527
    else
 
3528
        encrmodes="[disabled]"
 
3529
    fi
 
3530
    AC_DEFINE(NETSNMP_USE_OPENSSL)
 
3531
    LNETSNMPLIBS="$LNETSNMPLIBS $LIBCRYPTO"
 
3532
    AC_MSG_RESULT(OpenSSL Support)
 
3533
elif test "x$usepkcs" != "xno" ; then
 
3534
    authmodes="MD5 SHA1"
 
3535
    if test "x$enable_privacy" != "xno" ; then
 
3536
        encrmodes="DES"
 
3537
    else
 
3538
        encrmodes="[disabled]"
 
3539
    fi
 
3540
    AC_DEFINE(NETSNMP_USE_PKCS11)
 
3541
    LNETSNMPLIBS="$LNETSNMPLIBS $LIBPKCS11"
 
3542
    AC_MSG_RESULT(PKCS11 Support)
 
3543
elif test "x$enable_md5" != "xno"; then
 
3544
    authmodes="MD5"
 
3545
    encrmodes=""
 
3546
    AC_DEFINE(NETSNMP_USE_INTERNAL_MD5)
 
3547
    AC_MSG_RESULT(Internal MD5 Support)
 
3548
fi
 
3549
if test "x$enable_md5" = "xno"; then
 
3550
    authmodes=`echo $authmodes | sed 's/MD5 *//;'`
 
3551
fi
 
3552
AC_SUBST(LNETSNMPLIBS)
 
3553
AC_SUBST(LAGENTLIBS)
 
3554
 
 
3555
AC_MSG_CACHE_ADD(Authentication support:     $authmodes)
 
3556
AC_MSG_CACHE_ADD(Encryption support:         $encrmodes)
 
3557
 
 
3558
if test "x$all_warnings" != "x"; then
 
3559
    AC_MSG_CACHE_ADD(WARNING: $all_warnings)
 
3560
fi
 
3561
 
 
3562
# Checks for typedefs, structures, and compiler characteristics.
 
3563
AC_TYPE_OFF_T
 
3564
AC_TYPE_PID_T
 
3565
AC_HEADER_TIME
 
3566
 
 
3567
# this should use AC_CHECK_TYPE, but it's broken at least in 2.13-14
 
3568
# so we do it by hand.
 
3569
AC_MSG_CHECKING([for socklen_t])
 
3570
AC_CACHE_VAL(ac_cv_type_$1,
 
3571
[AC_EGREP_CPP([socklen_t@<:@^a-zA-Z_0-9@:>@],
 
3572
[#include <sys/types.h>
 
3573
#if STDC_HEADERS
 
3574
#include <stdlib.h>
 
3575
#include <stddef.h>
 
3576
#endif
 
3577
#ifdef HAVE_SYS_SOCKET_H
 
3578
#include <sys/socket.h>
 
3579
#endif], [ac_cv_type_socklen_t=yes], [ac_cv_type_socklen_t=no])])
 
3580
 
 
3581
AC_MSG_RESULT([$ac_cv_type_socklen_t])
 
3582
if test $ac_cv_type_socklen_t = yes; then
 
3583
  AC_DEFINE(HAVE_SOCKLEN_T)
 
3584
fi
 
3585
 
 
3586
# AIX keeps in_addr_t in /usr/include/netinet/in.h
 
3587
AC_MSG_CHECKING([for in_addr_t])
 
3588
AC_CACHE_VAL(ac_cv_type_$1,
 
3589
[AC_EGREP_CPP([in_addr_t@<:@^a-zA-Z_0-9@:>@],
 
3590
[#include <sys/types.h>
 
3591
#if STDC_HEADERS
 
3592
#include <stdlib.h>
 
3593
#include <stddef.h>
 
3594
#endif
 
3595
#ifdef HAVE_NETINET_IN_H
 
3596
#include <netinet/in.h>
 
3597
#endif], [ac_cv_type_in_addr_t=yes], [ac_cv_type_in_addr_t=no])])
 
3598
 
 
3599
AC_MSG_RESULT([$ac_cv_type_in_addr_t])
 
3600
if test $ac_cv_type_in_addr_t = yes; then
 
3601
  AC_DEFINE(HAVE_IN_ADDR_T)
 
3602
fi
 
3603
 
 
3604
# Older versions of MinGW do not define ssize_t in sys/types
 
3605
AC_MSG_CHECKING([for ssize_t])
 
3606
AC_CACHE_VAL(ac_cv_type_$1,
 
3607
[AC_EGREP_CPP([ssize_t@<:@^a-zA-Z_0-9@:>@],
 
3608
[#include <sys/types.h>
 
3609
#if STDC_HEADERS
 
3610
#include <stdlib.h>
 
3611
#include <stddef.h>
 
3612
#endif], [ac_cv_type_ssize_t=yes], [ac_cv_type_ssize_t=no])])
 
3613
 
 
3614
AC_MSG_RESULT([$ac_cv_type_ssize_t])
 
3615
if test $ac_cv_type_ssize_t = yes; then
 
3616
  AC_DEFINE(HAVE_SSIZE_T, 1, [Define if type ssize_t is available])
 
3617
fi
 
3618
 
 
3619
# Check ps args
 
3620
AC_CACHE_CHECK([for correct flags to ps], ac_cv_ps_flags,
 
3621
[if test "`($PSPROG -e 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
 
3622
  ac_cv_ps_flags="-e"
 
3623
elif test "`($PSPROG -el 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
 
3624
  ac_cv_ps_flags="-el"
 
3625
elif test "`($PSPROG acx 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
 
3626
  ac_cv_ps_flags="acx"
 
3627
elif test "`($PSPROG -acx 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
 
3628
  ac_cv_ps_flags="-acx"
 
3629
elif test "`($PSPROG -o pid,tt,state,time,ucomm 2>&1) | $EGREP ' ps *$' | awk '{print $NF}'`" = "ps" ; then
 
3630
  ac_cv_ps_flags="-o pid,tt,state,time,ucomm"
 
3631
elif test "`($PSPROG ax 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
 
3632
  ac_cv_ps_flags="ax"
 
3633
elif test "x$PARTIALTARGETOS" = "xcygwin"; then
 
3634
  ac_cv_ps_flags="-e"
 
3635
elif test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc"; then 
 
3636
  ac_cv_ps_flags="-e"
 
3637
else
 
3638
  AC_MSG_WARN([Unable to determine valid ps flags...  defaulting...])
 
3639
  ac_cv_ps_flags="-acx"
 
3640
fi
 
3641
])
 
3642
 
 
3643
PSCMD="$PSPROG $ac_cv_ps_flags"
 
3644
AC_SUBST(PSCMD)
 
3645
AC_DEFINE_UNQUOTED(PSCMD, "$PSPROG $ac_cv_ps_flags")
 
3646
 
 
3647
# Checks for byte order
 
3648
if test $cross_compiling = yes; then
 
3649
  if test x$with_endianness = xbig; then
 
3650
    AC_DEFINE(WORDS_BIGENDIAN)
 
3651
  elif test -z $with_endianness; then
 
3652
    AC_MSG_ERROR([You are cross-compiling, but you have not specified the target's endianness])
 
3653
  fi
 
3654
else
 
3655
  if test $with_endianness; then
 
3656
    AC_MSG_ERROR([Endianness has been specified, but you are not cross-compiling.])
 
3657
  fi
 
3658
  AC_C_BIGENDIAN
 
3659
fi
 
3660
 
 
3661
# Checks for library functions.
 
3662
AC_FUNC_ALLOCA
 
3663
AC_PROG_GCC_TRADITIONAL
 
3664
AC_FUNC_MEMCMP
 
3665
AC_TYPE_SIGNAL
 
3666
AC_FUNC_GETMNTENT
 
3667
AC_CHECK_FUNCS(setmntent hasmntopt gethostname uname gettimeofday select socket strtol strtoul strlcpy)
 
3668
AC_CHECK_FUNCS(strchr strtok_r strdup memcpy memmove index bcopy strcasestr regcomp)
 
3669
AC_CHECK_FUNCS(signal setsid sigset sigblock sighold strerror setenv vsnprintf snprintf)
 
3670
AC_CHECK_FUNCS(sigaction)
 
3671
AC_CHECK_FUNCS(random lrand48 rand)
 
3672
AC_CHECK_FUNCS(execv system fork getpid strncasecmp sigalrm)
 
3673
AC_CHECK_FUNCS(lseek64 pread64)
 
3674
if test "x$with_rpm" != "xno" && \
 
3675
        echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
 
3676
  OLDLIBS=$LIBS
 
3677
  LIBS=$LMIBLIBS
 
3678
  AC_CHECK_FUNCS(rpmGetPath)
 
3679
  LIBS=$OLDLIBS
 
3680
fi
 
3681
 
 
3682
AC_CHECK_FUNCS(getloadavg)
 
3683
AC_CHECK_FUNCS(getaddrinfo getipnodebyname gai_strerror)
 
3684
# BSDi2 functions differ
 
3685
AC_CHECK_FUNCS(statvfs statfs)
 
3686
AC_CHECK_FUNCS(getdtablesize)
 
3687
# freebsd2 checks
 
3688
AC_CHECK_FUNCS(getfsstat)
 
3689
AC_CHECK_FUNCS(usleep)
 
3690
AC_CHECK_FUNCS(setlocale)
 
3691
AC_CHECK_FUNCS(tcgetattr)
 
3692
AC_CHECK_FUNCS(if_nameindex if_freenameindex)
 
3693
# solaris checks
 
3694
AC_CHECK_FUNCS(getpagesize)
 
3695
AC_CHECK_FUNCS(mkstemp)
 
3696
AC_CHECK_FUNCS(getpwnam getgrnam setgid setuid setgroups)
 
3697
# High resolution alarm support
 
3698
AC_CHECK_FUNCS(setitimer)
 
3699
# functions to support the clock.
 
3700
AC_CHECK_FUNCS(mktime stime times sysconf)
 
3701
# missing from hp-ux
 
3702
AC_CHECK_FUNCS(if_nametoindex)
 
3703
# missing from MinGW
 
3704
AC_CHECK_FUNCS(chown localtime_r)
 
3705
 
 
3706
AC_MSG_CHECKING([[for SIOCGIFADDR in sys/ioctl.h]])
 
3707
AC_CACHE_VAL(cv_sys_ioctl_h_has_SIOCGIFADDR,
 
3708
[ AC_EGREP_CPP(xxxyesxxx,
 
3709
[
 
3710
#ifdef HAVE_SYS_IOCTL_H
 
3711
#include <sys/ioctl.h>
 
3712
#endif
 
3713
#ifdef SIOCGIFADDR
 
3714
xxxyesxxx
 
3715
#endif
 
3716
], cv_sys_ioctl_h_has_SIOCGIFADDR=yes, cv_sys_ioctl_h_has_SIOCGIFADDR=no)])
 
3717
AC_MSG_RESULT($cv_sys_ioctl_h_has_SIOCGIFADDR)
 
3718
if test $cv_sys_ioctl_h_has_SIOCGIFADDR = yes; then
 
3719
  AC_DEFINE(SYS_IOCTL_H_HAS_SIOCGIFADDR)
 
3720
fi
 
3721
 
 
3722
# ultrix
 
3723
AC_MSG_CHECKING([[for two-argument statfs with struct fs_data (Ultrix)]])
 
3724
AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
 
3725
[AC_TRY_RUN([
 
3726
#ifdef HAVE_SYS_PARAM_H
 
3727
#include <sys/param.h>
 
3728
#endif
 
3729
#include <sys/types.h>
 
3730
#ifdef HAVE_SYS_MOUNT_H
 
3731
#include <sys/mount.h>
 
3732
#endif
 
3733
#ifdef HAVE_SYS_FS_TYPES_H
 
3734
#include <sys/fs_types.h>
 
3735
#endif
 
3736
main ()
 
3737
{
 
3738
struct fs_data fsd;
 
3739
/* Ultrix's statfs returns 1 for success,
 
3740
   0 for not mounted, -1 for failure.  */
 
3741
exit (statfs (".", &fsd) != 1);
 
3742
}],
 
3743
fu_cv_sys_stat_fs_data=yes,
 
3744
fu_cv_sys_stat_fs_data=no,
 
3745
fu_cv_sys_stat_fs_data=no)])
 
3746
AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
 
3747
if test $fu_cv_sys_stat_fs_data = yes; then
 
3748
  AC_DEFINE(STAT_STATFS_FS_DATA)
 
3749
fi
 
3750
 
 
3751
# check if compiler pre-processor defines __FUNCTION__
 
3752
AC_CACHE_CHECK(if __FUNCTION__ is defined,ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED,
 
3753
[
 
3754
AC_TRY_COMPILE(,[
 
3755
    char *cp = __FUNCTION__;
 
3756
], ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=yes, ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=no)])
 
3757
 
 
3758
if test "x$ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED" = "xyes"; then
 
3759
  AC_DEFINE(HAVE_CPP_UNDERBAR_FUNCTION_DEFINED)
 
3760
fi
 
3761
 
 
3762
#--------------------------------------------------------------
 
3763
# on SCO Unixware 7.1.4 (SCO compiler), "static inline" functions
 
3764
# are not supported, so this disables the whole inline thing if it
 
3765
# doesn't work properly. Should have no effect on other platforms.
 
3766
AC_CACHE_CHECK([[whether static inline functions are broken (Unixware)]],
 
3767
    [netsnmp_cv_c_broken_inline],
 
3768
AC_COMPILE_IFELSE([[
 
3769
static inline int nested_inline_function(void) {
 
3770
  return 0;
 
3771
}
 
3772
inline int main_inline_function( void ) {
 
3773
  return nested_inline_function();
 
3774
}
 
3775
]], netsnmp_cv_broken_inline=no, netsnmp_cv_broken_inline=yes))
 
3776
 
 
3777
# But, sadly, the usage of inline in NET_SNMP disagrees seriously with at least
 
3778
# solaris2, so disable it for now.
 
3779
case "$target_os" in
 
3780
    solaris*)
 
3781
        netsnmp_cv_broken_inline=yes
 
3782
        ;;
 
3783
    *)
 
3784
        ;;
 
3785
esac
 
3786
 
 
3787
if test "$netsnmp_cv_broken_inline" = yes ; then
 
3788
  AC_DEFINE(NETSNMP_BROKEN_INLINE, 1,
 
3789
        [Define if static inline functions are unsupported])
 
3790
fi
 
3791
 
 
3792
# openbsd seems to have dropped m_clusters and m_clfree from mbstat
 
3793
AC_CHECK_STRUCT_FOR([
 
3794
#if HAVE_SYS_MBUF_H
 
3795
#include <sys/mbuf.h>
 
3796
#endif
 
3797
], mbstat, m_clusters, no)
 
3798
 
 
3799
# openbsd seems to have dropped m_mbufs from mbstat too
 
3800
AC_CHECK_STRUCT_FOR([
 
3801
#if HAVE_SYS_MBUF_H
 
3802
#include <sys/mbuf.h>
 
3803
#endif
 
3804
], mbstat, m_mbufs, no)
 
3805
 
 
3806
 
 
3807
AC_CHECK_STRUCT_FOR([
 
3808
#ifdef HAVE_SYS_PARAM_H
 
3809
#include <sys/param.h>
 
3810
#endif
 
3811
#include <sys/types.h>
 
3812
#include <sys/signal.h>
 
3813
], sigaction, sa_sigaction, no)
 
3814
 
 
3815
AC_CHECK_STRUCT_FOR([
 
3816
#include <sys/types.h>
 
3817
#if TIME_WITH_SYS_TIME
 
3818
# include <sys/time.h>
 
3819
# include <time.h>
 
3820
#else
 
3821
# if HAVE_SYS_TIME_H
 
3822
#  include <sys/time.h>
 
3823
# else
 
3824
#  include <time.h>
 
3825
# endif
 
3826
#endif
 
3827
], tm, tm_gmtoff, no)
 
3828
 
 
3829
AC_CHECK_STRUCT_FOR([
 
3830
#ifdef HAVE_SYS_PARAM_H
 
3831
#include <sys/param.h>
 
3832
#endif
 
3833
#include <sys/types.h>
 
3834
#include <sys/socket.h>
 
3835
#include <net/if.h>
 
3836
#ifdef HAVE_NET_IF_VAR_H
 
3837
#include <net/if_var.h>
 
3838
#endif
 
3839
], ifnet, if_mtu)
 
3840
 
 
3841
if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xno"; then
 
3842
AC_CACHE_CHECK(if _KERNEL needs to be defined for if_mtu, ac_cv_IFNET_NEEDS_KERNEL,
 
3843
[
 
3844
if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xyes"; then
 
3845
  ac_cv_IFNET_NEEDS_KERNEL=no
 
3846
else
 
3847
AC_TRY_COMPILE([
 
3848
#define _KERNEL 1
 
3849
#ifdef HAVE_SYS_PARAM_H
 
3850
#include <sys/param.h>
 
3851
#endif
 
3852
#include <sys/types.h>
 
3853
#include <sys/socket.h>
 
3854
#ifdef HAVE_SYS_TIME_H
 
3855
#include <sys/time.h>
 
3856
#endif
 
3857
#include <net/if.h>
 
3858
#ifdef HAVE_NET_IF_VAR_H
 
3859
#include <net/if_var.h>
 
3860
#endif
 
3861
],[
 
3862
struct ifnet testit;
 
3863
testit.if_mtu = 0;
 
3864
], ac_cv_IFNET_NEEDS_KERNEL=yes, ac_cv_IFNET_NEEDS_KERNEL=no)
 
3865
fi
 
3866
])
 
3867
 
 
3868
if test "x$ac_cv_IFNET_NEEDS_KERNEL" = "xyes"; then
 
3869
  AC_DEFINE(IFNET_NEEDS_KERNEL)
 
3870
fi
 
3871
fi
 
3872
 
 
3873
AC_CHECK_STRUCT_FOR([
 
3874
#ifdef HAVE_SYS_PARAM_H
 
3875
#include <sys/param.h>
 
3876
#endif
 
3877
#include <sys/types.h>
 
3878
#ifdef IFNET_NEEDS_KERNEL
 
3879
#define KERNEL
 
3880
#define _KERNEL
 
3881
#endif
 
3882
#include <sys/socket.h>
 
3883
], sockaddr, sa_len, no)
 
3884
 
 
3885
AC_CHECK_STRUCT_FOR([
 
3886
#ifdef HAVE_SYS_PARAM_H
 
3887
#include <sys/param.h>
 
3888
#endif
 
3889
#include <sys/types.h>
 
3890
#ifdef IFNET_NEEDS_KERNEL
 
3891
#define KERNEL
 
3892
#define _KERNEL
 
3893
#endif
 
3894
#include <sys/socket.h>
 
3895
], sockaddr, sa_union.sa_generic.sa_family2, no)
 
3896
 
 
3897
AC_CHECK_STRUCT_FOR([
 
3898
#if HAVE_SYS_PARAM_H
 
3899
#include <sys/param.h>
 
3900
#endif
 
3901
#if HAVE_SYS_TYPES_H
 
3902
#include <sys/types.h>
 
3903
#endif
 
3904
#if HAVE_SYS_SOCKET_H
 
3905
#include <sys/socket.h>
 
3906
#endif
 
3907
], sockaddr_storage, ss_family, no)
 
3908
 
 
3909
AC_CHECK_STRUCT_FOR([
 
3910
#if HAVE_SYS_PARAM_H
 
3911
#include <sys/param.h>
 
3912
#endif
 
3913
#if HAVE_SYS_TYPES_H
 
3914
#include <sys/types.h>
 
3915
#endif
 
3916
#if HAVE_SYS_SOCKET_H
 
3917
#include <sys/socket.h>
 
3918
#endif
 
3919
], sockaddr_storage, __ss_family, no)
 
3920
 
 
3921
AC_CHECK_STRUCT_FOR([
 
3922
#ifdef HAVE_SYS_PARAM_H
 
3923
#include <sys/param.h>
 
3924
#endif
 
3925
#include <sys/types.h>
 
3926
#ifdef IFNET_NEEDS_KERNEL
 
3927
#define KERNEL
 
3928
#define _KERNEL
 
3929
#endif
 
3930
#include <sys/socket.h>
 
3931
#undef KERNEL
 
3932
#undef _KERNEL
 
3933
#include <net/route.h>
 
3934
], rtentry, rt_dst, no)
 
3935
 
 
3936
# checking for 4.3 vs 4.4 rtentry.
 
3937
AC_CACHE_CHECK(type of rtentry structure,ac_cv_RTENTRY_TYPE,
 
3938
[
 
3939
 
 
3940
# 4.4 compat
 
3941
AC_TRY_COMPILE([
 
3942
#ifdef HAVE_SYS_PARAM_H
 
3943
#include <sys/param.h>
 
3944
#endif
 
3945
#include <sys/types.h>
 
3946
#ifdef IFNET_NEEDS_KERNEL
 
3947
#define KERNEL
 
3948
#define _KERNEL
 
3949
#endif
 
3950
#include <sys/socket.h>
 
3951
#undef KERNEL
 
3952
#undef _KERNEL
 
3953
#include <net/route.h>
 
3954
],[
 
3955
 
 
3956
#ifndef STRUCT_RTENTRY_HAS_RT_DST
 
3957
#define rt_dst rt_nodes->rn_key
 
3958
#endif
 
3959
 
 
3960
  struct rtentry rt; 
 
3961
  rt.rt_nodes[0].rn_flags = 1;
 
3962
  rt.rt_dst;
 
3963
  ], ac_cv_RTENTRY_TYPE="BSD-4.4")
 
3964
 
 
3965
# 4.3 compat
 
3966
if test "x$ac_cv_RTENTRY_TYPE" = "x"; then
 
3967
AC_TRY_COMPILE([
 
3968
#ifdef HAVE_SYS_PARAM_H
 
3969
#include <sys/param.h>
 
3970
#endif
 
3971
#include <sys/types.h>
 
3972
#ifdef IFNET_NEEDS_KERNEL
 
3973
#define KERNEL
 
3974
#define _KERNEL
 
3975
#endif
 
3976
#include <sys/socket.h>
 
3977
#undef KERNEL
 
3978
#undef _KERNEL
 
3979
#include <net/route.h>
 
3980
],[
 
3981
struct rtentry rt; 
 
3982
rt.rt_hash;
 
3983
], ac_cv_RTENTRY_TYPE="BSD-4.3")
 
3984
fi
 
3985
 
 
3986
# else ack.
 
3987
if test "x$ac_cv_RTENTRY_TYPE" = "x"; then
 
3988
  AC_MSG_RESULT(Unknown)
 
3989
  ac_cv_RTENTRY_TYPE="unknown"
 
3990
fi
 
3991
 
 
3992
])
 
3993
 
 
3994
if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.4"; then
 
3995
  AC_DEFINE(RTENTRY_4_4)
 
3996
fi
 
3997
 
 
3998
# checking for alpha's ortentry vs rtentry
 
3999
if test "x$ac_cv_RTENTRY_TYPE" = "xunknown"; then
 
4000
AC_CACHE_CHECK(for struct rtentry, ac_cv_struct_rtentry,
 
4001
[AC_EGREP_CPP(ortentry, [#define KERNEL
 
4002
#include <net/route.h>
 
4003
],  ac_cv_struct_rtentry=ortentry,  ac_cv_struct_rtentry=rtentry )
 
4004
if test "x$ac_cv_struct_rtentry" = "xrtentry" ; then
 
4005
  ac_cv_struct_rtentry="rtentry"
 
4006
else
 
4007
  ac_cv_struct_rtentry="ortentry"
 
4008
fi
 
4009
])
 
4010
else
 
4011
  RTENTRY_TYPE="rtentry"
 
4012
  ac_cv_struct_rtentry="rtentry"
 
4013
fi
 
4014
 
 
4015
if test "x$ac_cv_struct_rtentry" != "x"; then
 
4016
  AC_DEFINE_UNQUOTED(RTENTRY,struct ${ac_cv_struct_rtentry})
 
4017
else
 
4018
  AC_DEFINE(RTENTRY,struct rtentry)
 
4019
fi
 
4020
 
 
4021
# check for 4.3's rtentry->rt_next
 
4022
if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.3"; then
 
4023
AC_CACHE_CHECK(for struct rtentry has a rt_next node, 
 
4024
        ac_cv_struct_rtentry_rt_next,
 
4025
[
 
4026
AC_TRY_COMPILE([
 
4027
#ifdef HAVE_SYS_PARAM_H
 
4028
#include <sys/param.h>
 
4029
#endif
 
4030
#include <sys/types.h>
 
4031
#ifdef IFNET_NEEDS_KERNEL
 
4032
#define KERNEL
 
4033
#define _KERNEL
 
4034
#endif
 
4035
#include <sys/socket.h>
 
4036
#undef KERNEL
 
4037
#undef _KERNEL
 
4038
#include <net/route.h>
 
4039
],[
 
4040
struct rtentry rt; 
 
4041
rt.rt_next;
 
4042
], ac_cv_struct_rtentry_rt_next=yes,  ac_cv_struct_rtentry_rt_next=no )
 
4043
])
 
4044
 
 
4045
if test "x$ac_cv_struct_rtentry_rt_next" = "xyes"; then
 
4046
  AC_DEFINE(RTENTRY_RT_NEXT)
 
4047
fi
 
4048
 
 
4049
fi
 
4050
 
 
4051
# Check sin6_scope_id member specified in RFC2553 additionally
 
4052
AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,[
 
4053
AC_INCLUDES_DEFAULT()
 
4054
[#ifdef HAVE_SYS_PARAM_H
 
4055
#include <sys/param.h>
 
4056
#endif
 
4057
#ifdef HAVE_SYS_SOCKET_H
 
4058
#include <sys/socket.h>
 
4059
#endif
 
4060
#ifdef HAVE_NETINET_IN_H
 
4061
#include <netinet/in.h>
 
4062
#endif
 
4063
]])
 
4064
 
 
4065
# Check struct rtentry for various things.
 
4066
AC_CHECK_STRUCT_FOR([
 
4067
#ifdef HAVE_SYS_PARAM_H
 
4068
#include <sys/param.h>
 
4069
#endif
 
4070
#include <sys/types.h>
 
4071
#ifdef IFNET_NEEDS_KERNEL
 
4072
#define KERNEL
 
4073
#define _KERNEL
 
4074
#endif
 
4075
#include <sys/socket.h>
 
4076
#undef KERNEL
 
4077
#undef _KERNEL
 
4078
#include <net/route.h>
 
4079
], rtentry, rt_unit)
 
4080
 
 
4081
AC_CHECK_STRUCT_FOR([
 
4082
#ifdef HAVE_SYS_PARAM_H
 
4083
#include <sys/param.h>
 
4084
#endif
 
4085
#include <sys/types.h>
 
4086
#ifdef IFNET_NEEDS_KERNEL
 
4087
#define KERNEL
 
4088
#define _KERNEL
 
4089
#endif
 
4090
#include <sys/socket.h>
 
4091
#undef KERNEL
 
4092
#undef _KERNEL
 
4093
#include <net/route.h>
 
4094
], rtentry, rt_refcnt)
 
4095
 
 
4096
AC_CHECK_STRUCT_FOR([
 
4097
#ifdef HAVE_SYS_PARAM_H
 
4098
#include <sys/param.h>
 
4099
#endif
 
4100
#include <sys/types.h>
 
4101
#ifdef IFNET_NEEDS_KERNEL
 
4102
#define KERNEL
 
4103
#define _KERNEL
 
4104
#endif
 
4105
#include <sys/socket.h>
 
4106
#undef KERNEL
 
4107
#undef _KERNEL
 
4108
#include <net/route.h>
 
4109
], rtentry, rt_hash)
 
4110
 
 
4111
AC_CHECK_STRUCT_FOR([
 
4112
#ifdef HAVE_SYS_PARAM_H
 
4113
#include <sys/param.h>
 
4114
#endif
 
4115
#include <sys/types.h>
 
4116
#ifdef IFNET_NEEDS_KERNEL
 
4117
#define KERNEL
 
4118
#define _KERNEL
 
4119
#endif
 
4120
#include <sys/socket.h>
 
4121
#undef KERNEL
 
4122
#undef _KERNEL
 
4123
#include <net/route.h>
 
4124
], rtentry, rt_use)
 
4125
 
 
4126
# Check tcpstat for tcpstat.tcp_rcvmemdrop
 
4127
AC_CHECK_STRUCT_FOR([
 
4128
#ifdef HAVE_SYS_PARAM_H
 
4129
#include <sys/param.h>
 
4130
#endif
 
4131
#include <sys/types.h>
 
4132
#ifdef HAVE_SYS_TIMEOUT_H
 
4133
#include <sys/timeout.h>
 
4134
#endif
 
4135
#include <netinet/tcp.h>
 
4136
#ifdef HAVE_NETINET_TCP_TIMER_H
 
4137
#include <netinet/tcp_timer.h>
 
4138
#endif
 
4139
 
 
4140
#ifdef HAVE_NETINET_TCP_VAR_H
 
4141
#include <netinet/tcp_var.h>
 
4142
#endif
 
4143
], tcpstat, tcp_rcvmemdrop)
 
4144
 
 
4145
 
 
4146
AC_CHECK_STRUCT_FOR([
 
4147
#ifdef IFNET_NEEDS_KERNEL
 
4148
#define _KERNEL 1
 
4149
#endif
 
4150
#ifdef HAVE_SYS_PARAM_H
 
4151
#include <sys/param.h>
 
4152
#endif
 
4153
#include <sys/types.h>
 
4154
#include <sys/socket.h>
 
4155
#ifdef HAVE_SYS_TIME_H
 
4156
#include <sys/time.h>
 
4157
#endif
 
4158
#include <net/if.h>
 
4159
#ifdef HAVE_NET_IF_VAR_H
 
4160
#include <net/if_var.h>
 
4161
#endif
 
4162
], ifaddr, ifa_next)
 
4163
 
 
4164
# Check ifnet entries using macro defined in aclocal.m4.
 
4165
#
 
4166
# XXX  Broken on FreeBSD where these are #define'd in <net/if.h>
 
4167
#
 
4168
AC_CHECK_IFNET_FOR(if_baudrate)
 
4169
AC_CHECK_IFNET_FOR(if_baudrate.ifs_value)
 
4170
AC_CHECK_IFNET_FOR(if_speed)
 
4171
AC_CHECK_IFNET_FOR(if_type)
 
4172
AC_CHECK_IFNET_FOR(if_imcasts)
 
4173
AC_CHECK_IFNET_FOR(if_iqdrops)
 
4174
AC_CHECK_IFNET_FOR(if_noproto)
 
4175
AC_CHECK_IFNET_FOR(if_omcasts)
 
4176
AC_CHECK_IFNET_FOR(if_xname,no)
 
4177
AC_CHECK_IFNET_FOR(if_lastchange.tv_sec)
 
4178
AC_CHECK_IFNET_FOR(if_obytes)
 
4179
AC_CHECK_IFNET_FOR(if_ibytes)
 
4180
AC_CHECK_IFNET_FOR(if_addrlist)
 
4181
AC_CHECK_IFNET_FOR(if_addrhead.tqh_first)
 
4182
 
 
4183
AC_CHECK_STRUCT_FOR([
 
4184
#include <sys/types.h>
 
4185
#if HAVE_NETINET_IN_H
 
4186
#include <netinet/in.h>
 
4187
#endif
 
4188
#if HAVE_NETINET_IP_VAR_H
 
4189
#include <netinet/ip_var.h>
 
4190
#endif
 
4191
#if HAVE_NETINET_UDP_H
 
4192
#include <netinet/udp.h>
 
4193
#endif
 
4194
#if HAVE_NETINET_UDP_VAR_H
 
4195
#include <netinet/udp_var.h>
 
4196
#endif
 
4197
],udpstat,udps_discard)
 
4198
 
 
4199
AC_CHECK_STRUCT_FOR([
 
4200
#include <sys/types.h>
 
4201
#if HAVE_NETINET_IN_H
 
4202
#include <netinet/in.h>
 
4203
#endif
 
4204
#if HAVE_NETINET_IP_VAR_H
 
4205
#include <netinet/ip_var.h>
 
4206
#endif
 
4207
#if HAVE_NETINET_UDP_H
 
4208
#include <netinet/udp.h>
 
4209
#endif
 
4210
#if HAVE_NETINET_UDP_VAR_H
 
4211
#include <netinet/udp_var.h>
 
4212
#endif
 
4213
],udpstat,udps_noport)
 
4214
 
 
4215
AC_CHECK_STRUCT_FOR([
 
4216
#include <sys/types.h>
 
4217
#if HAVE_NETINET_IN_H
 
4218
#include <netinet/in.h>
 
4219
#endif
 
4220
#if HAVE_NETINET_IP_VAR_H
 
4221
#include <netinet/ip_var.h>
 
4222
#endif
 
4223
#if HAVE_NETINET_UDP_H
 
4224
#include <netinet/udp.h>
 
4225
#endif
 
4226
#if HAVE_NETINET_UDP_VAR_H
 
4227
#include <netinet/udp_var.h>
 
4228
#endif
 
4229
],udpstat,udps_noportbcast)
 
4230
 
 
4231
AC_CHECK_STRUCT_FOR([
 
4232
#include <sys/types.h>
 
4233
#if HAVE_NETINET_IN_H
 
4234
#include <netinet/in.h>
 
4235
#endif
 
4236
#if HAVE_NETINET_IP_VAR_H
 
4237
#include <netinet/ip_var.h>
 
4238
#endif
 
4239
#if HAVE_NETINET_UDP_H
 
4240
#include <netinet/udp.h>
 
4241
#endif
 
4242
#if HAVE_NETINET_UDP_VAR_H
 
4243
#include <netinet/udp_var.h>
 
4244
#endif
 
4245
],udpstat,udps_fullsock)
 
4246
 
 
4247
AC_CHECK_STRUCT_FOR([
 
4248
#ifdef HAVE_SYS_PARAM_H
 
4249
#include <sys/param.h>
 
4250
#endif
 
4251
#include <sys/types.h>
 
4252
#include <sys/socket.h>
 
4253
#ifdef HAVE_SYS_TIME_H
 
4254
#include <sys/time.h>
 
4255
#endif
 
4256
#include <net/if.h>
 
4257
#if HAVE_NETINET_IN_H
 
4258
#include <netinet/in.h>
 
4259
#endif
 
4260
#if HAVE_NETINET_IF_ETHER_H
 
4261
#include <netinet/if_ether.h>
 
4262
#endif
 
4263
],arphd,at_next)
 
4264
 
 
4265
AC_CHECK_STRUCT_FOR([
 
4266
#if HAVE_SYS_TYPES_H
 
4267
#include <sys/types.h>
 
4268
#endif
 
4269
#ifdef HAVE_SYS_PARAM_H
 
4270
#include <sys/param.h>
 
4271
#endif
 
4272
#if HAVE_SYS_CONF_H
 
4273
#include <sys/conf.h>
 
4274
#endif
 
4275
],swdevt,sw_nblksenabled)
 
4276
 
 
4277
AC_CHECK_STRUCT_FOR([
 
4278
#ifdef HAVE_SYS_STAT_H
 
4279
#include <sys/stat.h>
 
4280
#endif
 
4281
#if HAVE_SYS_STATFS_H
 
4282
#include <sys/statfs.h>
 
4283
#endif
 
4284
#if HAVE_SYS_STATVFS_H
 
4285
#include <sys/statvfs.h>
 
4286
#endif
 
4287
],statvfs,mnt_dir)
 
4288
 
 
4289
AC_CHECK_STRUCT_FOR([
 
4290
#ifdef HAVE_SYS_STAT_H
 
4291
#include <sys/stat.h>
 
4292
#endif
 
4293
#if HAVE_SYS_STATFS_H
 
4294
#include <sys/statfs.h>
 
4295
#endif
 
4296
#if HAVE_SYS_STATVFS_H
 
4297
#include <sys/statvfs.h>
 
4298
#endif
 
4299
],statvfs,f_frsize)
 
4300
 
 
4301
AC_CHECK_STRUCT_FOR([
 
4302
#ifdef HAVE_SYS_STAT_H
 
4303
#include <sys/stat.h>
 
4304
#endif
 
4305
#if HAVE_SYS_STATFS_H
 
4306
#include <sys/statfs.h>
 
4307
#endif
 
4308
#if HAVE_SYS_STATVFS_H
 
4309
#include <sys/statvfs.h>
 
4310
#endif
 
4311
],statfs,f_frsize)
 
4312
 
 
4313
AC_CHECK_STRUCT_FOR([
 
4314
#ifdef HAVE_SYS_STAT_H
 
4315
#include <sys/stat.h>
 
4316
#endif
 
4317
#if HAVE_SYS_STATFS_H
 
4318
#include <sys/statfs.h>
 
4319
#endif
 
4320
#if HAVE_SYS_STATVFS_H
 
4321
#include <sys/statvfs.h>
 
4322
#endif
 
4323
],statvfs,f_files)
 
4324
 
 
4325
AC_CHECK_STRUCT_FOR([
 
4326
#ifdef HAVE_SYS_STAT_H
 
4327
#include <sys/stat.h>
 
4328
#endif
 
4329
#if HAVE_SYS_STATFS_H
 
4330
#include <sys/statfs.h>
 
4331
#endif
 
4332
#ifdef HAVE_SYS_PARAM_H
 
4333
#include <sys/param.h>
 
4334
#include <sys/types.h>
 
4335
#endif
 
4336
#ifdef HAVE_SYS_MOUNT_H
 
4337
#include <sys/mount.h>
 
4338
#endif
 
4339
],statfs,f_files)
 
4340
 
 
4341
AC_CHECK_STRUCT_FOR([
 
4342
#ifdef HAVE_SYS_STAT_H
 
4343
#include <sys/stat.h>
 
4344
#endif
 
4345
#if HAVE_SYS_STATFS_H
 
4346
#include <sys/statfs.h>
 
4347
#endif
 
4348
#ifdef HAVE_SYS_PARAM_H
 
4349
#include <sys/param.h>
 
4350
#include <sys/types.h>
 
4351
#endif
 
4352
#ifdef HAVE_SYS_MOUNT_H
 
4353
#include <sys/mount.h>
 
4354
#endif
 
4355
],statfs,f_ffree)
 
4356
 
 
4357
AC_CHECK_STRUCT_FOR([
 
4358
#ifdef HAVE_SYS_STAT_H
 
4359
#include <sys/stat.h>
 
4360
#endif
 
4361
#if HAVE_SYS_STATFS_H
 
4362
#include <sys/statfs.h>
 
4363
#endif
 
4364
#ifdef HAVE_SYS_PARAM_H
 
4365
#include <sys/param.h>
 
4366
#include <sys/types.h>
 
4367
#endif
 
4368
#ifdef HAVE_SYS_MOUNT_H
 
4369
#include <sys/mount.h>
 
4370
#endif
 
4371
],statfs,f_favail)
 
4372
 
 
4373
AC_CHECK_STRUCT_FOR([
 
4374
#if HAVE_NLIST_H
 
4375
#include <nlist.h>
 
4376
#endif
 
4377
],nlist,n_value)
 
4378
 
 
4379
# struct nlist64 (IRIX)
 
4380
AC_CHECK_STRUCT_FOR([
 
4381
#if HAVE_SYS_TYPES_H
 
4382
#include <sys/types.h>
 
4383
#endif
 
4384
#if HAVE_NLIST_H
 
4385
#include <nlist.h>
 
4386
#endif
 
4387
],nlist64, n_value)
 
4388
 
 
4389
# check struct ipstat for various things
 
4390
AC_CHECK_STRUCT_FOR([
 
4391
#include <sys/types.h>
 
4392
#if HAVE_NETINET_IN_H
 
4393
#include <netinet/in.h>
 
4394
#endif
 
4395
#if HAVE_NETINET_IP_VAR_H
 
4396
#include <netinet/ip_var.h>
 
4397
#endif
 
4398
], ipstat, ips_cantforward)
 
4399
 
 
4400
AC_CHECK_STRUCT_FOR([
 
4401
#include <sys/types.h>
 
4402
#if HAVE_NETINET_IN_H
 
4403
#include <netinet/in.h>
 
4404
#endif
 
4405
#if HAVE_NETINET_IP_VAR_H
 
4406
#include <netinet/ip_var.h>
 
4407
#endif
 
4408
], ipstat, ips_cantfrag)
 
4409
 
 
4410
AC_CHECK_STRUCT_FOR([
 
4411
#include <sys/types.h>
 
4412
#if HAVE_NETINET_IN_H
 
4413
#include <netinet/in.h>
 
4414
#endif
 
4415
#if HAVE_NETINET_IP_VAR_H
 
4416
#include <netinet/ip_var.h>
 
4417
#endif
 
4418
], ipstat, ips_delivered)
 
4419
 
 
4420
AC_CHECK_STRUCT_FOR([
 
4421
#include <sys/types.h>
 
4422
#if HAVE_NETINET_IN_H
 
4423
#include <netinet/in.h>
 
4424
#endif
 
4425
#if HAVE_NETINET_IP_VAR_H
 
4426
#include <netinet/ip_var.h>
 
4427
#endif
 
4428
], ipstat, ips_fragdropped)
 
4429
 
 
4430
AC_CHECK_STRUCT_FOR([
 
4431
#include <sys/types.h>
 
4432
#if HAVE_NETINET_IN_H
 
4433
#include <netinet/in.h>
 
4434
#endif
 
4435
#if HAVE_NETINET_IP_VAR_H
 
4436
#include <netinet/ip_var.h>
 
4437
#endif
 
4438
], ipstat, ips_fragtimeout)
 
4439
 
 
4440
AC_CHECK_STRUCT_FOR([
 
4441
#include <sys/types.h>
 
4442
#if HAVE_NETINET_IN_H
 
4443
#include <netinet/in.h>
 
4444
#endif
 
4445
#if HAVE_NETINET_IP_VAR_H
 
4446
#include <netinet/ip_var.h>
 
4447
#endif
 
4448
], ipstat, ips_fragmented)
 
4449
 
 
4450
AC_CHECK_STRUCT_FOR([
 
4451
#include <sys/types.h>
 
4452
#if HAVE_NETINET_IN_H
 
4453
#include <netinet/in.h>
 
4454
#endif
 
4455
#if HAVE_NETINET_IP_VAR_H
 
4456
#include <netinet/ip_var.h>
 
4457
#endif
 
4458
], ipstat, ips_localout)
 
4459
 
 
4460
AC_CHECK_STRUCT_FOR([
 
4461
#include <sys/types.h>
 
4462
#if HAVE_NETINET_IN_H
 
4463
#include <netinet/in.h>
 
4464
#endif
 
4465
#if HAVE_NETINET_IP_VAR_H
 
4466
#include <netinet/ip_var.h>
 
4467
#endif
 
4468
], ipstat, ips_noproto)
 
4469
 
 
4470
AC_CHECK_STRUCT_FOR([
 
4471
#include <sys/types.h>
 
4472
#if HAVE_NETINET_IN_H
 
4473
#include <netinet/in.h>
 
4474
#endif
 
4475
#if HAVE_NETINET_IP_VAR_H
 
4476
#include <netinet/ip_var.h>
 
4477
#endif
 
4478
], ipstat, ips_noroute)
 
4479
 
 
4480
AC_CHECK_STRUCT_FOR([
 
4481
#include <sys/types.h>
 
4482
#if HAVE_NETINET_IN_H
 
4483
#include <netinet/in.h>
 
4484
#endif
 
4485
#if HAVE_NETINET_IP_VAR_H
 
4486
#include <netinet/ip_var.h>
 
4487
#endif
 
4488
], ipstat, ips_odropped)
 
4489
 
 
4490
AC_CHECK_STRUCT_FOR([
 
4491
#include <sys/types.h>
 
4492
#if HAVE_NETINET_IN_H
 
4493
#include <netinet/in.h>
 
4494
#endif
 
4495
#if HAVE_NETINET_IP_VAR_H
 
4496
#include <netinet/ip_var.h>
 
4497
#endif
 
4498
], ipstat, ips_ofragments)
 
4499
 
 
4500
AC_CHECK_STRUCT_FOR([
 
4501
#include <sys/types.h>
 
4502
#if HAVE_NETINET_IN_H
 
4503
#include <netinet/in.h>
 
4504
#endif
 
4505
#if HAVE_NETINET_IP_VAR_H
 
4506
#include <netinet/ip_var.h>
 
4507
#endif
 
4508
], ipstat, ips_reassembled)
 
4509
 
 
4510
# check for the des_ks_struct.weak_key attribute, which indicates the 
 
4511
# older openssl version is being used.
 
4512
if test "x$ac_cv_header_openssl_des_h" = "xyes" ; then
 
4513
AC_CHECK_STRUCT_FOR([
 
4514
#include <openssl/des.h>
 
4515
], des_ks_struct, weak_key)
 
4516
fi
 
4517
 
 
4518
# attempt to figure out if sysctl is usable
 
4519
 
 
4520
if test $cross_compiling = yes; then
 
4521
  AC_MSG_WARN([Can't check sysctl, manually define NETSNMP_CAN_USE_SYSCTL if platform support available])
 
4522
else
 
4523
  AC_CACHE_CHECK(if sysctl can read kernel information,ac_cv_NETSNMP_CAN_USE_SYSCTL,
 
4524
  [AC_TRY_RUN([
 
4525
#if TIME_WITH_SYS_TIME
 
4526
# include <sys/time.h>
 
4527
# include <time.h>
 
4528
#else
 
4529
# if HAVE_SYS_TIME_H
 
4530
#  include <sys/time.h>
 
4531
# else
 
4532
#  include <time.h>
 
4533
# endif
 
4534
#endif
 
4535
#if HAVE_SYS_PARAM_H
 
4536
# include <sys/param.h>
 
4537
#endif
 
4538
#include <sys/types.h>
 
4539
#if HAVE_SYS_SYSCTL_H
 
4540
# include <sys/sysctl.h>
 
4541
#endif
 
4542
 
 
4543
main() {
 
4544
  int                 mib[2];
 
4545
  size_t              len;
 
4546
  struct timeval boottime;
 
4547
  
 
4548
  mib[0] = CTL_KERN;
 
4549
  mib[1] = KERN_BOOTTIME;
 
4550
  
 
4551
  len = sizeof(boottime);
 
4552
  sysctl(mib, 2, &boottime, &len, NULL, NULL);
 
4553
  if (boottime.tv_sec != 0)
 
4554
    exit(0);
 
4555
  else
 
4556
    exit(1);
 
4557
}
 
4558
  ], ac_cv_NETSNMP_CAN_USE_SYSCTL=yes, ac_cv_NETSNMP_CAN_USE_SYSCTL=no, ac_cv_NETSNMP_CAN_USE_SYSCTL=no)])
 
4559
fi
 
4560
 
 
4561
if test "x$ac_cv_NETSNMP_CAN_USE_SYSCTL" = "xyes"; then
 
4562
  AC_DEFINE(NETSNMP_CAN_USE_SYSCTL)
 
4563
fi
 
4564
 
 
4565
#
 
4566
# In FreeBSD 4.x, the TCP timer constants aren't.  They are defined
 
4567
# in terms of 'hz', the kernel clock tick.  In this case,
 
4568
# we need to have a local variable 'hz' in scope and set to a useful
 
4569
# value whenever we use one of these constants.
 
4570
#
 
4571
AC_CACHE_CHECK(whether TCP timers depend on 'hz',ac_cv_TCPTV_NEEDS_HZ,
 
4572
[AC_EGREP_CPP(hz,
 
4573
[#include <netinet/tcp_timer.h>
 
4574
TCPTV_SRTTDFLT
 
4575
], ac_cv_TCPTV_NEEDS_HZ=yes, ac_cv_TCPTV_NEEDS_HZ=no)])
 
4576
 
 
4577
if test "x$ac_cv_TCPTV_NEEDS_HZ" = "xyes"; then
 
4578
  AC_DEFINE(TCPTV_NEEDS_HZ)
 
4579
fi
 
4580
 
 
4581
#
 
4582
# define the agent libraries variables
 
4583
#
 
4584
AC_SUBST(LMIBLIBS)
 
4585
AC_SUBST(AGENTLIBS)
 
4586
AC_SUBST(OTHERAGENTLIBOBJS)
 
4587
AC_SUBST(OTHERAGENTLIBLOBJS)
 
4588
 
 
4589
#
 
4590
# Prompt for various bits of user information
 
4591
#
 
4592
 
 
4593
if test "x$ac_cv_user_prompt_NETSNMP_LOGFILE" = "x" -o "x$ac_cv_user_prompt_NETSNMP_SYS_LOC" = "x" -o "x$ac_cv_user_prompt_NETSNMP_SYS_CONTACT" = "x" -o "x$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" = "x"; then
 
4594
AC_CACHE_CHECK(whether to prompt for values, ac_cv_have_warned,
 
4595
[
 
4596
if test "x$defaults" = "xno"; then
 
4597
cat << EOF
 
4598
 
 
4599
         ************** Configuration Section **************
 
4600
 
 
4601
        You are about to be prompted with a series of questions.  Answer
 
4602
them carefully, as they determine how the SNMP agent and related
 
4603
applications are to function.
 
4604
 
 
4605
        After the configure script finishes, you can browse the newly
 
4606
created net-snmp-config.h file for further - less important - parameters to
 
4607
modify.  Be careful if you re-run configure though, since net-snmp-config.h 
 
4608
will be overwritten.
 
4609
 
 
4610
-Press return to continue-
 
4611
EOF
 
4612
 
 
4613
read tmpinput
 
4614
ac_cv_have_warned="yes"
 
4615
else
 
4616
  ac_cv_have_warned="no"
 
4617
fi
 
4618
])
 
4619
else
 
4620
  ac_cv_have_warned="yes"
 
4621
fi
 
4622
 
 
4623
ME=`$WHOAMI`
 
4624
if test -f /etc/resolv.conf; then
 
4625
  LOC=`cat /etc/resolv.conf | grep '^domain' | tail -1 | awk '{print $NF}'`
 
4626
else
 
4627
  LOC="@no.where"
 
4628
fi
 
4629
 
 
4630
AC_PROMPT_USER(NETSNMP_DEFAULT_SNMP_VERSION,[
 
4631
 
 
4632
*** Default SNMP Version:
 
4633
 
 
4634
        Starting with Net-SNMP 5.0, you can choose the default version of
 
4635
the SNMP protocol to use when no version is given explicitly on the
 
4636
command line, or via an 'snmp.conf' file.  In the past this was set to
 
4637
SNMPv1, but you can use this to switch to SNMPv3 if desired.  SNMPv3
 
4638
will provide a more secure management environment (and thus you're
 
4639
encouraged to switch to SNMPv3), but may break existing scripts that
 
4640
rely on the old behaviour.  (Though such scripts will probably need to
 
4641
be changed to use the '-c' community flag anyway, as the SNMPv1
 
4642
command line usage has changed as well.).
 
4643
   At this prompt you can select \"1\", \"2\" (for SNMPv2c), or \"3\" as
 
4644
the default version for the command tools (snmpget, ...) to use.  This
 
4645
can always be overridden at runtime using the -v flag to the tools, or
 
4646
by using the \"defVersion\" token in your snmp.conf file.
 
4647
   Providing the --with-default-snmp-version=\"x\" parameter to ./configure
 
4648
will avoid this prompt.
 
4649
 
 
4650
Default version of SNMP to use],3,unquoted)
 
4651
 
 
4652
# we tested this above before the prompt, but the prompt may give a new value.
 
4653
if test "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" = "2c"; then
 
4654
  ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION="2"
 
4655
fi
 
4656
if test "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "3"; then
 
4657
  AC_MSG_ERROR([Illegal version number.  Only 1, 2 (for SNMPv2c) and 3 are supported.])
 
4658
fi
 
4659
 
 
4660
AC_PROMPT_USER(NETSNMP_SYS_CONTACT,[
 
4661
 
 
4662
*** System Contact Information:
 
4663
 
 
4664
        Describes who should be contacted about the host the agent is
 
4665
running on.  This information is available in the MIB-II tree.  This
 
4666
can also be over-ridden using the \"syscontact\" syntax in the agent's
 
4667
configuration files.
 
4668
  Providing the --with-sys-contact=\"contact\" parameter to ./configure
 
4669
will avoid this prompt.
 
4670
 
 
4671
System Contact Information],$ME@$LOC,quoted)
 
4672
 
 
4673
AC_PROMPT_USER(NETSNMP_SYS_LOC,[
 
4674
 
 
4675
*** System Location:
 
4676
 
 
4677
        Describes the location of the system.  This information is
 
4678
available in the MIB-II tree.  this can also be over-ridden using the
 
4679
\"syslocation\" syntax in the agent's configuration files.
 
4680
  Providing the --with-sys-location=\"location\" parameter to ./configure
 
4681
will avoid this prompt.
 
4682
 
 
4683
System Location],Unknown,quoted)
 
4684
 
 
4685
if test -d /var/log; then
 
4686
  defaultlog="/var/log/snmpd.log"
 
4687
else
 
4688
  defaultlog="/usr/adm/snmpd.log"
 
4689
fi
 
4690
  
 
4691
AC_PROMPT_USER(NETSNMP_LOGFILE,[
 
4692
 
 
4693
*** Logfile location:
 
4694
 
 
4695
        Enter the default location for the snmpd agent to dump
 
4696
information & errors to.  If not defined (enter the keyword \"none\"
 
4697
at the prompt below) the agent will use stdout and stderr instead.
 
4698
(Note: This value can be over-ridden using command line options.)
 
4699
  Providing the --with-logfile=\"path\" parameter to ./configure
 
4700
will avoid this prompt.
 
4701
 
 
4702
Location to write logfile],$defaultlog,quoted)
 
4703
 
 
4704
if test -d /var; then
 
4705
  defaultstore="/var/net-snmp"
 
4706
  ucddefaultstore="/var/ucd-snmp"
 
4707
else
 
4708
  defaultstore="/etc/net-snmp"
 
4709
  ucddefaultstore="/etc/ucd-snmp"
 
4710
fi
 
4711
  
 
4712
AC_PROMPT_USER(NETSNMP_PERSISTENT_DIRECTORY,[
 
4713
 
 
4714
*** snmpd persistent storage location:
 
4715
 
 
4716
        Enter a directory for the SNMP library to store persistent
 
4717
data in the form of a configuration file.  This default location is
 
4718
different than the old default location (which was for ucd-snmp).  If
 
4719
you stay with the new path, I'll ask you in a second if you wish to
 
4720
copy your files over to the new location (once only).  If you pick
 
4721
some other path than the default, you'll have to copy them yourself.
 
4722
There is nothing wrong with picking the old path ($ucddefaultstore) if
 
4723
you'd rather.
 
4724
  Providing the --with-persistent-directory=\"path\" parameter to
 
4725
./configure will avoid this prompt.
 
4726
 
 
4727
Location to write persistent information],$defaultstore,quoted)
 
4728
 
 
4729
PERSISTENT_DIRECTORY=$ac_cv_user_prompt_NETSNMP_PERSISTENT_DIRECTORY
 
4730
AC_SUBST(PERSISTENT_DIRECTORY)
 
4731
UCDPERSISTENT_DIRECTORY=$ucddefaultstore
 
4732
AC_SUBST(UCDPERSISTENT_DIRECTORY)
 
4733
 
 
4734
if test $PERSISTENT_DIRECTORY = "$defaultstore" -a -d "$ucddefaultstore" -a ! -d "$defaultstore" ; then
 
4735
AC_CACHE_CHECK(If we should copy the old persistent directory, ac_cv_user_prompt_COPY_PERSISTENT_FILES,
 
4736
[
 
4737
AC_PROMPT_USER_NO_DEFINE(ac_cv_user_prompt_COPY_PERSISTENT_FILES,[
 
4738
 
 
4739
*** Copying old ucd-snmp persistent files to net-snmp persistent directory:
 
4740
 
 
4741
        Would you like to copy the older ucd-snmp persistent files
 
4742
into your new net-snmp persistent file path?  This will functionally
 
4743
save all your ucd-snmp data and let it be used within the net-snmp
 
4744
tools.  This will only be done once when you run make install.  If you
 
4745
wish to do this, enter "yes" at the prompt.
 
4746
  Providing the --with-copy-persistent-files=\"no\" (or \"yes\")
 
4747
parameters to ./configure will avoid this prompt.
 
4748
 
 
4749
Copy ucd-snmp data into the net-snmp data directory],"yes")
 
4750
])
 
4751
else
 
4752
ac_cv_user_prompt_COPY_PERSISTENT_FILES="no"
 
4753
fi
 
4754
COPY_PERSISTENT_FILES="$ac_cv_user_prompt_COPY_PERSISTENT_FILES"
 
4755
AC_SUBST(COPY_PERSISTENT_FILES)
 
4756
 
 
4757
AC_SUBST(DLLIBS)
 
4758
 
 
4759
AC_CONFIG_FILES([Makefile:Makefile.top:Makefile.in:Makefile.rules])
 
4760
AC_CONFIG_FILES([snmplib/Makefile:Makefile.top:snmplib/Makefile.in:Makefile.rules:snmplib/Makefile.depend])
 
4761
AC_CONFIG_FILES([apps/Makefile:Makefile.top:apps/Makefile.in:Makefile.rules:apps/Makefile.depend])
 
4762
AC_CONFIG_FILES([apps/snmpnetstat/Makefile:Makefile.top:apps/snmpnetstat/Makefile.in:Makefile.rules:apps/snmpnetstat/Makefile.depend])
 
4763
AC_CONFIG_FILES([agent/Makefile:Makefile.top:agent/Makefile.in:Makefile.rules:agent/Makefile.depend])
 
4764
AC_CONFIG_FILES([agent/helpers/Makefile:Makefile.top:agent/helpers/Makefile.in:Makefile.rules:agent/helpers/Makefile.depend])
 
4765
AC_CONFIG_FILES([agent/mibgroup/Makefile:Makefile.top:agent/mibgroup/Makefile.in:Makefile.rules:agent/mibgroup/Makefile.depend])
 
4766
AC_CONFIG_FILES([local/Makefile:Makefile.top:local/Makefile.in:Makefile.rules])
 
4767
AC_CONFIG_FILES([testing/Makefile:Makefile.top:testing/Makefile.in])
 
4768
AC_CONFIG_FILES([man/Makefile:Makefile.top:man/Makefile.in:Makefile.rules])
 
4769
AC_CONFIG_FILES([mibs/Makefile:Makefile.top:mibs/Makefile.in:Makefile.rules])
 
4770
AC_CONFIG_FILES([net-snmp-config:net-snmp-config.in],
 
4771
                [chmod +x net-snmp-config])
 
4772
 
 
4773
AC_CONFIG_COMMANDS([default], echo timestamp > stamp-h)
 
4774
 
 
4775
#
 
4776
# protect PACKAGE_* variables
 
4777
#
 
4778
AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */
 
4779
#ifndef PACKAGE_BUGREPORT
 
4780
#undef PACKAGE_BUGREPORT
 
4781
#endif])
 
4782
AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */
 
4783
#ifndef PACKAGE_NAME
 
4784
#undef PACKAGE_NAME
 
4785
#endif])
 
4786
AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */
 
4787
#ifndef PACKAGE_STRING
 
4788
#undef PACKAGE_STRING
 
4789
#endif])
 
4790
AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */
 
4791
#ifndef PACKAGE_TARNAME
 
4792
#undef PACKAGE_TARNAME
 
4793
#endif])
 
4794
AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */
 
4795
#ifndef PACKAGE_VERSION
 
4796
#undef PACKAGE_VERSION
 
4797
#endif])
 
4798
 
 
4799
AC_OUTPUT
 
4800
 
 
4801
AC_MSG_CACHE_DISPLAY()
 
4802
# Local Variables:
 
4803
# mode: Autoconf
 
4804
# comment-start: "#"
 
4805
# End: