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

« back to all changes in this revision

Viewing changes to .pc/32_mnttab_path.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
for i in /etc/mnttab /etc/mtab /etc/filesystems /dev/mnttab
 
2613
  do
 
2614
  if test -f $i -o -c $i; then
 
2615
    ac_cv_ETC_MNTTAB="$i"
 
2616
    break;
 
2617
  fi
 
2618
done
 
2619
])
 
2620
 
 
2621
AC_DEFINE_UNQUOTED(ETC_MNTTAB,"$ac_cv_ETC_MNTTAB")
 
2622
 
 
2623
# Check for /dev/dmem or /dev/drum location
 
2624
AC_CACHE_CHECK(for location of swap device,ac_cv_DMEM_LOC,
 
2625
[
 
2626
# First determine if test expects a -f or a -c (character device (SYSV))
 
2627
 
 
2628
if test -f /dev/kmem; then
 
2629
  CTEST="test -f"
 
2630
elif test -c /dev/kmem; then
 
2631
  CTEST="test -c"
 
2632
else
 
2633
  # fall back
 
2634
  CTEST="test -f"
 
2635
fi
 
2636
 
 
2637
if $CTEST /dev/dmem; then
 
2638
  ac_cv_DMEM_LOC="/dev/dmem"
 
2639
elif $CTEST /dev/drum; then
 
2640
  ac_cv_DMEM_LOC="/dev/drum"
 
2641
else
 
2642
  ac_cv_DMEM_LOC="none"
 
2643
fi
 
2644
])
 
2645
 
 
2646
if test "x$ac_cv_DMEM_LOC" != "xnone"; then
 
2647
  AC_DEFINE_UNQUOTED(DMEM_LOC,"$ac_cv_DMEM_LOC")
 
2648
fi
 
2649
 
 
2650
# forced efence turned off.
 
2651
# if test "x$developer" = "xyes" -a "x$use_efence" != "xno"; then
 
2652
#    use_efence="yes"
 
2653
# fi
 
2654
 
 
2655
if test "x$use_efence" = "xyes"; then
 
2656
    AC_CHECK_LIB(efence, EF_Exit)
 
2657
fi
 
2658
 
 
2659
# Checks for libraries.
 
2660
# AC_CHECK_LIB(des, main)
 
2661
# AC_CHECK_LIB(m, asin)
 
2662
 
 
2663
AC_ARG_WITH(elf,
 
2664
        [AS_HELP_STRING(--without-elf,[use elf libraries])],,
 
2665
        [AC_ARG_ENABLE(elf,,
 
2666
                [AC_MSG_ERROR([ Invalid option. Use --with-elf/--without-elf instead ])])])
 
2667
 
 
2668
if test "x$with_elf" != "xno"; then
 
2669
# nlist is needed for uptime on some sytems in the generic library
 
2670
# add hosts which don't use nlist to the blank first line
 
2671
case $target_os in
 
2672
        linux*) ;;
 
2673
        irix*) # Check for nlist in mld (irix)
 
2674
                AC_CHECK_LIB(elf, nlist)
 
2675
                AC_CHECK_LIB(elf, nlist64)
 
2676
                AC_CHECK_LIB(mld, nlist)
 
2677
                ;;
 
2678
        *) # default
 
2679
                AC_CHECK_LIB(elf, nlist)
 
2680
                ;;
 
2681
esac
 
2682
fi
 
2683
 
 
2684
 
 
2685
# On some platforms (Irix) libnsl and libsocket should not be used.
 
2686
AC_CHECK_FUNC(gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME),
 
2687
        AC_CHECK_LIB(nsl, gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME)
 
2688
        LIBS="${LIBS} -lnsl"))
 
2689
 
 
2690
# SCO Unixware 7.1.4 finds gethostbyname() in -lsocket
 
2691
AC_CHECK_FUNC(gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME),
 
2692
        AC_CHECK_LIB(socket, gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME)
 
2693
        LIBS="${LIBS} -lsocket"))
 
2694
 
 
2695
# Solaris kstat
 
2696
AC_CHECK_LIB(kstat, kstat_lookup,
 
2697
        AC_DEFINE(HAVE_LIBKSTAT, 1, [Define to 1 if you have the `kstat' library (-lkstat).])
 
2698
        LNETSNMPLIBS="${LNETSNMPLIBS} -lkstat")
 
2699
 
 
2700
# Check for libraries that the agent needs
 
2701
# saving old libraries
 
2702
NONAGENTLIBS=$LIBS
 
2703
 
 
2704
# Check for security related functions
 
2705
if test "x$tryopenssl" != "xno"; then
 
2706
    if test "x$askedopenssl" != "xyes" -a "x$askedpkcs" = "xyes"; then
 
2707
      AC_CHECK_LIB(pkcs11, C_Initialize, AC_DEFINE(HAVE_LIBPKCS11, 1, [Define to 1 if you have the `pkcs11' library (-lpkcs11).])
 
2708
              LIBPKCS11="-lpkcs11")
 
2709
    else 
 
2710
      if test "x$tryrsaref" != "xno"; then
 
2711
         AC_CHECK_LIB(rsaref, RSAPrivateDecrypt)
 
2712
         AC_CHECK_LIB(RSAglue, RSA_PKCS1_RSAref)
 
2713
      fi
 
2714
 
 
2715
      AC_CHECK_LIB(crypto, EVP_md5, AC_DEFINE(HAVE_LIBCRYPTO, 1, [Define to 1 if you have the `crypto' library (-lcrypto).])
 
2716
              LIBCRYPTO="-lcrypto")
 
2717
      AC_CHECK_LIB(crypto, AES_cfb128_encrypt, 
 
2718
              AC_DEFINE(HAVE_AES_CFB128_ENCRYPT, 1, [Define to 1 if you have the `AES_cfb128_encrypt' function.]))
 
2719
    fi
 
2720
elif test "x$askedpkcs" = "xyes"; then
 
2721
    AC_CHECK_LIB(pkcs11, C_Initialize, AC_DEFINE(HAVE_LIBPKCS11)
 
2722
            LIBPKCS11="-lpkcs11")
 
2723
fi
 
2724
 
 
2725
LIBS=$NONAGENTLIBS
 
2726
 
 
2727
# check for tcp wrapper support
 
2728
_cppflags="${CPPFLAGS}"
 
2729
_ldflags="${LDFLAGS}"
 
2730
 
 
2731
AC_ARG_WITH(libwrap,
 
2732
[  --with-libwrap[=LIBPATH]  Compile in libwrap (tcp_wrappers) support.],[
 
2733
  if test "$with_libwrap" != "no"; then
 
2734
    if test "$with_libwrap" != "yes"; then
 
2735
      CPPFLAGS="${CPPFLAGS} -I$with_libwrap/include"
 
2736
      LDFLAGS="${LDFLAGS} -L$with_libwrap/lib"
 
2737
    fi
 
2738
 
 
2739
    _libs=${LIBS}
 
2740
    AC_CHECK_HEADER(tcpd.h, ,
 
2741
            AC_MSG_ERROR([Asked to use libwrap but I couldn't find tcpd.h.]))
 
2742
 
 
2743
    LIBS="$LIBS -lwrap"
 
2744
        AC_MSG_CHECKING([for TCP wrappers library -lwrap])
 
2745
        # XXX: should check for hosts_ctl
 
2746
        AC_TRY_LINK([#include <sys/types.h>
 
2747
                     #include <tcpd.h>
 
2748
                     int allow_severity = 0;
 
2749
                     int deny_severity  = 0;
 
2750
                    ],[hosts_access((void *)0)],[
 
2751
 
 
2752
            AC_MSG_RESULT([yes])
 
2753
            AC_DEFINE(NETSNMP_USE_LIBWRAP)
 
2754
            test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap/lib"
 
2755
            _wraplibs="$_wraplibs -lwrap"],
 
2756
        [
 
2757
            AC_MSG_RESULT([no])
 
2758
            # Linux RedHat 6.1 won't link libwrap without libnsl
 
2759
            AC_CHECK_FUNC(yp_get_default_domain, ,
 
2760
                AC_CHECK_LIB(nsl, yp_get_default_domain))
 
2761
            AC_MSG_CHECKING([for TCP wrappers library -lwrap linked with -lnsl])
 
2762
            AC_TRY_LINK([#include <sys/types.h>
 
2763
                         #include <tcpd.h>
 
2764
                         int allow_severity = 0;
 
2765
                         int deny_severity  = 0;
 
2766
                        ],[hosts_access((void *)0)],
 
2767
 
 
2768
                        AC_MSG_RESULT(yes)
 
2769
                        AC_DEFINE(NETSNMP_USE_LIBWRAP)
 
2770
                        test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap/lib"
 
2771
                        _wraplibs="$_wraplibs -lwrap -lnsl",
 
2772
 
 
2773
                        AC_MSG_RESULT(no)
 
2774
                        AC_MSG_ERROR(Asked to use libwrap but I couldn't find it.))])
 
2775
    LAGENTLIBS="$_wraplibs"
 
2776
    CPPFLAGS=${_cppflags}
 
2777
    LDFLAGS=${_ldflags}
 
2778
    LIBS=${_libs}
 
2779
  fi
 
2780
])
 
2781
 
 
2782
AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h)
 
2783
 
 
2784
AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no)
 
2785
AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no)
 
2786
 
 
2787
if test "x$rpmheader_h" = "xno" -o "x$rpmlib_h" = "xno" ; then
 
2788
  if test "x$with_rpm" = "xyes" ; then
 
2789
    AC_MSG_ERROR([Could not find either the RPM header files needed and was specifically asked to use RPM support])
 
2790
  else
 
2791
    with_rpm=no
 
2792
  fi
 
2793
fi
 
2794
 
 
2795
#
 
2796
# rpm libraries only needed for the host resources mib software
 
2797
# installed tables (on linux in particular)
 
2798
#
 
2799
if test "x$with_rpm" != "xno" && \
 
2800
        echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
 
2801
  # ARG.  RPM is a real pain.
 
2802
  # FWIW librpm.la, librpmio.la, and libpopt.la have correct dependencies.
 
2803
  _rpmlibs=""
 
2804
 
 
2805
  # zlib is required for newer versions of rpm
 
2806
  _cppflags="${CPPFLAGS}"
 
2807
  _ldflags="${LDFLAGS}"
 
2808
 
 
2809
  AC_ARG_WITH(zlib,
 
2810
  [  --with-zlib[=DIR]         use libz in DIR],[
 
2811
    if test -d "$withval"; then
 
2812
      CPPFLAGS="${CPPFLAGS} -I$withval/include"
 
2813
      LDFLAGS="${LDFLAGS} -L$withval/lib"
 
2814
    fi
 
2815
  ])
 
2816
 
 
2817
  # dunno if this is needed for rpm-4.0.x, earlier probably needs.
 
2818
  AC_CHECK_HEADER(zlib.h,
 
2819
      AC_CHECK_LIB(z, gzread, , CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
 
2820
      CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
 
2821
 
 
2822
  # two variants of bzip2 need checking.
 
2823
  AC_ARG_WITH(bzip2,
 
2824
  [  --with-bzip2[=DIR]        use libbz2 in DIR],[
 
2825
    if test -d "$withval"; then
 
2826
      CPPFLAGS="${CPPFLAGS} -I$withval/include"
 
2827
      LDFLAGS="${LDFLAGS} -L$withval/lib"
 
2828
    fi
 
2829
    if test "x$with_bzip2" != "xno"; then
 
2830
  AC_CHECK_LIB(bz2, bzread, [_rpmlibs="$_rpmlibs -lbz2"],
 
2831
     AC_CHECK_LIB(bz2, BZ2_bzread, [_rpmlibs="$_rpmlibs -lbz2"],))
 
2832
    fi
 
2833
  ])
 
2834
 
 
2835
 
 
2836
  # two variants of db1 need checking.
 
2837
  AC_CHECK_LIB(db1, dbopen, [_rpmlibs="-ldb1 $_rpmlibs"],
 
2838
     AC_CHECK_LIB(db, dbopen, [_rpmlibs="-ldb $_rpmlibs"]))
 
2839
 
 
2840
  # two variants of db3 need checking.
 
2841
  AC_CHECK_LIB(db-3.1, db_create, [_rpmlibs="-ldb-3.1 $_rpmlibs"],
 
2842
    AC_CHECK_LIB(db-3.0, db_create, [_rpmlibs="-ldb-3.0 $_rpmlibs"]))
 
2843
  
 
2844
  # rpm-3.0.5 and later needs popt.
 
2845
  AC_CHECK_LIB(popt, poptParseArgvString, [_rpmlibs="-lpopt $_rpmlibs"])
 
2846
  
 
2847
  # rpm-4.0.x needs rpmio.
 
2848
  AC_CHECK_LIB(rpmio, Fopen, [_rpmlibs="-lrpmio $_rpmlibs"],,$_rpmlibs)
 
2849
  
 
2850
  # now check for rpm using the appropriate libraries.
 
2851
  AC_CHECK_LIB(rpm, rpmGetFilesystemList,[
 
2852
    AC_DEFINE(HAVE_LIBRPM)
 
2853
    LMIBLIBS="-lrpm $_rpmlibs $LMIBLIBS"
 
2854
    CFLAGS="$CFLAGS -I/usr/include/rpm"
 
2855
  ],[
 
2856
    # rpm-4.0.3 librpmdb actually contains what we need.
 
2857
    AC_CHECK_LIB(rpmdb, rpmdbOpen,[
 
2858
      AC_DEFINE(HAVE_LIBRPM)
 
2859
      LMIBLIBS="-lrpmdb -lrpm $_rpmlibs $LMIBLIBS"
 
2860
      CFLAGS="$CFLAGS -I/usr/include/rpm"
 
2861
    ],,-lrpm $_rpmlibs)
 
2862
  ])
 
2863
 
 
2864
  # rpm 4.6 has incompatible API, turn on the legacy one
 
2865
  AC_CHECK_DECL([headerGetEntry],
 
2866
    : ,
 
2867
    AC_DEFINE([_RPM_4_4_COMPAT], [], [Define if you have RPM 4.6 or newer to turn on legacy API]),
 
2868
    [[#include <rpm/rpmlib.h>]]
 
2869
  )
 
2870
fi
 
2871
 
 
2872
# libkvm
 
2873
AC_CHECK_LIB(kvm, kvm_read, [_libkvm="-lkvm"])
 
2874
AC_CHECK_FUNC(kvm_openfiles, AC_DEFINE(HAVE_KVM_OPENFILES, 1, [Define to 1 if you have the `kvm_openfiles' function.]),
 
2875
        AC_CHECK_LIB(kvm, kvm_openfiles, AC_DEFINE(HAVE_KVM_OPENFILES, 1, [Define to 1 if you have the `kvm_openfiles' function.])
 
2876
        _libkvm="-lkvm"))
 
2877
AC_CHECK_FUNC(kvm_getprocs, AC_DEFINE(HAVE_KVM_GETPROCS, 1, [Define to 1 if you have the `kvm_getprocs' function.]),
 
2878
        AC_CHECK_LIB(kvm, kvm_getprocs, AC_DEFINE(HAVE_KVM_GETPROCS, 1, [Define to 1 if you have the `kvm_getprocs' function.])
 
2879
        _libkvm="-lkvm"))
 
2880
AC_CHECK_FUNC(kvm_getswapinfo, AC_DEFINE(HAVE_KVM_GETSWAPINFO, 1, [Define to 1 if you have the `kvm_getswapinfo' function.]),
 
2881
        AC_CHECK_LIB(kvm, kvm_getswapinfo, AC_DEFINE(HAVE_KVM_GETSWAPINFO, 1, [Define to 1 if you have the `kvm_getswapinfo' function.])
 
2882
        _libkvm="-lkvm"))
 
2883
if test "x${_libkvm}" != "x"; then
 
2884
        AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the `kvm' library (-lkvm).])
 
2885
        LAGENTLIBS="$LAGENTLIBS ${_libkvm}"
 
2886
fi
 
2887
 
 
2888
# DYNAMIC MODULE SUPPORT
 
2889
AC_CHECK_FUNC(dlopen, AC_DEFINE(HAVE_DLOPEN, 1, [Define to 1 if you have the `dlopen' function.]),
 
2890
        AC_CHECK_LIB(dl, dlopen, AC_DEFINE(HAVE_DLOPEN, 1, [Define to 1 if you have the `dlopen' function.])
 
2891
        AC_DEFINE(HAVE_LIBDL, 1, [Define to 1 if you have the `dl' library (-ldl).])
 
2892
        LMIBLIBS="${LMIBLIBS} -ldl"))
 
2893
 
 
2894
# nlist
 
2895
AC_CHECK_FUNCS(nlist nlist64 knlist)
 
2896
 
 
2897
# whether we need -ldevstat for diskio MIB
 
2898
echo " $module_list " | grep " ucd-snmp/diskio " >/dev/null
 
2899
if test $? -eq 0 ; then
 
2900
        AC_CHECK_FUNC(getdevs, AC_DEFINE(HAVE_GETDEVS),
 
2901
                AC_CHECK_LIB(devstat, getdevs, AC_DEFINE(HAVE_GETDEVS)
 
2902
                LMIBLIBS="${LMIBLIBS} -ldevstat"))
 
2903
        AC_CHECK_FUNC(getdevs, AC_DEFINE(HAVE_DEVSTAT_GETDEVS),
 
2904
                AC_CHECK_LIB(devstat, devstat_getdevs, AC_DEFINE(HAVE_DEVSTAT_GETDEVS)
 
2905
                LMIBLIBS="${LMIBLIBS} -ldevstat"))
 
2906
fi
 
2907
 
 
2908
# LM-SENSORS-MIB support
 
2909
echo " $module_list " | grep " ucd-snmp/lmSensors " > /dev/null
 
2910
if test $? -eq 0 ; then
 
2911
        AC_MSG_CHECKING([for sensors support])
 
2912
        case $target_os in
 
2913
          solaris*)
 
2914
            AC_CHECK_HEADER(picl.h, LMIBLIBS="${LMIBLIBS} -lpicl",)
 
2915
            AC_CHECK_HEADERS(picl.h)
 
2916
            ;;
 
2917
        *)
 
2918
            AC_CHECK_HEADER(sensors/sensors.h,,
 
2919
                [AC_MSG_ERROR([asked to use lm_sensors but I couldn't find sensors/sensors.h])])
 
2920
            AC_CHECK_LIB(sensors, sensors_get_detected_chips, [
 
2921
                   LMIBLIBS="${LMIBLIBS} -lsensors" ;
 
2922
                ],
 
2923
                [AC_MSG_ERROR([asked to use lm_sensors but I couldn't find -lsensors])])
 
2924
            ;;
 
2925
        esac
 
2926
fi
 
2927
 
 
2928
######################################################################
 
2929
# PERL SUPPORT
 
2930
######################################################################
 
2931
 
 
2932
#
 
2933
# test to see if we can attempt to build embedded Perl so far
 
2934
#
 
2935
if test "x$embed_perl" = "xtry" ; then
 
2936
  if test "x$install_perl" = "xno" ; then
 
2937
    install_perl="try"
 
2938
  fi
 
2939
  if test "x$ac_cv_path_PERLPROG" = "x" -o "x$ac_cv_path_PERLPROG" = "xno" ; then
 
2940
    install_perl="no"
 
2941
    embed_perl="no"
 
2942
  fi
 
2943
fi
 
2944
 
 
2945
 
 
2946
#
 
2947
# Embedded Perl specific stuff
 
2948
#
 
2949
 
 
2950
# test perl prog
 
2951
if test "x$install_perl" != "xno" ; then
 
2952
    myperl=$ac_cv_path_PERLPROG
 
2953
    if test $myperl = "no" ; then
 
2954
      if test "x$install_perl" = "xtry" ; then
 
2955
        install_perl="no"
 
2956
      else
 
2957
        AC_MSG_ERROR(--enable-embedded-perl requested but no perl executable found)
 
2958
      fi
 
2959
    fi
 
2960
fi
 
2961
 
 
2962
# test for shared libraries support
 
2963
if test "x$install_perl" != "xno" ; then
 
2964
    # embedded Perl requires shared libraries
 
2965
    if test "x$enable_shared" != "xyes"; then
 
2966
      if test "x$install_perl" = "xtry" ; then
 
2967
        install_perl="no"
 
2968
      else
 
2969
        AC_MSG_ERROR(Perl support requires --enable-shared)
 
2970
      fi
 
2971
    fi
 
2972
fi
 
2973
 
 
2974
if test "x$install_perl" != "xno" ; then
 
2975
  AC_MSG_CHECKING([if we are in the source tree so we can install Perl modules])
 
2976
  if test "x$srcdir" = "x." -o -d perl/agent/default_store ; then
 
2977
    AC_MSG_RESULT([Yes])
 
2978
  else
 
2979
    if test "x$install_perl" = "xtry" ; then
 
2980
      install_perl="no"
 
2981
      AC_MSG_RESULT([No])
 
2982
    else
 
2983
      AC_MSG_ERROR([Perl modules can not be built outside the source directory])
 
2984
    fi
 
2985
  fi
 
2986
fi      
 
2987
 
 
2988
# check the Perl compiler name
 
2989
if test "x$install_perl" != "xno" ; then
 
2990
    #
 
2991
    # Perl cc checks
 
2992
    #
 
2993
    if test "xenable_perl_cc_checks" != "xno" ; then
 
2994
      AC_MSG_CHECKING([for Perl cc])
 
2995
      changequote(, )
 
2996
      PERLCC=`$myperl -V:cc | $myperl -n -e 'print if (s/^\s*cc=.([-=\w\s\/]+).;\s*/$1/);'`
 
2997
      changequote([, ])
 
2998
      if test "x$PERLCC" != "x" ; then
 
2999
        AC_MSG_RESULT([$PERLCC])
 
3000
      else
 
3001
        if test "x$install_perl" = "xtry" ; then
 
3002
          install_perl="no"
 
3003
        else
 
3004
          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.])
 
3005
        fi
 
3006
      fi
 
3007
fi
 
3008
 
 
3009
# check the Perl compiler compatibility
 
3010
if test "x$install_perl" != "xno" ; then
 
3011
      AC_MSG_CHECKING([whether $PERLCC is a GNU C compiler])
 
3012
      OLDCC=$CC
 
3013
      CC="$PERLCC"
 
3014
      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
 
3015
#ifndef __GNUC__
 
3016
  choke me
 
3017
#endif
 
3018
      ]])], [perlcc_is_gnu=yes], [perlcc_is_gnu=no])
 
3019
      AC_MSG_RESULT([$perlcc_is_gnu])
 
3020
      CC=$OLDCC
 
3021
      if test "x$GCC" = "xyes" -a "x$perlcc_is_gnu" = "xno" ; then
 
3022
        if test "x$install_perl" = "xtry" ; then
 
3023
          install_perl="no"
 
3024
        else
 
3025
          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).])
 
3026
        fi
 
3027
      fi
 
3028
fi
 
3029
 
 
3030
# check if they're both gnu
 
3031
if test "x$install_perl" != "xno" ; then
 
3032
      if test "x$GCC" != "xyes" -a "x$perlcc_is_gnu" = "xyes" ; then
 
3033
        if test "x$install_perl" = "xtry" ; then
 
3034
          install_perl="no"
 
3035
        else
 
3036
          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).])
 
3037
        fi
 
3038
      fi
 
3039
fi
 
3040
 
 
3041
# we have enough support for installing the modules at least.
 
3042
if test "x$install_perl" = "xtry" ; then
 
3043
  install_perl="yes"
 
3044
else
 
3045
  if test "x$install_perl" = "xno" ; then
 
3046
    install_perl="no"
 
3047
    embed_perl="no"
 
3048
  fi
 
3049
fi
 
3050
 
 
3051
####################
 
3052
# on to embedding...
 
3053
 
 
3054
# check the compiler flags for illegal tokens
 
3055
case $target_os in
 
3056
    solaris*)
 
3057
      if test "x$embed_perl" != "xno" ; then
 
3058
          #
 
3059
          # Perl cc checks
 
3060
          #
 
3061
          AC_MSG_CHECKING([for problematic Perl cc flags on Suns])
 
3062
          if $myperl -V:ccflags | grep LARGEFILE > /dev/null ; then
 
3063
            if test "x$embed_perl" = "xtry" ; then
 
3064
              embed_perl="no"
 
3065
            else
 
3066
              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.])
 
3067
            fi
 
3068
          else
 
3069
            AC_MSG_RESULT([none known])
 
3070
          fi
 
3071
      fi
 
3072
    ;;
 
3073
 
 
3074
    *)
 
3075
    ;;
 
3076
esac
 
3077
 
 
3078
 
 
3079
# check the cflags
 
3080
if test "x$embed_perl" != "xno" ; then
 
3081
    AC_MSG_CHECKING([for Perl CFLAGS])
 
3082
    perlcflags=`$myperl -MExtUtils::Embed -e ccopts`
 
3083
    if test "x$perlcflags" != "x" ; then
 
3084
      AC_MSG_RESULT([$perlcflags])
 
3085
      CFLAGS="$CFLAGS $perlcflags"
 
3086
    else
 
3087
      if test "x$embed_perl" = "xtry" ; then
 
3088
        embed_perl="no"
 
3089
      else
 
3090
        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.])
 
3091
      fi
 
3092
    fi
 
3093
fi
 
3094
 
 
3095
# check the ldflags
 
3096
if test "x$embed_perl" != "xno" ; then
 
3097
    AC_MSG_CHECKING([for Perl LDFLAGS])
 
3098
    netsnmp_perlldopts=`$myperl -MExtUtils::Embed -e ldopts`
 
3099
    if test "x$netsnmp_perlldopts" != "x" ; then
 
3100
      AC_MSG_RESULT([$netsnmp_perlldopts])
 
3101
    else
 
3102
      if test "x$embed_perl" = "xtry" ; then
 
3103
        embed_perl="no"
 
3104
      else
 
3105
        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.])
 
3106
      fi
 
3107
    fi
 
3108
    if test "x$enable_as_needed" = "xyes" ; then
 
3109
      # link *libraries* with libperl
 
3110
      PERLLDOPTS_FOR_LIBS="$netsnmp_perlldopts"
 
3111
      # Perl ccdlflags (RPATH to libperl, hopefully)
 
3112
      AC_MSG_CHECKING([for Perl CCDLFLAGS])
 
3113
      changequote(, )
 
3114
      netsnmp_perlccdlflags=`$myperl -V:ccdlflags | $myperl -n -e 'print $1 '"if (/^\s*ccdlflags='([^']+)';/);"`
 
3115
      changequote([, ])
 
3116
      AC_MSG_RESULT([$netsnmp_perlccdlflags])
 
3117
      PERLLDOPTS_FOR_APPS="$netsnmp_perlccdlflags"
 
3118
    else
 
3119
      # link *applications* against libperl
 
3120
      PERLLDOPTS_FOR_APPS="$netsnmp_perlldopts"
 
3121
    fi
 
3122
fi
 
3123
 
 
3124
# check needed functions
 
3125
if test "x$embed_perl" != "xno" ; then
 
3126
    OLDLIBS="$LIBS"
 
3127
    LIBS="$LIBS $netsnmp_perlldopts"
 
3128
 
 
3129
    # newer perl vs older perl call functions
 
3130
    AC_CHECK_FUNCS(eval_pv)
 
3131
 
 
3132
    # sigh: this has a CAPITAL P in Perl, which ends up being the same
 
3133
    # autoconf define as the lower case so we have to treat them *BOTH*
 
3134
    # specially.  Wonderful.
 
3135
    AC_CHECK_FUNC(perl_eval_pv, AC_DEFINE(HAVE_PERL_EVAL_PV_LC))
 
3136
    AC_CHECK_FUNC(Perl_eval_pv, AC_DEFINE(HAVE_PERL_EVAL_PV_UC))
 
3137
 
 
3138
    LIBS="$OLDLIBS"
 
3139
 
 
3140
 
 
3141
    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
 
3142
      if test "x$embed_perl" = "xtry" ; then
 
3143
        embed_perl="no"
 
3144
      else
 
3145
        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.])
 
3146
      fi
 
3147
    else
 
3148
      AC_DEFINE(NETSNMP_EMBEDDED_PERL)
 
3149
      OTHERAGENTLIBOBJS="snmp_perl.o"
 
3150
      OTHERAGENTLIBLOBJS="snmp_perl.lo"
 
3151
 
 
3152
      EMBEDPERLINSTALL="embedperlinstall"
 
3153
      EMBEDPERLUNINSTALL="embedperluninstall"
 
3154
      # yay, we got here!
 
3155
      embed_perl="yes"
 
3156
    fi
 
3157
else
 
3158
      EMBEDPERLINSTALL=""
 
3159
      EMBEDPERLUNINSTALL=""
 
3160
      embed_perl="no"
 
3161
    fi
 
3162
fi
 
3163
AC_SUBST(EMBEDPERLINSTALL)
 
3164
AC_SUBST(EMBEDPERLUNINSTALL)
 
3165
AC_SUBST(PERLLDOPTS_FOR_LIBS)
 
3166
AC_SUBST(PERLLDOPTS_FOR_APPS)
 
3167
 
 
3168
# embedded Perl results
 
3169
AC_MSG_CHECKING([for potential embedded Perl support])
 
3170
if test "x$embed_perl" != "xyes" ; then
 
3171
  AC_MSG_CACHE_ADD(Embedded Perl support:      disabled)
 
3172
  AC_MSG_RESULT([disabled])
 
3173
else
 
3174
  AC_MSG_CACHE_ADD(Embedded Perl support:      enabled)
 
3175
  AC_MSG_RESULT([enabled])
 
3176
fi
 
3177
 
 
3178
# install Perl module results
 
3179
PERLTARGS=""
 
3180
PERLINSTALLTARGS=""
 
3181
PERLUNINSTALLTARGS=""
 
3182
AC_MSG_CHECKING([if we can install the Perl modules])
 
3183
if test "x$install_perl" = "xyes" ; then
 
3184
    PERLTARGS="perlmodules"
 
3185
    PERLINSTALLTARGS="perlinstall"
 
3186
    PERLUNINSTALLTARGS="perluninstall"
 
3187
    if test "x$embed_perl" = "xyes" ; then
 
3188
      AC_MSG_CACHE_ADD(SNMP Perl modules:          building -- embeddable)
 
3189
      AC_MSG_RESULT([yes -- and embeddable])
 
3190
    else
 
3191
      AC_MSG_CACHE_ADD(SNMP Perl modules:          building -- not embeddable)
 
3192
      AC_MSG_RESULT([yes -- not embeddable])
 
3193
    fi
 
3194
else
 
3195
    AC_MSG_RESULT([no])
 
3196
    AC_MSG_CACHE_ADD(SNMP Perl modules:          disabled)
 
3197
fi
 
3198
AC_SUBST(PERLTARGS)
 
3199
AC_SUBST(PERLINSTALLTARGS)
 
3200
AC_SUBST(PERLUNINSTALLTARGS)
 
3201
AC_SUBST(PERLARGS)
 
3202
 
 
3203
 
 
3204
 
 
3205
# reset libs
 
3206
AGENTLIBS=$LIBS
 
3207
LIBS=$NONAGENTLIBS
 
3208
 
 
3209
 
 
3210
 
 
3211
# python support
 
3212
PYTHONTARGS=""
 
3213
PYTHONINSTALLTARGS=""
 
3214
PYTHONUNINSTALLTARGS=""
 
3215
PYTHONCLEANTARGS=""
 
3216
AC_MSG_CHECKING([if we should install the python bindings])
 
3217
if test "x$install_python" = "xyes" ; then
 
3218
    PYTHONTARGS="pythonmodules"
 
3219
    PYTHONINSTALLTARGS="pythoninstall"
 
3220
    PYTHONUNINSTALLTARGS="pythonuninstall"
 
3221
    PYTHONCLEANTARGS="pythonclean"
 
3222
    AC_MSG_CACHE_ADD(SNMP Python modules:        building for $PYTHONPROG)
 
3223
    AC_MSG_RESULT([yes])
 
3224
else
 
3225
    AC_MSG_CACHE_ADD(SNMP Python modules:        disabled)
 
3226
    AC_MSG_RESULT([no])
 
3227
fi
 
3228
AC_SUBST(PYTHONTARGS)
 
3229
AC_SUBST(PYTHONINSTALLTARGS)
 
3230
AC_SUBST(PYTHONUNINSTALLTARGS)
 
3231
AC_SUBST(PYTHONCLEANTARGS)
 
3232
AC_SUBST(PYTHONARGS)
 
3233
 
 
3234
 
 
3235
 
 
3236
# Checks for header files.
 
3237
AC_HEADER_STDC
 
3238
AC_HEADER_DIRENT
 
3239
AC_HEADER_SYS_WAIT
 
3240
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)
 
3241
# at least Solaris 9 needs sys/socket.h to compile sys/socketvar.h
 
3242
AC_CHECK_HEADERS(sys/socketvar.h,,,
 
3243
AC_INCLUDES_DEFAULT([])
 
3244
[
 
3245
#if HAVE_SYS_SOCKET_H
 
3246
#include <sys/socket.h>
 
3247
#endif
 
3248
])
 
3249
# at least OpenBSD 3.4 needs sys/param.h (MAXPATHLEN) to compile sys/swap.h
 
3250
AC_CHECK_HEADERS(sys/swap.h,,,
 
3251
AC_INCLUDES_DEFAULT([])
 
3252
[
 
3253
#if HAVE_SYS_PARAM_H
 
3254
#include <sys/param.h>
 
3255
#endif
 
3256
])
 
3257
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)
 
3258
# Network headers
 
3259
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,,,
 
3260
[[
 
3261
#if HAVE_SYS_TYPES_H
 
3262
#include <sys/types.h>
 
3263
#endif
 
3264
#if HAVE_SYS_TIMEOUT_H
 
3265
#include <sys/timeout.h>
 
3266
#endif
 
3267
#if HAVE_SYS_SOCKET_H
 
3268
#include <sys/socket.h>
 
3269
#endif
 
3270
#if HAVE_SYS_SOCKETVAR_H
 
3271
#include <sys/socketvar.h>
 
3272
#endif
 
3273
#if HAVE_ARPA_INET_H
 
3274
#include <arpa/inet.h>
 
3275
#endif
 
3276
#if HAVE_NETINET_IN_SYSTM_H
 
3277
#include <netinet/in_systm.h>
 
3278
#endif
 
3279
#if HAVE_NETINET_IN_H
 
3280
#include <netinet/in.h>
 
3281
#endif
 
3282
#if HAVE_NETINET_IP_H
 
3283
#include <netinet/ip.h>
 
3284
#endif
 
3285
#if HAVE_NET_IF_H
 
3286
#include <net/if.h>
 
3287
#endif
 
3288
#if HAVE_NETINET_IP_VAR_H
 
3289
#include <netinet/ip_var.h>
 
3290
#endif
 
3291
#if HAVE_NETINET_IP_ICMP_H
 
3292
#include <netinet/ip_icmp.h>
 
3293
#endif
 
3294
#if HAVE_NETINET_TCP_H
 
3295
#include <netinet/tcp.h>
 
3296
#endif
 
3297
#if HAVE_NETINET_UDP_H
 
3298
#include <netinet/udp.h>
 
3299
#endif
 
3300
#if HAVE_NETINET_TCP_TIMER_H
 
3301
#include <netinet/tcp_timer.h>
 
3302
#endif
 
3303
]])
 
3304
# UFS headers
 
3305
AC_CHECK_HEADERS(ufs/ufs/dinode.h ufs/ufs/quota.h ufs/ufs/inode.h ufs/ffs/fs.h,,,
 
3306
[[
 
3307
#if HAVE_SYS_TYPES_H
 
3308
#include <sys/types.h>
 
3309
#endif
 
3310
#if HAVE_UFS_UFS_DINODE_H
 
3311
#include <ufs/ufs/dinode.h>
 
3312
#endif
 
3313
#if HAVE_UFS_UFS_QUOTA_H
 
3314
#include <ufs/ufs/quota.h>
 
3315
#endif
 
3316
]])
 
3317
# FreeBSD required headers
 
3318
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,,,
 
3319
[[
 
3320
#if HAVE_SYS_TYPES_H
 
3321
#include <sys/types.h>
 
3322
#endif
 
3323
#if HAVE_SYS_PARAM_H
 
3324
#include <sys/param.h>
 
3325
#endif
 
3326
]])
 
3327
# Linux
 
3328
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)
 
3329
# Solaris
 
3330
AC_CHECK_HEADERS(inet/mib2.h)
 
3331
# NetBSD required headers
 
3332
AC_CHECK_HEADERS(kvm.h sys/pool.h uvm/uvm_param.h uvm/uvm_extern.h vm/vm_param.h vm/vm_extern.h)
 
3333
# BSDi2 headers
 
3334
AC_CHECK_HEADERS(vm/swap_pager.h,,,
 
3335
[[
 
3336
#if HAVE_VM_VM_H
 
3337
#include <vm/vm.h>
 
3338
#endif
 
3339
]])
 
3340
# linux ethtool
 
3341
# requires special hacks to get around various problems on older linux kernels.
 
3342
# major ugh....
 
3343
AC_CHECK_HEADERS([linux/ethtool.h],,,
 
3344
[[
 
3345
#include <linux/types.h>
 
3346
typedef __u64 u64;         /* hack, so we may include kernel's ethtool.h */
 
3347
typedef __u32 u32;         /* ditto */
 
3348
typedef __u16 u16;         /* ditto */
 
3349
typedef __u8 u8;           /* ditto */
 
3350
]])
 
3351
# BSDi3 headers
 
3352
AC_CHECK_HEADERS(sys/stat.h)
 
3353
# BSDi3/IRIX headers
 
3354
# at least IRIX 6.5 needs _KMEMUSER and sys/types.h (mprot_t) to compile 
 
3355
#   sys/vnode.h
 
3356
AC_CHECK_HEADERS(sys/vnode.h,,,
 
3357
[
 
3358
#define _KMEMUSER 1
 
3359
#if HAVE_SYS_TYPES_H
 
3360
#include <sys/types.h>
 
3361
#endif
 
3362
])
 
3363
# at least IRIX 6.5 needs sys/sema.h (mrlock_t) to compile sys/hashing.h
 
3364
AC_CHECK_HEADERS(sys/sema.h)
 
3365
AC_CHECK_HEADERS(sys/hashing.h,,,
 
3366
AC_INCLUDES_DEFAULT([])
 
3367
[
 
3368
#if HAVE_SYS_SEMA_H
 
3369
#include <sys/sema.h>
 
3370
#endif
 
3371
])
 
3372
# more IRIX headers
 
3373
AC_CHECK_HEADERS(sys/tcpipstats.h sys/sysmp.h sys/systeminfo.h sys/sysget.h)
 
3374
# AIX system configuration
 
3375
AC_CHECK_HEADERS(sys/systemcfg.h)
 
3376
# from smux stuff
 
3377
AC_CHECK_HEADERS(err.h sys/filio.h sgtty.h)
 
3378
# AIX needs this for statfs func
 
3379
AC_CHECK_HEADERS(sys/statfs.h)
 
3380
# for HostRes (HP-UX at least)
 
3381
AC_CHECK_HEADERS(sys/dkio.h sys/diskio.h sys/pstat.h linux/hdreg.h pkglocs.h)
 
3382
# for HostRes (Solaris 2.x at least)
 
3383
AC_CHECK_HEADERS(pkginfo.h,
 
3384
    AC_CHECK_LIB(adm, pkginfo, AC_DEFINE(HAVE_PKGINFO)
 
3385
    LMIBLIBS="${LMIBLIBS} -ladm"))
 
3386
 
 
3387
case $target_os in
 
3388
    aix*) # AIX perfstat library, needed for CPU/memory statistics
 
3389
        AC_CHECK_HEADERS(libperfstat.h,
 
3390
            AC_CHECK_LIB(perfstat, perfstat_cpu_total, AC_DEFINE(HAVE_PERFSTAT)
 
3391
            LMIBLIBS="${LMIBLIBS} -lperfstat"), AC_MSG_ERROR([
 
3392
 
 
3393
*** To monitor CPU/memory values in AIX you need to install
 
3394
*** libperfstat which can be found in bos.perf
 
3395
]))
 
3396
        ;;
 
3397
    hpux*) # HP-UX agent needs open_mib
 
3398
        AC_CHECK_LIB(nm, open_mib, AC_DEFINE(HAVE_LIBNM)
 
3399
            LMIBLIBS="${LMIBLIBS} -lnm")
 
3400
        ;;
 
3401
    *)
 
3402
        ;;
 
3403
esac
 
3404
# WIN32
 
3405
# (mingw32 must link winsock explicitly)
 
3406
AC_CHECK_HEADERS(winsock.h,[
 
3407
        AGENTLIBS="${AGENTLIBS} -liphlpapi"
 
3408
        case $target_os in
 
3409
                mingw*)
 
3410
                        LIBS="${LIBS} -lregex -lws2_32"
 
3411
                        AGENTLIBS="${AGENTLIBS} -lregex -lws2_32"
 
3412
                        ;;
 
3413
                *)
 
3414
                        ;;
 
3415
        esac
 
3416
])
 
3417
AC_CHECK_HEADERS(io.h)
 
3418
# SCO
 
3419
AC_CHECK_HEADERS(sys/stream.h)
 
3420
# KAME
 
3421
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,,,
 
3422
[[
 
3423
#if HAVE_SYS_TYPES_H
 
3424
#include <sys/types.h>
 
3425
#endif
 
3426
#if HAVE_SYS_QUEUE_H
 
3427
#include <sys/queue.h>
 
3428
#endif
 
3429
#if HAVE_NETINET_IN_H
 
3430
#include <netinet/in.h>
 
3431
#endif
 
3432
#if HAVE_NETINET_IP6_H
 
3433
#include <netinet/ip6.h>
 
3434
#endif
 
3435
]])
 
3436
# DYNAMIC MODULE SUPPORT
 
3437
AC_CHECK_HEADERS(dlfcn.h)
 
3438
# table_array helper support
 
3439
AC_CHECK_HEADERS(search.h)
 
3440
 
 
3441
# RPM subdirectory path (sigh)
 
3442
if test "x$with_rpm" != "xno" && \
 
3443
        echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
 
3444
  AC_CHECK_HEADERS(rpm/rpmdb.h)
 
3445
fi
 
3446
 
 
3447
# OpenBSD 2.6 needs netinet/in.h before netinet/in_pcb.h
 
3448
AC_MSG_CHECKING([[for netinet/in_pcb.h]])
 
3449
AC_CACHE_VAL(cv_have_netinet_in_pcb_h,
 
3450
[ AC_TRY_CPP( [
 
3451
#include <netinet/in.h>
 
3452
#include <netinet/in_pcb.h>
 
3453
], cv_have_netinet_in_pcb_h=yes, cv_have_netinet_in_pcb_h=no)])
 
3454
AC_MSG_RESULT($cv_have_netinet_in_pcb_h)
 
3455
if test $cv_have_netinet_in_pcb_h = yes; then
 
3456
  AC_DEFINE(HAVE_NETINET_IN_PCB_H)
 
3457
fi
 
3458
 
 
3459
# NetBSD needs machine/types.h before sys/disklabel.h
 
3460
AC_MSG_CHECKING([[for sys/disklabel.h]])
 
3461
AC_CACHE_VAL(cv_have_sys_disklabel_h,
 
3462
[ AC_TRY_CPP( [
 
3463
#include <machine/types.h>
 
3464
#include <sys/disklabel.h>
 
3465
], cv_have_sys_disklabel_h=yes, cv_have_sys_disklabel_h=no)])
 
3466
AC_MSG_RESULT($cv_have_sys_disklabel_h)
 
3467
if test $cv_have_sys_disklabel_h = yes; then
 
3468
  AC_DEFINE(HAVE_SYS_DISKLABEL_H)
 
3469
fi
 
3470
 
 
3471
# OpenSSL
 
3472
AC_CHECK_HEADERS(openssl/hmac.h openssl/evp.h openssl/aes.h openssl/des.h openssl/dh.h)
 
3473
AC_CHECK_HEADERS(security/cryptoki.h)
 
3474
 
 
3475
# Printing
 
3476
AC_PATH_PROG([LPSTAT_PATH],lpstat)
 
3477
if test x$LPSTAT_PATH != x; then
 
3478
    AC_DEFINE_UNQUOTED(LPSTAT_PATH,"$LPSTAT_PATH")
 
3479
    AC_DEFINE(HAVE_LPSTAT)
 
3480
fi
 
3481
AC_CHECK_FUNCS(cgetnext)
 
3482
if test -r /etc/printcap; then
 
3483
    AC_DEFINE(HAVE_PRINTCAP)
 
3484
fi
 
3485
 
 
3486
AC_MSG_CHECKING([for authentication support])
 
3487
useopenssl=no
 
3488
usepkcs=no
 
3489
if test "x$ac_cv_lib_pkcs11_C_Initialize" != "xyes" -o "x$ac_cv_header_security_cryptoki_h" != "xyes"; then
 
3490
    if test "x$askedpkcs" = "xyes"; then
 
3491
       AC_MSG_ERROR(Asked to use PKCS11 but I couldn't find it.)
 
3492
    fi
 
3493
else
 
3494
    if test "x$askedpkcs" = "xyes"; then
 
3495
        usepkcs=yes
 
3496
    fi
 
3497
fi
 
3498
 
 
3499
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
 
3500
    if test "x$askedopenssl" = "xyes"; then
 
3501
        AC_MSG_ERROR(Asked to use OpenSSL but I couldn't find it.)
 
3502
    fi
 
3503
else
 
3504
    if test "x$askedopenssl" = "xyes"; then
 
3505
        useopenssl=yes
 
3506
    elif test "x$tryopenssl" = "xyes"; then
 
3507
        if test "x$usepkcs" != "xyes"; then
 
3508
            useopenssl=yes
 
3509
        fi
 
3510
    fi
 
3511
fi
 
3512
 
 
3513
if test "x$useopenssl" != "xno" ; then
 
3514
    authmodes="MD5 SHA1"
 
3515
    if test "x$enable_privacy" != "xno" ; then
 
3516
        if test "x$ac_cv_header_openssl_aes_h" = "xyes" ; then
 
3517
            encrmodes="DES AES"
 
3518
        else
 
3519
            encrmodes="DES"
 
3520
        fi
 
3521
    else
 
3522
        encrmodes="[disabled]"
 
3523
    fi
 
3524
    AC_DEFINE(NETSNMP_USE_OPENSSL)
 
3525
    LNETSNMPLIBS="$LNETSNMPLIBS $LIBCRYPTO"
 
3526
    AC_MSG_RESULT(OpenSSL Support)
 
3527
elif test "x$usepkcs" != "xno" ; then
 
3528
    authmodes="MD5 SHA1"
 
3529
    if test "x$enable_privacy" != "xno" ; then
 
3530
        encrmodes="DES"
 
3531
    else
 
3532
        encrmodes="[disabled]"
 
3533
    fi
 
3534
    AC_DEFINE(NETSNMP_USE_PKCS11)
 
3535
    LNETSNMPLIBS="$LNETSNMPLIBS $LIBPKCS11"
 
3536
    AC_MSG_RESULT(PKCS11 Support)
 
3537
elif test "x$enable_md5" != "xno"; then
 
3538
    authmodes="MD5"
 
3539
    encrmodes=""
 
3540
    AC_DEFINE(NETSNMP_USE_INTERNAL_MD5)
 
3541
    AC_MSG_RESULT(Internal MD5 Support)
 
3542
fi
 
3543
if test "x$enable_md5" = "xno"; then
 
3544
    authmodes=`echo $authmodes | sed 's/MD5 *//;'`
 
3545
fi
 
3546
AC_SUBST(LNETSNMPLIBS)
 
3547
AC_SUBST(LAGENTLIBS)
 
3548
 
 
3549
AC_MSG_CACHE_ADD(Authentication support:     $authmodes)
 
3550
AC_MSG_CACHE_ADD(Encryption support:         $encrmodes)
 
3551
 
 
3552
if test "x$all_warnings" != "x"; then
 
3553
    AC_MSG_CACHE_ADD(WARNING: $all_warnings)
 
3554
fi
 
3555
 
 
3556
# Checks for typedefs, structures, and compiler characteristics.
 
3557
AC_TYPE_OFF_T
 
3558
AC_TYPE_PID_T
 
3559
AC_HEADER_TIME
 
3560
 
 
3561
# this should use AC_CHECK_TYPE, but it's broken at least in 2.13-14
 
3562
# so we do it by hand.
 
3563
AC_MSG_CHECKING([for socklen_t])
 
3564
AC_CACHE_VAL(ac_cv_type_$1,
 
3565
[AC_EGREP_CPP([socklen_t@<:@^a-zA-Z_0-9@:>@],
 
3566
[#include <sys/types.h>
 
3567
#if STDC_HEADERS
 
3568
#include <stdlib.h>
 
3569
#include <stddef.h>
 
3570
#endif
 
3571
#ifdef HAVE_SYS_SOCKET_H
 
3572
#include <sys/socket.h>
 
3573
#endif], [ac_cv_type_socklen_t=yes], [ac_cv_type_socklen_t=no])])
 
3574
 
 
3575
AC_MSG_RESULT([$ac_cv_type_socklen_t])
 
3576
if test $ac_cv_type_socklen_t = yes; then
 
3577
  AC_DEFINE(HAVE_SOCKLEN_T)
 
3578
fi
 
3579
 
 
3580
# AIX keeps in_addr_t in /usr/include/netinet/in.h
 
3581
AC_MSG_CHECKING([for in_addr_t])
 
3582
AC_CACHE_VAL(ac_cv_type_$1,
 
3583
[AC_EGREP_CPP([in_addr_t@<:@^a-zA-Z_0-9@:>@],
 
3584
[#include <sys/types.h>
 
3585
#if STDC_HEADERS
 
3586
#include <stdlib.h>
 
3587
#include <stddef.h>
 
3588
#endif
 
3589
#ifdef HAVE_NETINET_IN_H
 
3590
#include <netinet/in.h>
 
3591
#endif], [ac_cv_type_in_addr_t=yes], [ac_cv_type_in_addr_t=no])])
 
3592
 
 
3593
AC_MSG_RESULT([$ac_cv_type_in_addr_t])
 
3594
if test $ac_cv_type_in_addr_t = yes; then
 
3595
  AC_DEFINE(HAVE_IN_ADDR_T)
 
3596
fi
 
3597
 
 
3598
# Older versions of MinGW do not define ssize_t in sys/types
 
3599
AC_MSG_CHECKING([for ssize_t])
 
3600
AC_CACHE_VAL(ac_cv_type_$1,
 
3601
[AC_EGREP_CPP([ssize_t@<:@^a-zA-Z_0-9@:>@],
 
3602
[#include <sys/types.h>
 
3603
#if STDC_HEADERS
 
3604
#include <stdlib.h>
 
3605
#include <stddef.h>
 
3606
#endif], [ac_cv_type_ssize_t=yes], [ac_cv_type_ssize_t=no])])
 
3607
 
 
3608
AC_MSG_RESULT([$ac_cv_type_ssize_t])
 
3609
if test $ac_cv_type_ssize_t = yes; then
 
3610
  AC_DEFINE(HAVE_SSIZE_T, 1, [Define if type ssize_t is available])
 
3611
fi
 
3612
 
 
3613
# Check ps args
 
3614
AC_CACHE_CHECK([for correct flags to ps], ac_cv_ps_flags,
 
3615
[if test "`($PSPROG -e 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
 
3616
  ac_cv_ps_flags="-e"
 
3617
elif test "`($PSPROG -el 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
 
3618
  ac_cv_ps_flags="-el"
 
3619
elif test "`($PSPROG acx 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
 
3620
  ac_cv_ps_flags="acx"
 
3621
elif test "`($PSPROG -acx 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
 
3622
  ac_cv_ps_flags="-acx"
 
3623
elif test "`($PSPROG -o pid,tt,state,time,ucomm 2>&1) | $EGREP ' ps *$' | awk '{print $NF}'`" = "ps" ; then
 
3624
  ac_cv_ps_flags="-o pid,tt,state,time,ucomm"
 
3625
elif test "`($PSPROG ax 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
 
3626
  ac_cv_ps_flags="ax"
 
3627
elif test "x$PARTIALTARGETOS" = "xcygwin"; then
 
3628
  ac_cv_ps_flags="-e"
 
3629
elif test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc"; then 
 
3630
  ac_cv_ps_flags="-e"
 
3631
else
 
3632
  AC_MSG_WARN([Unable to determine valid ps flags...  defaulting...])
 
3633
  ac_cv_ps_flags="-acx"
 
3634
fi
 
3635
])
 
3636
 
 
3637
PSCMD="$PSPROG $ac_cv_ps_flags"
 
3638
AC_SUBST(PSCMD)
 
3639
AC_DEFINE_UNQUOTED(PSCMD, "$PSPROG $ac_cv_ps_flags")
 
3640
 
 
3641
# Checks for byte order
 
3642
if test $cross_compiling = yes; then
 
3643
  if test x$with_endianness = xbig; then
 
3644
    AC_DEFINE(WORDS_BIGENDIAN)
 
3645
  elif test -z $with_endianness; then
 
3646
    AC_MSG_ERROR([You are cross-compiling, but you have not specified the target's endianness])
 
3647
  fi
 
3648
else
 
3649
  if test $with_endianness; then
 
3650
    AC_MSG_ERROR([Endianness has been specified, but you are not cross-compiling.])
 
3651
  fi
 
3652
  AC_C_BIGENDIAN
 
3653
fi
 
3654
 
 
3655
# Checks for library functions.
 
3656
AC_FUNC_ALLOCA
 
3657
AC_PROG_GCC_TRADITIONAL
 
3658
AC_FUNC_MEMCMP
 
3659
AC_TYPE_SIGNAL
 
3660
AC_FUNC_GETMNTENT
 
3661
AC_CHECK_FUNCS(setmntent hasmntopt gethostname uname gettimeofday select socket strtol strtoul strlcpy)
 
3662
AC_CHECK_FUNCS(strchr strtok_r strdup memcpy memmove index bcopy strcasestr regcomp)
 
3663
AC_CHECK_FUNCS(signal setsid sigset sigblock sighold strerror setenv vsnprintf snprintf)
 
3664
AC_CHECK_FUNCS(sigaction)
 
3665
AC_CHECK_FUNCS(random lrand48 rand)
 
3666
AC_CHECK_FUNCS(execv system fork getpid strncasecmp sigalrm)
 
3667
AC_CHECK_FUNCS(lseek64 pread64)
 
3668
if test "x$with_rpm" != "xno" && \
 
3669
        echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
 
3670
  OLDLIBS=$LIBS
 
3671
  LIBS=$LMIBLIBS
 
3672
  AC_CHECK_FUNCS(rpmGetPath)
 
3673
  LIBS=$OLDLIBS
 
3674
fi
 
3675
 
 
3676
AC_CHECK_FUNCS(getloadavg)
 
3677
AC_CHECK_FUNCS(getaddrinfo getipnodebyname gai_strerror)
 
3678
# BSDi2 functions differ
 
3679
AC_CHECK_FUNCS(statvfs statfs)
 
3680
AC_CHECK_FUNCS(getdtablesize)
 
3681
# freebsd2 checks
 
3682
AC_CHECK_FUNCS(getfsstat)
 
3683
AC_CHECK_FUNCS(usleep)
 
3684
AC_CHECK_FUNCS(setlocale)
 
3685
AC_CHECK_FUNCS(tcgetattr)
 
3686
AC_CHECK_FUNCS(if_nameindex if_freenameindex)
 
3687
# solaris checks
 
3688
AC_CHECK_FUNCS(getpagesize)
 
3689
AC_CHECK_FUNCS(mkstemp)
 
3690
AC_CHECK_FUNCS(getpwnam getgrnam setgid setuid setgroups)
 
3691
# High resolution alarm support
 
3692
AC_CHECK_FUNCS(setitimer)
 
3693
# functions to support the clock.
 
3694
AC_CHECK_FUNCS(mktime stime times sysconf)
 
3695
# missing from hp-ux
 
3696
AC_CHECK_FUNCS(if_nametoindex)
 
3697
# missing from MinGW
 
3698
AC_CHECK_FUNCS(chown localtime_r)
 
3699
 
 
3700
AC_MSG_CHECKING([[for SIOCGIFADDR in sys/ioctl.h]])
 
3701
AC_CACHE_VAL(cv_sys_ioctl_h_has_SIOCGIFADDR,
 
3702
[ AC_EGREP_CPP(xxxyesxxx,
 
3703
[
 
3704
#ifdef HAVE_SYS_IOCTL_H
 
3705
#include <sys/ioctl.h>
 
3706
#endif
 
3707
#ifdef SIOCGIFADDR
 
3708
xxxyesxxx
 
3709
#endif
 
3710
], cv_sys_ioctl_h_has_SIOCGIFADDR=yes, cv_sys_ioctl_h_has_SIOCGIFADDR=no)])
 
3711
AC_MSG_RESULT($cv_sys_ioctl_h_has_SIOCGIFADDR)
 
3712
if test $cv_sys_ioctl_h_has_SIOCGIFADDR = yes; then
 
3713
  AC_DEFINE(SYS_IOCTL_H_HAS_SIOCGIFADDR)
 
3714
fi
 
3715
 
 
3716
# ultrix
 
3717
AC_MSG_CHECKING([[for two-argument statfs with struct fs_data (Ultrix)]])
 
3718
AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
 
3719
[AC_TRY_RUN([
 
3720
#ifdef HAVE_SYS_PARAM_H
 
3721
#include <sys/param.h>
 
3722
#endif
 
3723
#include <sys/types.h>
 
3724
#ifdef HAVE_SYS_MOUNT_H
 
3725
#include <sys/mount.h>
 
3726
#endif
 
3727
#ifdef HAVE_SYS_FS_TYPES_H
 
3728
#include <sys/fs_types.h>
 
3729
#endif
 
3730
main ()
 
3731
{
 
3732
struct fs_data fsd;
 
3733
/* Ultrix's statfs returns 1 for success,
 
3734
   0 for not mounted, -1 for failure.  */
 
3735
exit (statfs (".", &fsd) != 1);
 
3736
}],
 
3737
fu_cv_sys_stat_fs_data=yes,
 
3738
fu_cv_sys_stat_fs_data=no,
 
3739
fu_cv_sys_stat_fs_data=no)])
 
3740
AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
 
3741
if test $fu_cv_sys_stat_fs_data = yes; then
 
3742
  AC_DEFINE(STAT_STATFS_FS_DATA)
 
3743
fi
 
3744
 
 
3745
# check if compiler pre-processor defines __FUNCTION__
 
3746
AC_CACHE_CHECK(if __FUNCTION__ is defined,ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED,
 
3747
[
 
3748
AC_TRY_COMPILE(,[
 
3749
    char *cp = __FUNCTION__;
 
3750
], ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=yes, ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=no)])
 
3751
 
 
3752
if test "x$ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED" = "xyes"; then
 
3753
  AC_DEFINE(HAVE_CPP_UNDERBAR_FUNCTION_DEFINED)
 
3754
fi
 
3755
 
 
3756
#--------------------------------------------------------------
 
3757
# on SCO Unixware 7.1.4 (SCO compiler), "static inline" functions
 
3758
# are not supported, so this disables the whole inline thing if it
 
3759
# doesn't work properly. Should have no effect on other platforms.
 
3760
AC_CACHE_CHECK([[whether static inline functions are broken (Unixware)]],
 
3761
    [netsnmp_cv_c_broken_inline],
 
3762
AC_COMPILE_IFELSE([[
 
3763
static inline int nested_inline_function(void) {
 
3764
  return 0;
 
3765
}
 
3766
inline int main_inline_function( void ) {
 
3767
  return nested_inline_function();
 
3768
}
 
3769
]], netsnmp_cv_broken_inline=no, netsnmp_cv_broken_inline=yes))
 
3770
 
 
3771
# But, sadly, the usage of inline in NET_SNMP disagrees seriously with at least
 
3772
# solaris2, so disable it for now.
 
3773
case "$target_os" in
 
3774
    solaris*)
 
3775
        netsnmp_cv_broken_inline=yes
 
3776
        ;;
 
3777
    *)
 
3778
        ;;
 
3779
esac
 
3780
 
 
3781
if test "$netsnmp_cv_broken_inline" = yes ; then
 
3782
  AC_DEFINE(NETSNMP_BROKEN_INLINE, 1,
 
3783
        [Define if static inline functions are unsupported])
 
3784
fi
 
3785
 
 
3786
# openbsd seems to have dropped m_clusters and m_clfree from mbstat
 
3787
AC_CHECK_STRUCT_FOR([
 
3788
#if HAVE_SYS_MBUF_H
 
3789
#include <sys/mbuf.h>
 
3790
#endif
 
3791
], mbstat, m_clusters, no)
 
3792
 
 
3793
# openbsd seems to have dropped m_mbufs from mbstat too
 
3794
AC_CHECK_STRUCT_FOR([
 
3795
#if HAVE_SYS_MBUF_H
 
3796
#include <sys/mbuf.h>
 
3797
#endif
 
3798
], mbstat, m_mbufs, no)
 
3799
 
 
3800
 
 
3801
AC_CHECK_STRUCT_FOR([
 
3802
#ifdef HAVE_SYS_PARAM_H
 
3803
#include <sys/param.h>
 
3804
#endif
 
3805
#include <sys/types.h>
 
3806
#include <sys/signal.h>
 
3807
], sigaction, sa_sigaction, no)
 
3808
 
 
3809
AC_CHECK_STRUCT_FOR([
 
3810
#include <sys/types.h>
 
3811
#if TIME_WITH_SYS_TIME
 
3812
# include <sys/time.h>
 
3813
# include <time.h>
 
3814
#else
 
3815
# if HAVE_SYS_TIME_H
 
3816
#  include <sys/time.h>
 
3817
# else
 
3818
#  include <time.h>
 
3819
# endif
 
3820
#endif
 
3821
], tm, tm_gmtoff, no)
 
3822
 
 
3823
AC_CHECK_STRUCT_FOR([
 
3824
#ifdef HAVE_SYS_PARAM_H
 
3825
#include <sys/param.h>
 
3826
#endif
 
3827
#include <sys/types.h>
 
3828
#include <sys/socket.h>
 
3829
#include <net/if.h>
 
3830
#ifdef HAVE_NET_IF_VAR_H
 
3831
#include <net/if_var.h>
 
3832
#endif
 
3833
], ifnet, if_mtu)
 
3834
 
 
3835
if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xno"; then
 
3836
AC_CACHE_CHECK(if _KERNEL needs to be defined for if_mtu, ac_cv_IFNET_NEEDS_KERNEL,
 
3837
[
 
3838
if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xyes"; then
 
3839
  ac_cv_IFNET_NEEDS_KERNEL=no
 
3840
else
 
3841
AC_TRY_COMPILE([
 
3842
#define _KERNEL 1
 
3843
#ifdef HAVE_SYS_PARAM_H
 
3844
#include <sys/param.h>
 
3845
#endif
 
3846
#include <sys/types.h>
 
3847
#include <sys/socket.h>
 
3848
#ifdef HAVE_SYS_TIME_H
 
3849
#include <sys/time.h>
 
3850
#endif
 
3851
#include <net/if.h>
 
3852
#ifdef HAVE_NET_IF_VAR_H
 
3853
#include <net/if_var.h>
 
3854
#endif
 
3855
],[
 
3856
struct ifnet testit;
 
3857
testit.if_mtu = 0;
 
3858
], ac_cv_IFNET_NEEDS_KERNEL=yes, ac_cv_IFNET_NEEDS_KERNEL=no)
 
3859
fi
 
3860
])
 
3861
 
 
3862
if test "x$ac_cv_IFNET_NEEDS_KERNEL" = "xyes"; then
 
3863
  AC_DEFINE(IFNET_NEEDS_KERNEL)
 
3864
fi
 
3865
fi
 
3866
 
 
3867
AC_CHECK_STRUCT_FOR([
 
3868
#ifdef HAVE_SYS_PARAM_H
 
3869
#include <sys/param.h>
 
3870
#endif
 
3871
#include <sys/types.h>
 
3872
#ifdef IFNET_NEEDS_KERNEL
 
3873
#define KERNEL
 
3874
#define _KERNEL
 
3875
#endif
 
3876
#include <sys/socket.h>
 
3877
], sockaddr, sa_len, no)
 
3878
 
 
3879
AC_CHECK_STRUCT_FOR([
 
3880
#ifdef HAVE_SYS_PARAM_H
 
3881
#include <sys/param.h>
 
3882
#endif
 
3883
#include <sys/types.h>
 
3884
#ifdef IFNET_NEEDS_KERNEL
 
3885
#define KERNEL
 
3886
#define _KERNEL
 
3887
#endif
 
3888
#include <sys/socket.h>
 
3889
], sockaddr, sa_union.sa_generic.sa_family2, no)
 
3890
 
 
3891
AC_CHECK_STRUCT_FOR([
 
3892
#if HAVE_SYS_PARAM_H
 
3893
#include <sys/param.h>
 
3894
#endif
 
3895
#if HAVE_SYS_TYPES_H
 
3896
#include <sys/types.h>
 
3897
#endif
 
3898
#if HAVE_SYS_SOCKET_H
 
3899
#include <sys/socket.h>
 
3900
#endif
 
3901
], sockaddr_storage, ss_family, no)
 
3902
 
 
3903
AC_CHECK_STRUCT_FOR([
 
3904
#if HAVE_SYS_PARAM_H
 
3905
#include <sys/param.h>
 
3906
#endif
 
3907
#if HAVE_SYS_TYPES_H
 
3908
#include <sys/types.h>
 
3909
#endif
 
3910
#if HAVE_SYS_SOCKET_H
 
3911
#include <sys/socket.h>
 
3912
#endif
 
3913
], sockaddr_storage, __ss_family, no)
 
3914
 
 
3915
AC_CHECK_STRUCT_FOR([
 
3916
#ifdef HAVE_SYS_PARAM_H
 
3917
#include <sys/param.h>
 
3918
#endif
 
3919
#include <sys/types.h>
 
3920
#ifdef IFNET_NEEDS_KERNEL
 
3921
#define KERNEL
 
3922
#define _KERNEL
 
3923
#endif
 
3924
#include <sys/socket.h>
 
3925
#undef KERNEL
 
3926
#undef _KERNEL
 
3927
#include <net/route.h>
 
3928
], rtentry, rt_dst, no)
 
3929
 
 
3930
# checking for 4.3 vs 4.4 rtentry.
 
3931
AC_CACHE_CHECK(type of rtentry structure,ac_cv_RTENTRY_TYPE,
 
3932
[
 
3933
 
 
3934
# 4.4 compat
 
3935
AC_TRY_COMPILE([
 
3936
#ifdef HAVE_SYS_PARAM_H
 
3937
#include <sys/param.h>
 
3938
#endif
 
3939
#include <sys/types.h>
 
3940
#ifdef IFNET_NEEDS_KERNEL
 
3941
#define KERNEL
 
3942
#define _KERNEL
 
3943
#endif
 
3944
#include <sys/socket.h>
 
3945
#undef KERNEL
 
3946
#undef _KERNEL
 
3947
#include <net/route.h>
 
3948
],[
 
3949
 
 
3950
#ifndef STRUCT_RTENTRY_HAS_RT_DST
 
3951
#define rt_dst rt_nodes->rn_key
 
3952
#endif
 
3953
 
 
3954
  struct rtentry rt; 
 
3955
  rt.rt_nodes[0].rn_flags = 1;
 
3956
  rt.rt_dst;
 
3957
  ], ac_cv_RTENTRY_TYPE="BSD-4.4")
 
3958
 
 
3959
# 4.3 compat
 
3960
if test "x$ac_cv_RTENTRY_TYPE" = "x"; then
 
3961
AC_TRY_COMPILE([
 
3962
#ifdef HAVE_SYS_PARAM_H
 
3963
#include <sys/param.h>
 
3964
#endif
 
3965
#include <sys/types.h>
 
3966
#ifdef IFNET_NEEDS_KERNEL
 
3967
#define KERNEL
 
3968
#define _KERNEL
 
3969
#endif
 
3970
#include <sys/socket.h>
 
3971
#undef KERNEL
 
3972
#undef _KERNEL
 
3973
#include <net/route.h>
 
3974
],[
 
3975
struct rtentry rt; 
 
3976
rt.rt_hash;
 
3977
], ac_cv_RTENTRY_TYPE="BSD-4.3")
 
3978
fi
 
3979
 
 
3980
# else ack.
 
3981
if test "x$ac_cv_RTENTRY_TYPE" = "x"; then
 
3982
  AC_MSG_RESULT(Unknown)
 
3983
  ac_cv_RTENTRY_TYPE="unknown"
 
3984
fi
 
3985
 
 
3986
])
 
3987
 
 
3988
if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.4"; then
 
3989
  AC_DEFINE(RTENTRY_4_4)
 
3990
fi
 
3991
 
 
3992
# checking for alpha's ortentry vs rtentry
 
3993
if test "x$ac_cv_RTENTRY_TYPE" = "xunknown"; then
 
3994
AC_CACHE_CHECK(for struct rtentry, ac_cv_struct_rtentry,
 
3995
[AC_EGREP_CPP(ortentry, [#define KERNEL
 
3996
#include <net/route.h>
 
3997
],  ac_cv_struct_rtentry=ortentry,  ac_cv_struct_rtentry=rtentry )
 
3998
if test "x$ac_cv_struct_rtentry" = "xrtentry" ; then
 
3999
  ac_cv_struct_rtentry="rtentry"
 
4000
else
 
4001
  ac_cv_struct_rtentry="ortentry"
 
4002
fi
 
4003
])
 
4004
else
 
4005
  RTENTRY_TYPE="rtentry"
 
4006
  ac_cv_struct_rtentry="rtentry"
 
4007
fi
 
4008
 
 
4009
if test "x$ac_cv_struct_rtentry" != "x"; then
 
4010
  AC_DEFINE_UNQUOTED(RTENTRY,struct ${ac_cv_struct_rtentry})
 
4011
else
 
4012
  AC_DEFINE(RTENTRY,struct rtentry)
 
4013
fi
 
4014
 
 
4015
# check for 4.3's rtentry->rt_next
 
4016
if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.3"; then
 
4017
AC_CACHE_CHECK(for struct rtentry has a rt_next node, 
 
4018
        ac_cv_struct_rtentry_rt_next,
 
4019
[
 
4020
AC_TRY_COMPILE([
 
4021
#ifdef HAVE_SYS_PARAM_H
 
4022
#include <sys/param.h>
 
4023
#endif
 
4024
#include <sys/types.h>
 
4025
#ifdef IFNET_NEEDS_KERNEL
 
4026
#define KERNEL
 
4027
#define _KERNEL
 
4028
#endif
 
4029
#include <sys/socket.h>
 
4030
#undef KERNEL
 
4031
#undef _KERNEL
 
4032
#include <net/route.h>
 
4033
],[
 
4034
struct rtentry rt; 
 
4035
rt.rt_next;
 
4036
], ac_cv_struct_rtentry_rt_next=yes,  ac_cv_struct_rtentry_rt_next=no )
 
4037
])
 
4038
 
 
4039
if test "x$ac_cv_struct_rtentry_rt_next" = "xyes"; then
 
4040
  AC_DEFINE(RTENTRY_RT_NEXT)
 
4041
fi
 
4042
 
 
4043
fi
 
4044
 
 
4045
# Check sin6_scope_id member specified in RFC2553 additionally
 
4046
AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,[
 
4047
AC_INCLUDES_DEFAULT()
 
4048
[#ifdef HAVE_SYS_PARAM_H
 
4049
#include <sys/param.h>
 
4050
#endif
 
4051
#ifdef HAVE_SYS_SOCKET_H
 
4052
#include <sys/socket.h>
 
4053
#endif
 
4054
#ifdef HAVE_NETINET_IN_H
 
4055
#include <netinet/in.h>
 
4056
#endif
 
4057
]])
 
4058
 
 
4059
# Check struct rtentry for various things.
 
4060
AC_CHECK_STRUCT_FOR([
 
4061
#ifdef HAVE_SYS_PARAM_H
 
4062
#include <sys/param.h>
 
4063
#endif
 
4064
#include <sys/types.h>
 
4065
#ifdef IFNET_NEEDS_KERNEL
 
4066
#define KERNEL
 
4067
#define _KERNEL
 
4068
#endif
 
4069
#include <sys/socket.h>
 
4070
#undef KERNEL
 
4071
#undef _KERNEL
 
4072
#include <net/route.h>
 
4073
], rtentry, rt_unit)
 
4074
 
 
4075
AC_CHECK_STRUCT_FOR([
 
4076
#ifdef HAVE_SYS_PARAM_H
 
4077
#include <sys/param.h>
 
4078
#endif
 
4079
#include <sys/types.h>
 
4080
#ifdef IFNET_NEEDS_KERNEL
 
4081
#define KERNEL
 
4082
#define _KERNEL
 
4083
#endif
 
4084
#include <sys/socket.h>
 
4085
#undef KERNEL
 
4086
#undef _KERNEL
 
4087
#include <net/route.h>
 
4088
], rtentry, rt_refcnt)
 
4089
 
 
4090
AC_CHECK_STRUCT_FOR([
 
4091
#ifdef HAVE_SYS_PARAM_H
 
4092
#include <sys/param.h>
 
4093
#endif
 
4094
#include <sys/types.h>
 
4095
#ifdef IFNET_NEEDS_KERNEL
 
4096
#define KERNEL
 
4097
#define _KERNEL
 
4098
#endif
 
4099
#include <sys/socket.h>
 
4100
#undef KERNEL
 
4101
#undef _KERNEL
 
4102
#include <net/route.h>
 
4103
], rtentry, rt_hash)
 
4104
 
 
4105
AC_CHECK_STRUCT_FOR([
 
4106
#ifdef HAVE_SYS_PARAM_H
 
4107
#include <sys/param.h>
 
4108
#endif
 
4109
#include <sys/types.h>
 
4110
#ifdef IFNET_NEEDS_KERNEL
 
4111
#define KERNEL
 
4112
#define _KERNEL
 
4113
#endif
 
4114
#include <sys/socket.h>
 
4115
#undef KERNEL
 
4116
#undef _KERNEL
 
4117
#include <net/route.h>
 
4118
], rtentry, rt_use)
 
4119
 
 
4120
# Check tcpstat for tcpstat.tcp_rcvmemdrop
 
4121
AC_CHECK_STRUCT_FOR([
 
4122
#ifdef HAVE_SYS_PARAM_H
 
4123
#include <sys/param.h>
 
4124
#endif
 
4125
#include <sys/types.h>
 
4126
#ifdef HAVE_SYS_TIMEOUT_H
 
4127
#include <sys/timeout.h>
 
4128
#endif
 
4129
#include <netinet/tcp.h>
 
4130
#ifdef HAVE_NETINET_TCP_TIMER_H
 
4131
#include <netinet/tcp_timer.h>
 
4132
#endif
 
4133
 
 
4134
#ifdef HAVE_NETINET_TCP_VAR_H
 
4135
#include <netinet/tcp_var.h>
 
4136
#endif
 
4137
], tcpstat, tcp_rcvmemdrop)
 
4138
 
 
4139
 
 
4140
AC_CHECK_STRUCT_FOR([
 
4141
#ifdef IFNET_NEEDS_KERNEL
 
4142
#define _KERNEL 1
 
4143
#endif
 
4144
#ifdef HAVE_SYS_PARAM_H
 
4145
#include <sys/param.h>
 
4146
#endif
 
4147
#include <sys/types.h>
 
4148
#include <sys/socket.h>
 
4149
#ifdef HAVE_SYS_TIME_H
 
4150
#include <sys/time.h>
 
4151
#endif
 
4152
#include <net/if.h>
 
4153
#ifdef HAVE_NET_IF_VAR_H
 
4154
#include <net/if_var.h>
 
4155
#endif
 
4156
], ifaddr, ifa_next)
 
4157
 
 
4158
# Check ifnet entries using macro defined in aclocal.m4.
 
4159
#
 
4160
# XXX  Broken on FreeBSD where these are #define'd in <net/if.h>
 
4161
#
 
4162
AC_CHECK_IFNET_FOR(if_baudrate)
 
4163
AC_CHECK_IFNET_FOR(if_baudrate.ifs_value)
 
4164
AC_CHECK_IFNET_FOR(if_speed)
 
4165
AC_CHECK_IFNET_FOR(if_type)
 
4166
AC_CHECK_IFNET_FOR(if_imcasts)
 
4167
AC_CHECK_IFNET_FOR(if_iqdrops)
 
4168
AC_CHECK_IFNET_FOR(if_noproto)
 
4169
AC_CHECK_IFNET_FOR(if_omcasts)
 
4170
AC_CHECK_IFNET_FOR(if_xname,no)
 
4171
AC_CHECK_IFNET_FOR(if_lastchange.tv_sec)
 
4172
AC_CHECK_IFNET_FOR(if_obytes)
 
4173
AC_CHECK_IFNET_FOR(if_ibytes)
 
4174
AC_CHECK_IFNET_FOR(if_addrlist)
 
4175
AC_CHECK_IFNET_FOR(if_addrhead.tqh_first)
 
4176
 
 
4177
AC_CHECK_STRUCT_FOR([
 
4178
#include <sys/types.h>
 
4179
#if HAVE_NETINET_IN_H
 
4180
#include <netinet/in.h>
 
4181
#endif
 
4182
#if HAVE_NETINET_IP_VAR_H
 
4183
#include <netinet/ip_var.h>
 
4184
#endif
 
4185
#if HAVE_NETINET_UDP_H
 
4186
#include <netinet/udp.h>
 
4187
#endif
 
4188
#if HAVE_NETINET_UDP_VAR_H
 
4189
#include <netinet/udp_var.h>
 
4190
#endif
 
4191
],udpstat,udps_discard)
 
4192
 
 
4193
AC_CHECK_STRUCT_FOR([
 
4194
#include <sys/types.h>
 
4195
#if HAVE_NETINET_IN_H
 
4196
#include <netinet/in.h>
 
4197
#endif
 
4198
#if HAVE_NETINET_IP_VAR_H
 
4199
#include <netinet/ip_var.h>
 
4200
#endif
 
4201
#if HAVE_NETINET_UDP_H
 
4202
#include <netinet/udp.h>
 
4203
#endif
 
4204
#if HAVE_NETINET_UDP_VAR_H
 
4205
#include <netinet/udp_var.h>
 
4206
#endif
 
4207
],udpstat,udps_noport)
 
4208
 
 
4209
AC_CHECK_STRUCT_FOR([
 
4210
#include <sys/types.h>
 
4211
#if HAVE_NETINET_IN_H
 
4212
#include <netinet/in.h>
 
4213
#endif
 
4214
#if HAVE_NETINET_IP_VAR_H
 
4215
#include <netinet/ip_var.h>
 
4216
#endif
 
4217
#if HAVE_NETINET_UDP_H
 
4218
#include <netinet/udp.h>
 
4219
#endif
 
4220
#if HAVE_NETINET_UDP_VAR_H
 
4221
#include <netinet/udp_var.h>
 
4222
#endif
 
4223
],udpstat,udps_noportbcast)
 
4224
 
 
4225
AC_CHECK_STRUCT_FOR([
 
4226
#include <sys/types.h>
 
4227
#if HAVE_NETINET_IN_H
 
4228
#include <netinet/in.h>
 
4229
#endif
 
4230
#if HAVE_NETINET_IP_VAR_H
 
4231
#include <netinet/ip_var.h>
 
4232
#endif
 
4233
#if HAVE_NETINET_UDP_H
 
4234
#include <netinet/udp.h>
 
4235
#endif
 
4236
#if HAVE_NETINET_UDP_VAR_H
 
4237
#include <netinet/udp_var.h>
 
4238
#endif
 
4239
],udpstat,udps_fullsock)
 
4240
 
 
4241
AC_CHECK_STRUCT_FOR([
 
4242
#ifdef HAVE_SYS_PARAM_H
 
4243
#include <sys/param.h>
 
4244
#endif
 
4245
#include <sys/types.h>
 
4246
#include <sys/socket.h>
 
4247
#ifdef HAVE_SYS_TIME_H
 
4248
#include <sys/time.h>
 
4249
#endif
 
4250
#include <net/if.h>
 
4251
#if HAVE_NETINET_IN_H
 
4252
#include <netinet/in.h>
 
4253
#endif
 
4254
#if HAVE_NETINET_IF_ETHER_H
 
4255
#include <netinet/if_ether.h>
 
4256
#endif
 
4257
],arphd,at_next)
 
4258
 
 
4259
AC_CHECK_STRUCT_FOR([
 
4260
#if HAVE_SYS_TYPES_H
 
4261
#include <sys/types.h>
 
4262
#endif
 
4263
#ifdef HAVE_SYS_PARAM_H
 
4264
#include <sys/param.h>
 
4265
#endif
 
4266
#if HAVE_SYS_CONF_H
 
4267
#include <sys/conf.h>
 
4268
#endif
 
4269
],swdevt,sw_nblksenabled)
 
4270
 
 
4271
AC_CHECK_STRUCT_FOR([
 
4272
#ifdef HAVE_SYS_STAT_H
 
4273
#include <sys/stat.h>
 
4274
#endif
 
4275
#if HAVE_SYS_STATFS_H
 
4276
#include <sys/statfs.h>
 
4277
#endif
 
4278
#if HAVE_SYS_STATVFS_H
 
4279
#include <sys/statvfs.h>
 
4280
#endif
 
4281
],statvfs,mnt_dir)
 
4282
 
 
4283
AC_CHECK_STRUCT_FOR([
 
4284
#ifdef HAVE_SYS_STAT_H
 
4285
#include <sys/stat.h>
 
4286
#endif
 
4287
#if HAVE_SYS_STATFS_H
 
4288
#include <sys/statfs.h>
 
4289
#endif
 
4290
#if HAVE_SYS_STATVFS_H
 
4291
#include <sys/statvfs.h>
 
4292
#endif
 
4293
],statvfs,f_frsize)
 
4294
 
 
4295
AC_CHECK_STRUCT_FOR([
 
4296
#ifdef HAVE_SYS_STAT_H
 
4297
#include <sys/stat.h>
 
4298
#endif
 
4299
#if HAVE_SYS_STATFS_H
 
4300
#include <sys/statfs.h>
 
4301
#endif
 
4302
#if HAVE_SYS_STATVFS_H
 
4303
#include <sys/statvfs.h>
 
4304
#endif
 
4305
],statfs,f_frsize)
 
4306
 
 
4307
AC_CHECK_STRUCT_FOR([
 
4308
#ifdef HAVE_SYS_STAT_H
 
4309
#include <sys/stat.h>
 
4310
#endif
 
4311
#if HAVE_SYS_STATFS_H
 
4312
#include <sys/statfs.h>
 
4313
#endif
 
4314
#if HAVE_SYS_STATVFS_H
 
4315
#include <sys/statvfs.h>
 
4316
#endif
 
4317
],statvfs,f_files)
 
4318
 
 
4319
AC_CHECK_STRUCT_FOR([
 
4320
#ifdef HAVE_SYS_STAT_H
 
4321
#include <sys/stat.h>
 
4322
#endif
 
4323
#if HAVE_SYS_STATFS_H
 
4324
#include <sys/statfs.h>
 
4325
#endif
 
4326
#ifdef HAVE_SYS_PARAM_H
 
4327
#include <sys/param.h>
 
4328
#include <sys/types.h>
 
4329
#endif
 
4330
#ifdef HAVE_SYS_MOUNT_H
 
4331
#include <sys/mount.h>
 
4332
#endif
 
4333
],statfs,f_files)
 
4334
 
 
4335
AC_CHECK_STRUCT_FOR([
 
4336
#ifdef HAVE_SYS_STAT_H
 
4337
#include <sys/stat.h>
 
4338
#endif
 
4339
#if HAVE_SYS_STATFS_H
 
4340
#include <sys/statfs.h>
 
4341
#endif
 
4342
#ifdef HAVE_SYS_PARAM_H
 
4343
#include <sys/param.h>
 
4344
#include <sys/types.h>
 
4345
#endif
 
4346
#ifdef HAVE_SYS_MOUNT_H
 
4347
#include <sys/mount.h>
 
4348
#endif
 
4349
],statfs,f_ffree)
 
4350
 
 
4351
AC_CHECK_STRUCT_FOR([
 
4352
#ifdef HAVE_SYS_STAT_H
 
4353
#include <sys/stat.h>
 
4354
#endif
 
4355
#if HAVE_SYS_STATFS_H
 
4356
#include <sys/statfs.h>
 
4357
#endif
 
4358
#ifdef HAVE_SYS_PARAM_H
 
4359
#include <sys/param.h>
 
4360
#include <sys/types.h>
 
4361
#endif
 
4362
#ifdef HAVE_SYS_MOUNT_H
 
4363
#include <sys/mount.h>
 
4364
#endif
 
4365
],statfs,f_favail)
 
4366
 
 
4367
AC_CHECK_STRUCT_FOR([
 
4368
#if HAVE_NLIST_H
 
4369
#include <nlist.h>
 
4370
#endif
 
4371
],nlist,n_value)
 
4372
 
 
4373
# struct nlist64 (IRIX)
 
4374
AC_CHECK_STRUCT_FOR([
 
4375
#if HAVE_SYS_TYPES_H
 
4376
#include <sys/types.h>
 
4377
#endif
 
4378
#if HAVE_NLIST_H
 
4379
#include <nlist.h>
 
4380
#endif
 
4381
],nlist64, n_value)
 
4382
 
 
4383
# check struct ipstat for various things
 
4384
AC_CHECK_STRUCT_FOR([
 
4385
#include <sys/types.h>
 
4386
#if HAVE_NETINET_IN_H
 
4387
#include <netinet/in.h>
 
4388
#endif
 
4389
#if HAVE_NETINET_IP_VAR_H
 
4390
#include <netinet/ip_var.h>
 
4391
#endif
 
4392
], ipstat, ips_cantforward)
 
4393
 
 
4394
AC_CHECK_STRUCT_FOR([
 
4395
#include <sys/types.h>
 
4396
#if HAVE_NETINET_IN_H
 
4397
#include <netinet/in.h>
 
4398
#endif
 
4399
#if HAVE_NETINET_IP_VAR_H
 
4400
#include <netinet/ip_var.h>
 
4401
#endif
 
4402
], ipstat, ips_cantfrag)
 
4403
 
 
4404
AC_CHECK_STRUCT_FOR([
 
4405
#include <sys/types.h>
 
4406
#if HAVE_NETINET_IN_H
 
4407
#include <netinet/in.h>
 
4408
#endif
 
4409
#if HAVE_NETINET_IP_VAR_H
 
4410
#include <netinet/ip_var.h>
 
4411
#endif
 
4412
], ipstat, ips_delivered)
 
4413
 
 
4414
AC_CHECK_STRUCT_FOR([
 
4415
#include <sys/types.h>
 
4416
#if HAVE_NETINET_IN_H
 
4417
#include <netinet/in.h>
 
4418
#endif
 
4419
#if HAVE_NETINET_IP_VAR_H
 
4420
#include <netinet/ip_var.h>
 
4421
#endif
 
4422
], ipstat, ips_fragdropped)
 
4423
 
 
4424
AC_CHECK_STRUCT_FOR([
 
4425
#include <sys/types.h>
 
4426
#if HAVE_NETINET_IN_H
 
4427
#include <netinet/in.h>
 
4428
#endif
 
4429
#if HAVE_NETINET_IP_VAR_H
 
4430
#include <netinet/ip_var.h>
 
4431
#endif
 
4432
], ipstat, ips_fragtimeout)
 
4433
 
 
4434
AC_CHECK_STRUCT_FOR([
 
4435
#include <sys/types.h>
 
4436
#if HAVE_NETINET_IN_H
 
4437
#include <netinet/in.h>
 
4438
#endif
 
4439
#if HAVE_NETINET_IP_VAR_H
 
4440
#include <netinet/ip_var.h>
 
4441
#endif
 
4442
], ipstat, ips_fragmented)
 
4443
 
 
4444
AC_CHECK_STRUCT_FOR([
 
4445
#include <sys/types.h>
 
4446
#if HAVE_NETINET_IN_H
 
4447
#include <netinet/in.h>
 
4448
#endif
 
4449
#if HAVE_NETINET_IP_VAR_H
 
4450
#include <netinet/ip_var.h>
 
4451
#endif
 
4452
], ipstat, ips_localout)
 
4453
 
 
4454
AC_CHECK_STRUCT_FOR([
 
4455
#include <sys/types.h>
 
4456
#if HAVE_NETINET_IN_H
 
4457
#include <netinet/in.h>
 
4458
#endif
 
4459
#if HAVE_NETINET_IP_VAR_H
 
4460
#include <netinet/ip_var.h>
 
4461
#endif
 
4462
], ipstat, ips_noproto)
 
4463
 
 
4464
AC_CHECK_STRUCT_FOR([
 
4465
#include <sys/types.h>
 
4466
#if HAVE_NETINET_IN_H
 
4467
#include <netinet/in.h>
 
4468
#endif
 
4469
#if HAVE_NETINET_IP_VAR_H
 
4470
#include <netinet/ip_var.h>
 
4471
#endif
 
4472
], ipstat, ips_noroute)
 
4473
 
 
4474
AC_CHECK_STRUCT_FOR([
 
4475
#include <sys/types.h>
 
4476
#if HAVE_NETINET_IN_H
 
4477
#include <netinet/in.h>
 
4478
#endif
 
4479
#if HAVE_NETINET_IP_VAR_H
 
4480
#include <netinet/ip_var.h>
 
4481
#endif
 
4482
], ipstat, ips_odropped)
 
4483
 
 
4484
AC_CHECK_STRUCT_FOR([
 
4485
#include <sys/types.h>
 
4486
#if HAVE_NETINET_IN_H
 
4487
#include <netinet/in.h>
 
4488
#endif
 
4489
#if HAVE_NETINET_IP_VAR_H
 
4490
#include <netinet/ip_var.h>
 
4491
#endif
 
4492
], ipstat, ips_ofragments)
 
4493
 
 
4494
AC_CHECK_STRUCT_FOR([
 
4495
#include <sys/types.h>
 
4496
#if HAVE_NETINET_IN_H
 
4497
#include <netinet/in.h>
 
4498
#endif
 
4499
#if HAVE_NETINET_IP_VAR_H
 
4500
#include <netinet/ip_var.h>
 
4501
#endif
 
4502
], ipstat, ips_reassembled)
 
4503
 
 
4504
# check for the des_ks_struct.weak_key attribute, which indicates the 
 
4505
# older openssl version is being used.
 
4506
if test "x$ac_cv_header_openssl_des_h" = "xyes" ; then
 
4507
AC_CHECK_STRUCT_FOR([
 
4508
#include <openssl/des.h>
 
4509
], des_ks_struct, weak_key)
 
4510
fi
 
4511
 
 
4512
# attempt to figure out if sysctl is usable
 
4513
 
 
4514
if test $cross_compiling = yes; then
 
4515
  AC_MSG_WARN([Can't check sysctl, manually define NETSNMP_CAN_USE_SYSCTL if platform support available])
 
4516
else
 
4517
  AC_CACHE_CHECK(if sysctl can read kernel information,ac_cv_NETSNMP_CAN_USE_SYSCTL,
 
4518
  [AC_TRY_RUN([
 
4519
#if TIME_WITH_SYS_TIME
 
4520
# include <sys/time.h>
 
4521
# include <time.h>
 
4522
#else
 
4523
# if HAVE_SYS_TIME_H
 
4524
#  include <sys/time.h>
 
4525
# else
 
4526
#  include <time.h>
 
4527
# endif
 
4528
#endif
 
4529
#if HAVE_SYS_PARAM_H
 
4530
# include <sys/param.h>
 
4531
#endif
 
4532
#include <sys/types.h>
 
4533
#if HAVE_SYS_SYSCTL_H
 
4534
# include <sys/sysctl.h>
 
4535
#endif
 
4536
 
 
4537
main() {
 
4538
  int                 mib[2];
 
4539
  size_t              len;
 
4540
  struct timeval boottime;
 
4541
  
 
4542
  mib[0] = CTL_KERN;
 
4543
  mib[1] = KERN_BOOTTIME;
 
4544
  
 
4545
  len = sizeof(boottime);
 
4546
  sysctl(mib, 2, &boottime, &len, NULL, NULL);
 
4547
  if (boottime.tv_sec != 0)
 
4548
    exit(0);
 
4549
  else
 
4550
    exit(1);
 
4551
}
 
4552
  ], ac_cv_NETSNMP_CAN_USE_SYSCTL=yes, ac_cv_NETSNMP_CAN_USE_SYSCTL=no, ac_cv_NETSNMP_CAN_USE_SYSCTL=no)])
 
4553
fi
 
4554
 
 
4555
if test "x$ac_cv_NETSNMP_CAN_USE_SYSCTL" = "xyes"; then
 
4556
  AC_DEFINE(NETSNMP_CAN_USE_SYSCTL)
 
4557
fi
 
4558
 
 
4559
#
 
4560
# In FreeBSD 4.x, the TCP timer constants aren't.  They are defined
 
4561
# in terms of 'hz', the kernel clock tick.  In this case,
 
4562
# we need to have a local variable 'hz' in scope and set to a useful
 
4563
# value whenever we use one of these constants.
 
4564
#
 
4565
AC_CACHE_CHECK(whether TCP timers depend on 'hz',ac_cv_TCPTV_NEEDS_HZ,
 
4566
[AC_EGREP_CPP(hz,
 
4567
[#include <netinet/tcp_timer.h>
 
4568
TCPTV_SRTTDFLT
 
4569
], ac_cv_TCPTV_NEEDS_HZ=yes, ac_cv_TCPTV_NEEDS_HZ=no)])
 
4570
 
 
4571
if test "x$ac_cv_TCPTV_NEEDS_HZ" = "xyes"; then
 
4572
  AC_DEFINE(TCPTV_NEEDS_HZ)
 
4573
fi
 
4574
 
 
4575
#
 
4576
# define the agent libraries variables
 
4577
#
 
4578
AC_SUBST(LMIBLIBS)
 
4579
AC_SUBST(AGENTLIBS)
 
4580
AC_SUBST(OTHERAGENTLIBOBJS)
 
4581
AC_SUBST(OTHERAGENTLIBLOBJS)
 
4582
 
 
4583
#
 
4584
# Prompt for various bits of user information
 
4585
#
 
4586
 
 
4587
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
 
4588
AC_CACHE_CHECK(whether to prompt for values, ac_cv_have_warned,
 
4589
[
 
4590
if test "x$defaults" = "xno"; then
 
4591
cat << EOF
 
4592
 
 
4593
         ************** Configuration Section **************
 
4594
 
 
4595
        You are about to be prompted with a series of questions.  Answer
 
4596
them carefully, as they determine how the SNMP agent and related
 
4597
applications are to function.
 
4598
 
 
4599
        After the configure script finishes, you can browse the newly
 
4600
created net-snmp-config.h file for further - less important - parameters to
 
4601
modify.  Be careful if you re-run configure though, since net-snmp-config.h 
 
4602
will be overwritten.
 
4603
 
 
4604
-Press return to continue-
 
4605
EOF
 
4606
 
 
4607
read tmpinput
 
4608
ac_cv_have_warned="yes"
 
4609
else
 
4610
  ac_cv_have_warned="no"
 
4611
fi
 
4612
])
 
4613
else
 
4614
  ac_cv_have_warned="yes"
 
4615
fi
 
4616
 
 
4617
ME=`$WHOAMI`
 
4618
if test -f /etc/resolv.conf; then
 
4619
  LOC=`cat /etc/resolv.conf | grep '^domain' | tail -1 | awk '{print $NF}'`
 
4620
else
 
4621
  LOC="@no.where"
 
4622
fi
 
4623
 
 
4624
AC_PROMPT_USER(NETSNMP_DEFAULT_SNMP_VERSION,[
 
4625
 
 
4626
*** Default SNMP Version:
 
4627
 
 
4628
        Starting with Net-SNMP 5.0, you can choose the default version of
 
4629
the SNMP protocol to use when no version is given explicitly on the
 
4630
command line, or via an 'snmp.conf' file.  In the past this was set to
 
4631
SNMPv1, but you can use this to switch to SNMPv3 if desired.  SNMPv3
 
4632
will provide a more secure management environment (and thus you're
 
4633
encouraged to switch to SNMPv3), but may break existing scripts that
 
4634
rely on the old behaviour.  (Though such scripts will probably need to
 
4635
be changed to use the '-c' community flag anyway, as the SNMPv1
 
4636
command line usage has changed as well.).
 
4637
   At this prompt you can select \"1\", \"2\" (for SNMPv2c), or \"3\" as
 
4638
the default version for the command tools (snmpget, ...) to use.  This
 
4639
can always be overridden at runtime using the -v flag to the tools, or
 
4640
by using the \"defVersion\" token in your snmp.conf file.
 
4641
   Providing the --with-default-snmp-version=\"x\" parameter to ./configure
 
4642
will avoid this prompt.
 
4643
 
 
4644
Default version of SNMP to use],3,unquoted)
 
4645
 
 
4646
# we tested this above before the prompt, but the prompt may give a new value.
 
4647
if test "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" = "2c"; then
 
4648
  ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION="2"
 
4649
fi
 
4650
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
 
4651
  AC_MSG_ERROR([Illegal version number.  Only 1, 2 (for SNMPv2c) and 3 are supported.])
 
4652
fi
 
4653
 
 
4654
AC_PROMPT_USER(NETSNMP_SYS_CONTACT,[
 
4655
 
 
4656
*** System Contact Information:
 
4657
 
 
4658
        Describes who should be contacted about the host the agent is
 
4659
running on.  This information is available in the MIB-II tree.  This
 
4660
can also be over-ridden using the \"syscontact\" syntax in the agent's
 
4661
configuration files.
 
4662
  Providing the --with-sys-contact=\"contact\" parameter to ./configure
 
4663
will avoid this prompt.
 
4664
 
 
4665
System Contact Information],$ME@$LOC,quoted)
 
4666
 
 
4667
AC_PROMPT_USER(NETSNMP_SYS_LOC,[
 
4668
 
 
4669
*** System Location:
 
4670
 
 
4671
        Describes the location of the system.  This information is
 
4672
available in the MIB-II tree.  this can also be over-ridden using the
 
4673
\"syslocation\" syntax in the agent's configuration files.
 
4674
  Providing the --with-sys-location=\"location\" parameter to ./configure
 
4675
will avoid this prompt.
 
4676
 
 
4677
System Location],Unknown,quoted)
 
4678
 
 
4679
if test -d /var/log; then
 
4680
  defaultlog="/var/log/snmpd.log"
 
4681
else
 
4682
  defaultlog="/usr/adm/snmpd.log"
 
4683
fi
 
4684
  
 
4685
AC_PROMPT_USER(NETSNMP_LOGFILE,[
 
4686
 
 
4687
*** Logfile location:
 
4688
 
 
4689
        Enter the default location for the snmpd agent to dump
 
4690
information & errors to.  If not defined (enter the keyword \"none\"
 
4691
at the prompt below) the agent will use stdout and stderr instead.
 
4692
(Note: This value can be over-ridden using command line options.)
 
4693
  Providing the --with-logfile=\"path\" parameter to ./configure
 
4694
will avoid this prompt.
 
4695
 
 
4696
Location to write logfile],$defaultlog,quoted)
 
4697
 
 
4698
if test -d /var; then
 
4699
  defaultstore="/var/net-snmp"
 
4700
  ucddefaultstore="/var/ucd-snmp"
 
4701
else
 
4702
  defaultstore="/etc/net-snmp"
 
4703
  ucddefaultstore="/etc/ucd-snmp"
 
4704
fi
 
4705
  
 
4706
AC_PROMPT_USER(NETSNMP_PERSISTENT_DIRECTORY,[
 
4707
 
 
4708
*** snmpd persistent storage location:
 
4709
 
 
4710
        Enter a directory for the SNMP library to store persistent
 
4711
data in the form of a configuration file.  This default location is
 
4712
different than the old default location (which was for ucd-snmp).  If
 
4713
you stay with the new path, I'll ask you in a second if you wish to
 
4714
copy your files over to the new location (once only).  If you pick
 
4715
some other path than the default, you'll have to copy them yourself.
 
4716
There is nothing wrong with picking the old path ($ucddefaultstore) if
 
4717
you'd rather.
 
4718
  Providing the --with-persistent-directory=\"path\" parameter to
 
4719
./configure will avoid this prompt.
 
4720
 
 
4721
Location to write persistent information],$defaultstore,quoted)
 
4722
 
 
4723
PERSISTENT_DIRECTORY=$ac_cv_user_prompt_NETSNMP_PERSISTENT_DIRECTORY
 
4724
AC_SUBST(PERSISTENT_DIRECTORY)
 
4725
UCDPERSISTENT_DIRECTORY=$ucddefaultstore
 
4726
AC_SUBST(UCDPERSISTENT_DIRECTORY)
 
4727
 
 
4728
if test $PERSISTENT_DIRECTORY = "$defaultstore" -a -d "$ucddefaultstore" -a ! -d "$defaultstore" ; then
 
4729
AC_CACHE_CHECK(If we should copy the old persistent directory, ac_cv_user_prompt_COPY_PERSISTENT_FILES,
 
4730
[
 
4731
AC_PROMPT_USER_NO_DEFINE(ac_cv_user_prompt_COPY_PERSISTENT_FILES,[
 
4732
 
 
4733
*** Copying old ucd-snmp persistent files to net-snmp persistent directory:
 
4734
 
 
4735
        Would you like to copy the older ucd-snmp persistent files
 
4736
into your new net-snmp persistent file path?  This will functionally
 
4737
save all your ucd-snmp data and let it be used within the net-snmp
 
4738
tools.  This will only be done once when you run make install.  If you
 
4739
wish to do this, enter "yes" at the prompt.
 
4740
  Providing the --with-copy-persistent-files=\"no\" (or \"yes\")
 
4741
parameters to ./configure will avoid this prompt.
 
4742
 
 
4743
Copy ucd-snmp data into the net-snmp data directory],"yes")
 
4744
])
 
4745
else
 
4746
ac_cv_user_prompt_COPY_PERSISTENT_FILES="no"
 
4747
fi
 
4748
COPY_PERSISTENT_FILES="$ac_cv_user_prompt_COPY_PERSISTENT_FILES"
 
4749
AC_SUBST(COPY_PERSISTENT_FILES)
 
4750
 
 
4751
AC_SUBST(DLLIBS)
 
4752
 
 
4753
AC_CONFIG_FILES([Makefile:Makefile.top:Makefile.in:Makefile.rules])
 
4754
AC_CONFIG_FILES([snmplib/Makefile:Makefile.top:snmplib/Makefile.in:Makefile.rules:snmplib/Makefile.depend])
 
4755
AC_CONFIG_FILES([apps/Makefile:Makefile.top:apps/Makefile.in:Makefile.rules:apps/Makefile.depend])
 
4756
AC_CONFIG_FILES([apps/snmpnetstat/Makefile:Makefile.top:apps/snmpnetstat/Makefile.in:Makefile.rules:apps/snmpnetstat/Makefile.depend])
 
4757
AC_CONFIG_FILES([agent/Makefile:Makefile.top:agent/Makefile.in:Makefile.rules:agent/Makefile.depend])
 
4758
AC_CONFIG_FILES([agent/helpers/Makefile:Makefile.top:agent/helpers/Makefile.in:Makefile.rules:agent/helpers/Makefile.depend])
 
4759
AC_CONFIG_FILES([agent/mibgroup/Makefile:Makefile.top:agent/mibgroup/Makefile.in:Makefile.rules:agent/mibgroup/Makefile.depend])
 
4760
AC_CONFIG_FILES([local/Makefile:Makefile.top:local/Makefile.in:Makefile.rules])
 
4761
AC_CONFIG_FILES([testing/Makefile:Makefile.top:testing/Makefile.in])
 
4762
AC_CONFIG_FILES([man/Makefile:Makefile.top:man/Makefile.in:Makefile.rules])
 
4763
AC_CONFIG_FILES([mibs/Makefile:Makefile.top:mibs/Makefile.in:Makefile.rules])
 
4764
AC_CONFIG_FILES([net-snmp-config:net-snmp-config.in],
 
4765
                [chmod +x net-snmp-config])
 
4766
 
 
4767
AC_CONFIG_COMMANDS([default], echo timestamp > stamp-h)
 
4768
 
 
4769
#
 
4770
# protect PACKAGE_* variables
 
4771
#
 
4772
AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */
 
4773
#ifndef PACKAGE_BUGREPORT
 
4774
#undef PACKAGE_BUGREPORT
 
4775
#endif])
 
4776
AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */
 
4777
#ifndef PACKAGE_NAME
 
4778
#undef PACKAGE_NAME
 
4779
#endif])
 
4780
AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */
 
4781
#ifndef PACKAGE_STRING
 
4782
#undef PACKAGE_STRING
 
4783
#endif])
 
4784
AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */
 
4785
#ifndef PACKAGE_TARNAME
 
4786
#undef PACKAGE_TARNAME
 
4787
#endif])
 
4788
AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */
 
4789
#ifndef PACKAGE_VERSION
 
4790
#undef PACKAGE_VERSION
 
4791
#endif])
 
4792
 
 
4793
AC_OUTPUT
 
4794
 
 
4795
AC_MSG_CACHE_DISPLAY()
 
4796
# Local Variables:
 
4797
# mode: Autoconf
 
4798
# comment-start: "#"
 
4799
# End: