1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(agent/mibgroup/ucd-snmp/extensible.c)
4 AC_CONFIG_HEADER(include/net-snmp/net-snmp-config.h)
8 dnl save the configure arguments
10 AC_DEFINE_UNQUOTED(CONFIGURE_OPTIONS,"\"$ac_configure_args\"")
11 CONFIGURE_OPTIONS="\"$ac_configure_args\""
12 AC_SUBST(CONFIGURE_OPTIONS)
19 --with-cc=CC use CC to compile (default=gcc).],
20 [CC=$with_cc;export CC])
23 [ --with-ar=AR use AR as the archiver.],
24 [AR=$with_ar; export AR])
26 AC_ARG_WITH(endianness,
27 [ --with-endianness=big|little define endianness of target platform when
29 [if test $with_endianness != "big" -a $with_endianness != "little" ; then
30 AC_MSG_ERROR([Endianness must be big or little, not \"$with_endianness\".]);
35 [ --with-cflags=CFLAGS use CFLAGS as compile time arguments.],
36 [CFLAGS=$with_cflags; export CFLAGS])
39 [ --with-ldflags=LDFLAGS use LDFLAGS as link time arguments to ld.],
40 [LDFLAGS=$with_ldflags; export LDFLAGS])
43 [ --with-libs=LIBS use LIBS as link time arguments to ld.],
44 [LIBS=$with_libs; export LIBS])
46 AC_ARG_ENABLE(silent-libtool,
47 [ --enable-silent-libtool Pass --silent to libtool.],
48 LIBTOOLFLAGS=--silent)
49 AC_SUBST(LIBTOOLFLAGS)
51 AC_ARG_ENABLE(mini_agent,
52 [ --enable-mini-agent Build a minimal agent.],
53 mini_agent="yes",mini_agent="no")
56 [ --enable-ipv6 Generate IPv6 ready version.],
57 [if test "x$enable_ipv6" = "xyes"; then
61 AC_ARG_ENABLE(debugging,
62 [ --enable-debugging Outputs extra debugging information at all
63 times. Normally, you should not enable this,
64 but instead use the -D flag of the commands,
65 which toggles debbuging output at runtime.
66 --disable-debugging Disallows debugging code to be built in.
67 This might provide some speed benefits.],
68 AC_DEFINE(SNMP_ALWAYS_DEBUG))
70 AC_ARG_ENABLE(developer,
71 [ --enable-developer Turns on super-duper-extra-compile-warnings
75 if test "x$enable_debugging" = "xno"; then
76 AC_DEFINE(SNMP_NO_DEBUGGING)
80 [ --with-dmalloc=PATH Use dmalloc library (www.dmalloc.com)],
81 if test "x$withval" = "xyes"; then
82 LIBS="$LIBS -ldmalloc"
83 AC_DEFINE(HAVE_DMALLOC_H)
84 elif test -d "$withval"; then
85 AC_ADD_SEARCH_PATH($withval)
86 LIBS="$LIBS -ldmalloc"
87 AC_DEFINE(HAVE_DMALLOC_H)
90 AC_SUBST(HAVE_DMALLOC_H)
93 [ --with-efence Look for and use libefence (malloc).],
94 use_efence="$withval")
98 [ --with-rsaref=PATH Look for librsaref in PATH/lib.],
99 if test "x$withval" = "xyes"; then
101 elif test "x$withval" = "xno"; then
103 elif test -d "$withval"; then
104 AC_ADD_SEARCH_PATH($withval)
109 tryopenssl=defaultyes
112 [ --with-openssl=PATH Look for openssl in PATH/lib.],
113 if test "x$withval" = "xyes"; then
116 elif test "x$withval" = "xno"; then
118 elif test -d "$withval"; then
119 AC_ADD_SEARCH_PATH($withval)
124 if test "x$tryopenssl" = "xdefaultyes"; then
125 AC_ADD_SEARCH_PATH(/usr/local/ssl)
130 AC_ARG_ENABLE(privacy,
131 [ --disable-privacy Don't compile in support for privacy.])
132 if test "x$enable_privacy" != "xno"; then
133 AC_DEFINE(SCAPI_AUTHPRIV)
136 AC_ARG_ENABLE(internal-md5,
137 [ --enable-internal-md5 Use the internal MD5 support.],
138 AC_DEFINE(USE_INTERNAL_MD5))
141 AC_ARG_WITH(opaque-special-types,
142 [ --without-opaque-special-types Don't use special opaque encodings.
143 SNMP normally cannot handle
144 floating numbers, nor large 64 bit
145 integers well. By default, the
146 net-snmp package compiles in
147 support for these extra datatypes
151 [ --with-mibdirs=\"dir1:dir2:\" Default directories to look for mibs.
152 (Default: \$HOME/.snmp/mibs:DATADIR/snmp/mibs)],
153 [DEFAULT_MIBDIRS="$with_mibdirs"
154 AC_DEFINE_UNQUOTED(DEFAULT_MIBDIRS,"$with_mibdirs")])
157 [ --with-mibs=\"item1:item2:\" Default mib IDs to read.
158 (The default list is \"IP-MIB:IF-MIB:
159 TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB\"
160 with the addition of any mibs used
161 by the mib modules the agent is
163 DEFAULT_MIBS="$with_mibs")
165 AC_ARG_WITH(mibfiles,
166 [ --with-mibfiles=\"file1:file2\" Default mib files to load.
167 (Default: none. uses IDs above instead.)],
168 AC_DEFINE_UNQUOTED(DEFAULT_MIBFILES,"$with_mibfiles"))
171 AC_ARG_ENABLE(testing-code,
172 [ --enable-testing-code Enables some code sections that should
173 only be used for testing of certain
174 SNMP functionalities. This should *not*
175 be turned on for production use. Ever.],
176 AC_DEFINE(SNMP_TESTING_CODE))
178 AC_ARG_ENABLE(reentrant,
179 [ --enable-reentrant Enables locking functions that protect
180 library resources in some multi-threading
181 environments. This does not guarantee
182 thread-safe operation.
183 Currently an experimental setting.],
184 with_res_locks="yes",with_res_locks="no")
186 AC_ARG_WITH(root-access,
188 Configuring the agent:
189 --without-root-access The snmpd agent won't require root access to
190 run it. The information it returns in the
191 mib-II tree may not be correct, however.])
193 AC_ARG_WITH(kmem-usage,
195 Configuring the agent:
196 --without-kmem-usage Do not include any code related to the use
197 of kmem. This option can only be used with
198 the option --enable-mini-agent.])
200 AC_ARG_WITH(dummy-values,
201 [ --with-dummy-values Provide 'placeholder' dummy values where
202 the necessary information is not available.
203 This is technically not compliant with the
204 SNMP specifications, but was how the agent
205 operated for versions < 4.0.])
207 AC_ARG_WITH(persistent-directory,
208 [ --with-persistent-directory=\"directory\"
209 Default directory for persistent data storage.],ac_cv_user_prompt_PERSISTENT_DIRECTORY="$with_persistent_directory")
211 AC_ARG_WITH(copy_persistent_files,
212 [ --with-copy-persistent-files=\"no\" Don't copy persistent files
213 (or use \"yes\" to copy them).
215 ac_cv_user_prompt_COPY_PERSISTENT_FILES="$with_copy_persistent_files")
217 AC_ARG_WITH(default-snmp-version,
218 [ --with-default-snmp-version=\"3\" Default version of SNMP to use.
220 Legal values: 1, 2 (for SNMPv2c) or 3.],
221 ac_cv_user_prompt_DEFAULT_SNMP_VERSION="$with_default_snmp_version")
223 dnl we test this now and later as well. we test it now so configure can die
224 dnl early on with an error rather than waiting till the end of the script.
225 if test "x$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "x"; then
226 if test "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "3"; then
227 AC_MSG_ERROR(Illegal version number passed to --with-default-snmp-version)
231 AC_ARG_WITH(sys_contact,
232 [ --with-sys-contact=\"who@where\" Default system contact.
233 (Default: LOGIN@DOMAINNAME)],
234 ac_cv_user_prompt_SYS_CONTACT="$with_sys_contact")
236 AC_ARG_WITH(sys_location,
237 [ --with-sys-location=\"location\" Default system location.
239 ac_cv_user_prompt_SYS_LOC="$with_sys_location")
242 [ --with-logfile=\"location\" Default log file location for snmpd.],
243 ac_cv_user_prompt_LOGFILE="$with_logfile")
245 dnl This can't be within AC_ARG_WITH. I don't want to read autoconf m4
249 AC_ARG_WITH(transports,
250 [ --with-transports=\"t1 t2 ...\" Compile in the given SNMP transport
251 modules (space separated list).])
252 AC_ARG_WITH(out_transports,
253 [ --with-out-transports=\"t1 ...\" Exclude listed SNMP transports
254 (space separated list).
256 Available SNMP transport modules are:
258 UDP support for SNMP over UDP/IP.
259 This transport is always compiled in.
260 UDPIPv6 support for SNMP over UDP/IPv6.
261 This transport is available for Linux, Solaris and
263 It is never compiled in by default.
264 TCPIPv6 support for SNMP over UDP/IPv6.
265 This transport is available for Linux, Solaris and
267 It is never compiled in by default.
268 TCP support for SNMP over TCP/IP.
269 This transport is compiled in by default, but may be ommitted.
270 Unix support for SNMP over Unix domain protocols.
271 This transport is compiled in by default except on Win32
272 platforms, and may be omitted.
273 Callback support for SNMP over an internal locally connected pair
275 AAL5PVC support for SNMP over AAL5 PVCs.
276 This transport is presently only available for Linux,
277 is never compiled in by default and may be omitted.
278 IPX support for SNMP over IPX per RFC 1420.
279 This transport is presently only available for Linux,
280 is never compiled in by default and may be omitted.
284 dnl Catch common mistakes in transport options
286 AC_ARG_WITH(transport,, AC_MSG_ERROR([ Invalid option. Use --with-transports instead ]) )
287 AC_ARG_WITH(out_transport,,AC_MSG_ERROR([ Invalid option. Use --with-out-transports instead ]) )
293 AC_ARG_WITH(security-modules,
294 [ --with-security-modules=\"s1 s2 ...\" Compile in the given SNMP security
295 module services (space separated list).
297 Available SNMP security services:
299 usm support for user based SNMP security
300 (required and always compiled in)
301 ksm support for kerberos based SNMP security
308 AC_ARG_WITH(mib_modules,
309 [ --with-mib-modules=\"item1 ...\" Compile with additional mib modules
310 (Space separated list).])
312 AC_ARG_WITH(out_mib_modules,
313 [ --with-out-mib-modules=\"list\" Compile without these mib modules.
315 Default mib modules compiled into the agent (which can be removed):
317 mibII support for the mib-II tree.
318 snmpv3mibs support for the snmpv3 mib modules.
319 ucd_snmp UCD-SNMP-MIB specific extensions.
320 agent_mibs NET-SNMP-AGENT-MIB extensions
322 notification mibs supporting specification of trap destinations.
323 target Support for the SNMP WGs TARGET-MIB.
324 utilities general agent configuration utilities.
326 Optional mib modules that can be built into the agent include:
327 host host resources mib support.
328 (beta level code for linux, hpux, solaris, bsdi)
329 disman/event-mib support for the DISMAN-EVENT-MIB (beta)
330 (supports self monitoring and notification
331 delivery when error conditions are found)
332 smux smux support to allow subagents to attach to snmpd.
333 mibII/mta_sendmail Sendmail statistics monitoring (MTA-MIB)
334 misc/ipfwacc accounting rules IP firewall information (linux).
335 ipfwchains/ipfwchains firewall chains under ipfw for linux.
336 (Download separately from the ucd-snmp ftp site.)
337 ucd-snmp/diskio Table of io-devices and how much data they have
338 read/written. (only tested on Solaris)
339 tunnel Linux TUNNEL-MIB support (ifTable extension)
341 AgentX support: (warning: beta code)
342 agentx/subagent allows the agent to run as either a snmp agent
343 or as an agentX sub-agent.
344 agentx/master makes the agent run as an agentX master agent
345 as well as a normal snmp agent.
346 agentx includes both agentx/master and agentx/client.
348 Optional modules for C coders to look at and/or include as extension examples:
350 examples/ucdDemoPublic SNMPv3 interoperability testing mib.
351 examples/example example C code extension.])
355 AC_ARG_WITH(enterprise-oid,
356 [Enterprise OIDs: (warning: this should be used with caution.)
358 --with-enterprise-oid The enterprise number assigned to the
360 http://www.iana.org/cgi-bin/enterprise.pl
361 to get one, though using the default is
362 probably the right choice is most cases.
363 (default 8072 = "enterprise.net-snmp")],[
364 if test "$withval" = yes; then
365 AC_MSG_ERROR([ Please provide a value for the enterprise number ]);
367 AC_DEFINE_UNQUOTED(ENTERPRISE_OID, $withval)
368 ent_oid="1,3,6,1,4,1,$withval"
369 AC_DEFINE_UNQUOTED(ENTERPRISE_MIB, $ent_oid)
370 ent_dot_oid="1.3.6.1.4.1.$withval"
371 AC_DEFINE_UNQUOTED(ENTERPRISE_DOT_MIB, $ent_dot_oid)
372 AC_MSG_RESULT(using enterprise number $withval)
374 AC_MSG_RESULT(using default "enterprise.net-snmp")
377 AC_ARG_WITH(enterprise-sysoid,
379 --with-enterprise-sysoid The base OID for the sysObjectID
381 (default .1.3.6.1.4.1.8072.3.2... =
382 "netSnmpAgentOIDs...")],[
383 if test "$withval" = yes; then
384 AC_MSG_ERROR([ Please provide a base OID value ]);
386 sys_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'`
387 AC_DEFINE_UNQUOTED(SYSTEM_MIB, $sys_oid)
388 sys_dot_oid=`echo "$withval" | sed 's/^\.//'`
389 AC_DEFINE_UNQUOTED(SYSTEM_DOT_MIB, $sys_dot_oid)
390 sysoid_len=`echo "$withval" | sed 's/[^\.]//g' | awk -F\. '{ print NF }'`
391 AC_DEFINE_UNQUOTED(SYSTEM_DOT_MIB_LENGTH, $sysoid_len)
392 AC_MSG_RESULT(using enterprise sysOID $withval ....)
394 AC_MSG_RESULT(using default enterprise sysOID "NET-SNMP-MIB::netSnmpAgentOIDs...")
397 AC_ARG_WITH(enterprise-notification-oid,
399 --with-enterprise-notification-oid The OID used for the root of
400 enterprise specific notifications.
401 (default .1.3.6.1.4.1.2021 = "enterprise.ucdavis")],[
402 if test "$withval" = yes; then
403 AC_MSG_ERROR([ Please provide a base OID value ]);
405 notification_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'`
406 AC_DEFINE_UNQUOTED(NOTIFICATION_MIB, $notification_oid)
407 notification_dot_oid=`echo "$withval" | sed 's/^\.//'`
408 AC_DEFINE_UNQUOTED(NOTIFICATION_DOT_MIB, $notification_dot_oid)
409 notificationoid_len=`echo "$withval" | sed 's/[^\.]//g' | awk -F\. '{ print NF }'`
410 AC_DEFINE_UNQUOTED(NOTIFICATION_DOT_MIB_LENGTH, $notificationoid_len)
411 AC_MSG_RESULT(using enterprise notifications $withval)
413 AC_MSG_RESULT(using default notifications "NET-SNMP-MIB::netSnmpNotifications")
416 dnl Catch common mistakes in configure options
418 AC_ARG_WITH(mib_module,, AC_MSG_ERROR([ Invalid option. Use --with-mib-modules instead ]) )
419 AC_ARG_WITH(out_mib_module,,AC_MSG_ERROR([ Invalid option. Use --with-out-mib-modules instead ]) )
424 AC_ARG_WITH(perl-modules,
427 --with-perl-modules Install the perl modules along with the rest
428 of the net-snmp toolkit.],
431 AC_ARG_ENABLE(embedded-perl,
433 --enable-embedded-perl Embed perl in the SNMP agent.
434 [forces --with-perl-modules as well.]],
435 embed_perl="yes", embed_perl="no")
438 dnl otherwise prompted information
440 AC_ARG_WITH(defaults,
443 --with-defaults Use defaults for prompted values.],
444 defaults="yes",defaults="no")
446 AC_ARG_ENABLE(ucd-snmp-compatibility,
447 [--enable-ucd-snmp-compatibility Install ucd-snmp look-alike headers and libs.], ucd_compat=yes, ucd_compat=no)
449 dnl setup install targets
451 if test "x$ucd_compat" != "xno" ; then
452 installucdheaders=installucdheaders
453 installucdlibs=installucdlibs
454 AC_MSG_CACHE_ADD(UCD-SNMP compatability: enabled)
456 AC_SUBST(installucdheaders)
457 AC_SUBST(installucdlibs)
459 dnl Only define if specifically chosen as --without (i.e., default to true).
460 if test "x$with_root_access" = "xno"; then
461 AC_DEFINE(NO_ROOT_ACCESS)
464 dnl Only define if specifically chosen as --without (i.e., default to true).
465 if test "x$with_kmem_usage" = "xno"; then
466 AC_DEFINE(NO_KMEM_USAGE)
469 dnl Define unless specifically suppressed (i.e., option defaults to false).
470 if test "x$with_dummy_values" != "xyes"; then
471 AC_DEFINE(NO_DUMMY_VALUES)
474 dnl Only define if specifically chosen as --without (i.e., default to true).
475 if test "x$with_opaque_special_types" != "xno"; then
476 AC_DEFINE(OPAQUE_SPECIAL_TYPES)
480 dnl overflow problems with hpux's sh
481 dnl taken from Perl's Configure script
483 AC_MSG_CHECKING(if I need to feed myself to ksh)
484 if test -f /hp-ux -a -f /bin/ksh; then
485 if (PATH=.; alias -x) >/dev/null 2>&1; then
489 if test "x$1" = "x"; then
492 exec /bin/ksh $0 "$@"
499 if test "x$developer" != "xno" -a -f $srcdir/remove-files; then
500 dnl turn on the developer flag when taken from a CVS checkout (not a release)
504 dnl disable --enable-shared by default in cvs/developer cases.
505 if test "x$developer" = "xyes"; then
506 dnl don't do anything if option set via cmdline
507 if test "${enable_shared+set}" != set; then
512 dnl perl requires shared libs
513 if test "x$embed_perl" = "xyes"; then
514 if test "x$enable_shared" != "xyes"; then
515 AC_MSG_ERROR(--enable-embedded-perl requires --enable-shared)
524 dnl libtool stuff for shared/static libraries.
529 dnl Checks for programs.
533 AC_PATH_PROG(PSPROG,ps)
534 AC_PATH_PROG(PERLPROG,perl)
535 AC_CHECK_PROGS(WHOAMI, whoami logname, whoami)
536 AC_CHECK_PROGS(SED,sed gsed)
537 AC_CHECK_PROG(AUTOCONF, autoconf)
538 AC_CHECK_PROG(AUTOHEADER, autoheader)
539 if test "x$ac_cv_prog_AUTOCONF" = "x"; then
543 if test "x$ac_cv_prog_AUTOHEADER" = "x"; then
548 AC_PATH_PROG(UNAMEPROG,uname)
549 AC_DEFINE_UNQUOTED(UNAMEPROG,"$UNAMEPROG")
554 dnl get version number.
555 AC_MSG_CHECKING(for net-snmp version number)
556 VERSION=`grep NetSnmpVersionInfo.*= $srcdir/snmplib/snmp_version.c | sed 's/";.*//;s/.*"//;s/pre/0./;'`
558 RELEASEVERSION=`echo $VERSION | sed 's/^\([0-9]\)\.\([0-9]\)/\1:\2:0/'`
561 AC_SUBST(RELEASEVERSION)
562 AC_MSG_RESULT($VERSION)
563 AC_MSG_CACHE_ADD(Net-SNMP Version: $VERSION)
565 dnl super type checking
566 AC_MSG_CHECKING(for developer gcc flags)
567 if test "x$developer" = "xyes" -a "x$ac_cv_prog_gcc" = "xyes"; then
568 DEVFLAGS="-Wall -Wstrict-prototypes -Wwrite-strings -Wcast-qual -Wno-char-subscripts"
572 AC_MSG_RESULT($DEVFLAGS)
578 PARTIALTARGETOS=`echo $target_os | sed 's/[-._].*//'`
579 CFLAGS="$CFLAGS -D$PARTIALTARGETOS"
581 AC_MSG_CACHE_ADD(Building for: $PARTIALTARGETOS)
584 dnl check for special includes and pick one
587 AC_MSG_CHECKING(for system include file)
590 dnl ignore binary format indication
591 filebase=`echo $filebase | sed 's/elf//'`
592 filebase=`echo $filebase | sed 's/aout//'`
593 filebase=`echo $filebase | sed 's/ecoff//'`
594 filebase=`echo $filebase | sed 's/coff//'`
595 while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/system/$filebase.h
598 filebase=`echo $filebase | sed 's/[-._][^-._]*$//'`
599 if test "x$filebase" = "x$last"; then
600 filebase=`echo $filebase | sed 's/[0-9]*$//'`
604 if test "x$filebase" = "x$last"; then
607 ac_cv_SYSTEM_INCLUDE_FILE="net-snmp/system/$filebase.h"
610 AC_MSG_RESULT($ac_cv_SYSTEM_INCLUDE_FILE)
611 AC_DEFINE_UNQUOTED(SYSTEM_INCLUDE_FILE, "$ac_cv_SYSTEM_INCLUDE_FILE")
613 dnl second part, the CPU type.
615 AC_MSG_CHECKING(for machine-type include file)
618 while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/machine/$filebase.h
621 filebase=`echo $filebase | sed 's/[-._][^-._]*$//'`
624 if test "x$filebase" = "x$last"; then
627 ac_cv_MACHINE_INCLUDE_FILE="net-snmp/machine/$filebase.h"
630 AC_MSG_RESULT($ac_cv_MACHINE_INCLUDE_FILE)
631 AC_DEFINE_UNQUOTED(MACHINE_INCLUDE_FILE, "$ac_cv_MACHINE_INCLUDE_FILE")
633 AC_PATH_PROG(CCPATH,$CC)
634 dnl watch out for /usr/ucb/cc on solaris, it doesn't work with this package.
637 if test "x$CCPATH" = "x/usr/ucb/cc" -o "x$CCPATH" = "x/usr/bin/cc"; then
640 *** The BSDI /usr/ucb/cc compiler does not work with this package.
641 *** Please run configure with --with-cc=gcc
646 if test "x$CCPATH" = "x/usr/ucb/cc"; then
649 *** The solaris /usr/ucb/cc compiler does not work with this package.
650 *** Please put a different compiler in your path first or run
651 *** configure with --with-cc=XX, where XX is the compiler you want to use.
657 AC_MSG_CHECKING(for additional cpp flags)
658 dnl gcc extra CPPFLAGS
659 if test "x$GCC" = "xyes" -a "x$CPP" = "x$CC -E"; then
660 dnl extra cpp flags for gnu c compiler to allow .in file extensions.
666 dnl Solaris extra cpp flags.
667 if test "x$GCC" != "xyes"; then
669 solaris*) EXTRACPPFLAGS="$EXTRACPPFLAGS -Xs" ;;
673 AC_SUBST(EXTRACPPFLAGS)
674 AC_MSG_RESULT($EXTRACPPFLAGS)
676 dnl Prefixes must begin with "/"
678 if test "x$prefix" = "xNONE"; then
682 fch=`echo $prefix | sed 's/\(.\).*/\1/'`
683 if test $fch != "/" ; then
685 echo "adjusting prefix to $prefix"
688 if test "x$exec_prefix" = "xNONE"; then
692 fch=`echo $exec_prefix | sed 's/\(.\).*/\1/'`
693 if test $fch != "/" ; then
694 exec_prefix=`pwd`/$exec_prefix
695 echo "adjusting exec_prefix to $exec_prefix"
698 dnl Set SNMPLIBPATH & SNMPSHAREPATH
701 tmpset="$libdir/snmp"
702 while test "x$tmpset" != "x$SNMPLIBPATH"; do
703 SNMPLIBPATH="$tmpset"
704 eval tmpset="$tmpset"
706 AC_DEFINE_UNQUOTED(SNMPLIBPATH,"$SNMPLIBPATH")
707 AC_DEFINE_UNQUOTED(SNMPDLMODPATH,"$SNMPLIBPATH/dlmod")
710 tmpset="$datadir/snmp"
711 while test "x$tmpset" != "x$SNMPSHAREPATH"; do
712 SNMPSHAREPATH="$tmpset"
713 eval tmpset="$tmpset"
715 AC_DEFINE_UNQUOTED(SNMPSHAREPATH,"$SNMPSHAREPATH")
717 if test "x$DEFAULT_MIBDIRS" = "x"; then
718 AC_DEFINE_UNQUOTED(DEFAULT_MIBDIRS,"\$HOME/.snmp/mibs:$SNMPSHAREPATH/mibs")
722 tmpset="$sysconfdir/snmp"
723 while test "x$tmpset" != "x$SNMPCONFPATH"; do
724 SNMPCONFPATH="$tmpset"
725 eval tmpset="$tmpset"
727 AC_DEFINE_UNQUOTED(SNMPCONFPATH,"$SNMPCONFPATH")
728 AC_SUBST(SNMPCONFPATH)
730 dnl guess IPv6 stack type.
731 if test "x$enable_ipv6" = "xyes"; then
736 AC_MSG_CHECKING([ipv6 stack type])
737 for i in v6d toshiba kame inria zeta linux-glibc linux-inet6; do
740 AC_EGREP_CPP(yes, [dnl
741 #include </usr/local/v6/include/sys/types.h>
745 [v6type=$i; v6lib=v6;
746 v6libdir=/usr/local/v6/lib;
747 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
750 AC_EGREP_CPP(yes, [dnl
751 #include <sys/param.h>
752 #ifdef _TOSHIBA_INET6
755 [v6type=$i; v6lib=inet6;
756 v6libdir=/usr/local/v6/lib;
757 CFLAGS="-DINET6 $CFLAGS"])
760 AC_EGREP_CPP(yes, [dnl
761 #include <netinet/in.h>
765 [v6type=$i; v6lib=inet6;
766 v6libdir=/usr/local/v6/lib;
768 CFLAGS="-DINET6 $CFLAGS"])
771 AC_EGREP_CPP(yes, [dnl
772 #include <netinet/in.h>
773 #ifdef IPV6_INRIA_VERSION
780 CFLAGS="-DINET6 $CFLAGS"])
783 AC_EGREP_CPP(yes, [dnl
784 #include <sys/param.h>
785 #ifdef _ZETA_MINAMI_INET6
789 [v6type=$i; v6lib=inet6;
790 v6libdir=/usr/local/v6/lib;
791 CFLAGS="-DINET6 $CFLAGS"])
794 AC_EGREP_CPP(yes, [dnl
795 #include <features.h>
796 #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC_ > 2))
803 CFLAGS="-DINET6 $CFLAGS"])
806 if test -d /usr/inet6; then
809 v6libdir=/usr/inet6/lib
810 CFLAGS="-DINET6 $CFLAGS"
814 if test "$v6type" != "unknown"; then
819 if test "$v6lib" != "none"; then
820 if test -d $v6libdir -a -f $v6libdir/lib$v6lib.a; then
821 LIBS="-L$v6libdir -l$v6lib $LIBS"
823 AC_MSG_RESULT(["$v6type, $enable_ipv6, using lib$v6lib"])
824 elif test "$v6trylibc" = "yes"; then
826 AC_MSG_RESULT(["$v6type, $enable_ipv6, using libc"])
828 AC_MSG_ERROR(no IPv6 library lib$v6lib.a found.)
833 AC_MSG_RESULT(["$v6type, $enable_ipv6"])
838 dnl Maybe add library extensions for thread mutex locking.
841 if test "x$with_res_locks" = "xyes"; then
842 AC_DEFINE(NS_REENTRANT)
848 CC_RUNTIME_ARG="$CC_RUNTIME_ARG -lpthreads"
857 AC_MSG_CHECKING(whether we have to build PIC code)
858 echo "$with_mib_modules" | grep "ucd-snmp/dlmod" >/dev/null
859 if test $? -eq 0 ; then
861 LIB_CFLAGS="$LIB_CFLAGS $SHLIB_CFLAGS"
869 dnl Do transport module processing.
871 AC_MSG_CHECKING(for and configuring transport modules to use)
872 transport_src_list=""
873 transport_hdr_list=""
874 transport_def_list=""
875 transport_result_list=""
876 transport_add_list=""
877 new_with_transport_list=`echo $with_transports | sed 's/,/ /g;'`
878 new_with_out_transport_list=`echo $with_out_transports | sed 's/,/ /g;'`
881 dnl Add the default transports to the list
883 if test "x$PARTIALTARGETOS" = "xcygwin"; then
884 transport_default_list="UDP TCP Callback"
886 transport_default_list="UDP TCP Unix Callback"
888 if test "x$enable_ipv6" = "xyes"; then
889 transport_default_list="UDPIPv6 TCPIPv6 $transport_default_list"
891 for i in $transport_default_list; do
892 if echo " $new_with_transport_list " | grep " $i " >/dev/null; then
895 transport_add_list="$i $transport_add_list"
898 new_transport_list="$transport_add_list $new_with_transport_list"
900 for i in $new_transport_list; do
901 if echo " $new_with_out_transport_list " | grep " $i " >/dev/null; then
902 if test "x$i" = "xUDP"; then
904 AC_MSG_ERROR(It is not possible to compile without UDP/IP support.)
907 if test "x$i" = "xAAL5PVC"; then
908 if test "x$PARTIALTARGETOS" != "xlinux"; then
910 AC_MSG_ERROR(AAL5 PVC support unavailable for this platform (Linux only))
913 if test "x$i" = "xIPX"; then
914 if test "x$PARTIALTARGETOS" != "xlinux"; then
916 AC_MSG_ERROR(IPX support unavailable for this platform (Linux only))
919 if test "x$i" = "xUnix"; then
920 if test "x$PARTIALTARGETOS" = "xcygwin"; then
922 AC_MSG_ERROR(Unix domain protocol support unavailable for this platform)
925 transport_src="snmp"$i"Domain.c"
926 transport_hdr="snmp"$i"Domain.h"
927 rel_transport_src="snmplib/"$transport_src
928 rel_transport_hdr="include/net-snmp/library/"$transport_hdr
929 if test -f "$srcdir/$rel_transport_src"; then
930 transport_result_list="$transport_result_list $i"
931 transport_src_list="$transport_src $transport_src_list"
932 if test -f "$srcdir/$rel_transport_hdr"; then
933 transport_hdr_list="$transport_hdr $transport_hdr_list"
935 transport_def=`echo $i | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
936 transport_def_list="SNMP_TRANSPORT_"$transport_def"_DOMAIN $transport_def_list"
939 AC_MSG_ERROR(Cannot find file $transport_src to support SNMP transport domain $i.)
943 transport_obj_list=`echo " $transport_src_list " | sed 's/\.c/\.o/g'`
944 transport_lobj_list=`echo " $transport_src_list " | sed 's/\.c/\.lo/g'`
945 AC_SUBST(transport_hdr_list)
946 AC_SUBST(transport_src_list)
947 AC_SUBST(transport_obj_list)
948 AC_SUBST(transport_lobj_list)
949 for i in $transport_def_list; do
950 AC_DEFINE_UNQUOTED($i)
952 AC_MSG_RESULT($transport_result_list.)
953 AC_MSG_CACHE_ADD(Network transport support: $transport_result_list)
956 dnl Security modules to use
959 AC_MSG_CHECKING(for security modules to use)
960 security_def_list="usm"
963 security_lobj_list=""
964 security_init_file="snmplib/snmpsm_init.h"
965 security_incl_file="include/net-snmp/library/snmpv3-security-includes.h"
966 new_with_security=`echo $with_security_modules | sed 's/,/ /g;'`
967 new_with_out_security=`echo $with_out_security_modules | sed 's/,/ /g;'`
969 if test ! -d include; then
972 if test ! -d include/net-snmp; then
973 mkdir include/net-snmp
975 if test ! -d include/net-snmp/agent; then
976 mkdir include/net-snmp/agent
978 if test ! -d include/net-snmp/library; then
979 mkdir include/net-snmp/library
981 if test ! -d include/ucd-snmp; then
982 mkdir include/ucd-snmp
985 if test ! -d snmplib; then
988 echo "/* This file is automatically generated by configure. Do not modify by hand. */" > $security_init_file
989 echo "/* This file is automatically generated by configure. Do not modify by hand. */" > $security_incl_file
991 for i in $security_def_list; do
992 if echo " $new_with_out_security " | grep " $i " > /dev/null; then
993 if test "x$i" = "xusm"; then
995 AC_MSG_ERROR(The USM security module is mandatory)
998 new_with_security="$new_with_security $i"
1002 for i in $new_with_security; do
1006 # make sure support exists for it
1007 if test -f $srcdir"/snmplib/"$cfile -a -f $srcdir"/include/net-snmp/library/"$hfile; then
1011 AC_MSG_ERROR(No such security module: $i / $cfile / $hfile)
1014 # define a bunch of stuff to enable it
1015 security_src_list="$security_src_list $cfile"
1016 security_hdr_list="$security_hdr_list $hfile"
1017 security_obj_list="$security_obj_list snmp"$i".o"
1018 security_lobj_list="$security_lobj_list snmp"$i".lo"
1019 def_name="SNMP_SECMOD_"`echo $i | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1020 echo "init_"$i"();" >> $security_init_file
1021 echo "#include <net-snmp/library/$hfile>" >> $security_incl_file
1022 AC_DEFINE_UNQUOTED($def_name)
1025 AC_SUBST(security_src_list)
1026 AC_SUBST(security_obj_list)
1027 AC_SUBST(security_lobj_list)
1028 AC_SUBST(security_hdr_list)
1029 AC_MSG_RESULT($new_with_security)
1030 AC_MSG_CACHE_ADD(SNMPv3 Security Modules: $new_with_security)
1033 dnl Handle the special case of KSM to see which crypto API we support
1036 for sec in $new_with_security
1038 if test x$sec = xksm; then
1039 AC_MSG_CHECKING(to see which crypto API we need to use)
1041 AC_CHECK_FUNC(krb5_c_encrypt,[
1042 AC_MSG_RESULT(new MIT crypto API)
1043 AC_DEFINE(MIT_NEW_CRYPTO)],[
1044 AC_MSG_RESULT(old MIT crypto API)])
1049 dnl Do hairy agent module processing.
1051 AC_MSG_CHECKING(for and configuring mib modules to use)
1054 mibdir="agent/mibgroup"
1057 new_with_mib_modules=`echo $with_mib_modules | sed 's/,/ /g;'`
1058 new_with_out_mib_modules=`echo $with_out_mib_modules | sed 's/,/ /g;'`
1059 new_module_list="mibII ucd_snmp snmpv3mibs notification target agent_mibs agentx agent_mibs utilities $new_with_mib_modules"
1060 default_mibs=IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB:NOTIFICATION-LOG-MIB
1062 if test "x$mini_agent" = "xyes"; then
1063 new_with_out_mib_modules="mibII $new_with_out_mib_modules"
1064 new_module_list="snmpv3mibs mibII/snmp_mib mibII/system_mib mibII/sysORTable mibII/vacm_vars $new_with_mib_modules"
1065 default_mibs=SNMPv2-MIB:RFC1213-MIB
1066 default_mibs_install=" "
1070 if test "x$enable_ipv6" = "xyes"; then
1071 new_module_list="$new_module_list mibII/ipv6"
1074 dnl Create include file list for snmp_vars.h to use.
1075 if test ! -d agent; then
1078 if test ! -d agent/mibgroup; then
1079 mkdir agent/mibgroup
1081 for i in $mibdir/mib_module_includes.h $mibdir/mib_module_inits.h $mibdir/mib_module_shutdown.h include/net-snmp/agent/mib_module_config.h $mibdir/mib_module_dot_conf.h; do
1083 echo "/* This file is automatically generated by configure. Do not modify by hand. */" > $i
1086 test_modules="$new_module_list"
1090 for i in $test_modules
1092 if echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
1095 new_module_list="$new_module_list $i"
1100 AC_MSG_RESULT($new_module_list.)
1101 AC_MSG_CACHE_ADD(Agent MIB code: $new_module_list)
1103 AC_MSG_CHECKING(for and configuring mib modules pieces to use)
1107 while test "x$new_module_list" != "x"; do
1108 for i in $new_module_list
1110 if echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
1113 if test -f $srcdir/$mibdir/$i.h; then
1115 new_list_arch=`grep config_arch_require $srcdir/$mibdir/$i.h | sed 's/.*config_arch_require(\(.*\), *\(.*\)).*/\1-xarchx-\2/'`
1116 if test "x$new_list_arch" != "x"; then
1117 for j in $new_list_arch
1119 archtest=`echo $j | sed 's/-xarchx-.*//'`
1120 if test "x$target_os" = "x$archtest" -o "x$PARTIALTARGETOS" = "x$archtest"; then
1121 new_list="$new_list `echo $j | sed 's/.*-xarchx-//'`"
1125 new_list="$new_list `grep config_require $srcdir/$mibdir/$i.h | sed 's/.*config_require(\(.*\)).*/\1/'`"
1126 if test "x$new_list" != "x"; then
1129 if test ! -f $srcdir/$mibdir/$j.h; then
1131 AC_MSG_ERROR(mib module "$i" requires module "$j" but $j.h or $j.c could not be found in $srcdir/$mibdir)
1133 elif echo " $new_with_out_mib_modules " | grep " $j " > /dev/null; then
1135 AC_MSG_WARN(mib module "$i" requires module "$j" but you told me to compile without it)
1137 elif echo " $module_list $new_list_two $new_module_list " | grep " $j " > /dev/null; then
1140 new_list_two="$new_list_two $j"
1144 new_mibs=`grep config_add_mib $srcdir/$mibdir/$i.h | sed 's/.*config_add_mib(\(.*\)).*/\1/'`
1145 if test "x$new_mibs" != "x"; then
1148 if test "x`echo :$default_mibs: | grep :$j:`" = "x"; then
1149 default_mibs="$default_mibs:$j"
1151 if test -f $srcdir/mibs/$j.txt; then
1152 if echo $default_mibs_install | grep " $j " > /dev/null; then
1155 default_mibs_install="$default_mibs_install $j.txt"
1162 AC_MSG_ERROR(module files $i.h or $i.c could not be found in $srcdir/$mibdir)
1165 module_list="$module_list $i"
1166 echo '#include "'"mibgroup/$i.h"'"' >> $mibdir/mib_module_includes.h
1167 module_list_h="$module_list_h mibgroup/$i.h"
1168 if test -f $srcdir/$mibdir/$i.c; then
1169 module_list_code="$module_list_code $i"
1170 mnm=`echo $i | sed 's/.*\///;s/\.c$//;'`
1171 temp_init=`grep init_$mnm $srcdir/$mibdir/$i.c | grep -v _init_$mnm`
1172 if test "x$temp_init" != "x"; then
1173 echo " if (should_init(\"$mnm\")) init_$mnm();" >> $mibdir/mib_module_inits.h
1175 if grep shutdown_`basename $i` $srcdir/$mibdir/$i.c > /dev/null; then
1176 echo " if (should_init(\"`basename $i`\")) shutdown_`basename $i`();" >> $mibdir/mib_module_shutdown.h
1179 if test "x`echo $i | sed 's/\///g;'`" != "x$i"; then
1180 mnd=`echo $i | sed 's/\/[^/]*$//;'`
1181 if test ! -d ./$mibdir/$mnd; then
1182 module_directories="$module_directories ./$mibdir/$mnd"
1185 if grep config_load_mib $srcdir/$mibdir/$i.h > /dev/null 2>&1; then
1187 AC_MSG_WARN(mib module "$i" uses the "config_load_mib" directive, which is no longer supported. It probably won't work.)
1190 grep config_parse_dot_conf $srcdir/$mibdir/$i.h | sed 's@.*config_parse_dot_conf(\([^)]*\), *\([^),]*\), *\([^),]*\), *\([^),]*\)).*@register_config_handler("snmpd",\1, \2, \3, \4);@' >> $mibdir/mib_module_dot_conf.h
1191 sym="`echo ${i} | sed 's/[^a-zA-Z0-9_]/_/g' | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`"
1192 echo "/* Define if compiling with the ${i} module files. */" >> include/net-snmp/agent/mib_module_config.h
1193 echo "#define USING_${sym}_MODULE 1" >> include/net-snmp/agent/mib_module_config.h
1194 echo " " >> include/net-snmp/agent/mib_module_config.h
1195 echo $ac_n " $i$ac_c" >&$FD
1198 new_module_list="$new_list_two"
1201 module_list_o=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.o /g'`
1202 module_list_lo=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.lo /g'`
1203 module_list_c=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.c /g'`
1204 mibgroup_list_o=`echo " $module_list_o " | sed 's@ \([^ ]*\)\.o@ mibgroup/\1.o @g'`
1205 mibgroup_list_lo=`echo " $module_list_lo " | sed 's@ \([^ ]*\)\.lo@ mibgroup/\1.lo @g'`
1207 MODULE_LIST=$module_list_code
1208 AC_SUBST(MODULE_LIST)
1209 AC_SUBST(module_list_c)
1210 AC_SUBST(module_list_h)
1211 AC_SUBST(module_list_o)
1212 AC_SUBST(module_list_lo)
1213 AC_SUBST(mibgroup_list_o)
1214 AC_SUBST(mibgroup_list_lo)
1215 AC_SUBST(module_list)
1216 AC_SUBST(default_mibs_install)
1220 AC_MSG_CHECKING(if directories need to be created)
1221 for i in $module_directories; do
1222 $srcdir/mkinstalldirs $i
1226 AC_MSG_CHECKING(default mib files to read)
1227 if test "x$DEFAULT_MIBS" = "x"; then
1228 DEFAULT_MIBS="$default_mibs"
1230 AC_DEFINE_UNQUOTED(DEFAULT_MIBS,"$DEFAULT_MIBS")
1231 AC_MSG_RESULT($DEFAULT_MIBS)
1234 dnl Check for kernel location
1237 AC_CACHE_CHECK(for location of system kernel,ac_cv_KERNEL_LOC,
1238 [ac_cv_KERNEL_LOC="unknown"
1239 dnl First determine if test expects a -f or a -c (character device (SYSV))
1241 if test -c /dev/null; then
1243 elif test -f /dev/null; then
1249 for i in /vmunix /hp-ux /stand/vmunix /dev/ksyms /kernel/unix /kernel/genunix /netbsd /unix /kernel /bsd /mach_kernel
1251 if test -f $i -o $CFLAG $i; then
1252 ac_cv_KERNEL_LOC="$i"
1256 if test $i = "unknown"; then
1257 AC_MSG_WARN(Can't find system kernel... Setting to /vmunix)
1258 ac_cv_KERNEL_LOC="/vmunix"
1262 AC_DEFINE_UNQUOTED(KERNEL_LOC,"$ac_cv_KERNEL_LOC")
1265 dnl Check for mount table location
1268 AC_CACHE_CHECK(for mount table location,ac_cv_ETC_MNTTAB,
1269 [ac_cv_ETC_MNTTAB="unknown"
1270 for i in /etc/mnttab /etc/mtab /etc/filesystems
1273 ac_cv_ETC_MNTTAB="$i"
1279 AC_DEFINE_UNQUOTED(ETC_MNTTAB,"$ac_cv_ETC_MNTTAB")
1281 dnl Check for /dev/dmem or /dev/drum location
1282 AC_CACHE_CHECK(for location of swap device,ac_cv_DMEM_LOC,
1284 dnl First determine if test expects a -f or a -c (character device (SYSV))
1286 if test -f /dev/kmem; then
1288 elif test -c /dev/kmem; then
1295 if $CTEST /dev/dmem; then
1296 ac_cv_DMEM_LOC="/dev/dmem"
1297 elif $CTEST /dev/drum; then
1298 ac_cv_DMEM_LOC="/dev/drum"
1300 ac_cv_DMEM_LOC="none"
1304 if test "x$ac_cv_DMEM_LOC" != "xnone"; then
1305 AC_DEFINE_UNQUOTED(DMEM_LOC,"$ac_cv_DMEM_LOC")
1308 dnl forced efence turned off.
1309 dnl if test "x$developer" = "xyes" -a "x$use_efence" != "xno"; then
1310 dnl use_efence="yes"
1313 if test "x$use_efence" = "xyes"; then
1314 AC_CHECK_LIB(efence, EF_Exit)
1317 dnl Checks for libraries.
1318 dnl AC_CHECK_LIB(des, main)
1319 AC_CHECK_LIB(m, asin)
1320 dnl nlist is needed for uptime on some sytems in the generic library
1321 AC_CHECK_LIB(elf, nlist)
1323 dnl On some platforms (Irix) libnsl and libsocket should not be used.
1324 AC_CHECK_FUNC(gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME),
1325 AC_CHECK_LIB(nsl, gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME)
1326 LIBS="${LIBS} -lnsl"))
1327 AC_CHECK_FUNC(getservbyname, AC_DEFINE(HAVE_GETSERVBYNAME),
1328 AC_CHECK_LIB(socket, getservbyname, AC_DEFINE(HAVE_GETSERVBYNAME)
1329 LIBS="${LIBS} -lsocket"))
1331 dnl Replace `main' with a function in -lkstat:
1332 AC_CHECK_LIB(kstat, kstat_lookup)
1333 dnl Check for nlist in mld (irix)
1334 AC_CHECK_LIB(mld, nlist)
1336 dnl Check for security related functions
1337 if test "x$tryopenssl" != "xno"; then
1338 if test "x$tryrsaref" != "xno"; then
1339 AC_CHECK_LIB(rsaref, RSAPrivateDecrypt)
1340 AC_CHECK_LIB(RSAglue, RSA_PKCS1_RSAref)
1343 AC_CHECK_LIB(crypto, EVP_md5)
1344 AC_CHECK_FUNCS(AES_cfb128_encrypt)
1347 dnl Check for libraries that the agent needs
1348 dnl saving old libraries
1351 dnl check for tcp wrapper support
1352 _cppflags="${CPPFLAGS}"
1353 _ldflags="${LDFLAGS}"
1355 AC_ARG_WITH(libwrap,
1356 [ --with-libwrap[=LIBPATH] Compile in libwrap (tcp_wrappers) support.],[
1357 if test "$with_libwrap" != "no"; then
1358 if test "$with_libwrap" != "yes"; then
1359 CPPFLAGS="${CPPFLAGS} -I$with_libwrap/include"
1360 LDFLAGS="${LDFLAGS} -L$with_libwrap/lib"
1364 AC_CHECK_HEADER(tcpd.h, ,
1365 AC_MSG_ERROR(Asked to use libwrap but I couldn't find tcpd.h.))
1368 AC_MSG_CHECKING(for TCP wrappers library -lwrap)
1369 AC_TRY_LINK([#include <tcpd.h>
1370 int allow_severity = 0;
1371 int deny_severity = 0;
1372 ],[hosts_access((void *)0)],
1375 AC_DEFINE(USE_LIBWRAP)
1376 test "$with_libwrap" != no -a "$with_libwrap" != yes && WRAPLIBS="-L$with_libwrap/lib"
1377 WRAPLIBS="$WRAPLIBS -lwrap"],
1380 dnl Linux RedHat 6.1 won't link libwrap without libnsl
1381 AC_CHECK_FUNC(yp_get_default_domain, ,
1382 AC_CHECK_LIB(nsl, yp_get_default_domain))
1383 AC_MSG_CHECKING(for TCP wrappers library -lwrap linked with -lnsl)
1384 AC_TRY_LINK([#include <tcpd.h>
1385 int allow_severity = 0;
1386 int deny_severity = 0;
1387 ],[hosts_access((void *)0)],
1390 AC_DEFINE(USE_LIBWRAP)
1391 test "$with_libwrap" != no -a "$with_libwrap" != yes && WRAPLIBS="-L$with_libwrap/lib"
1392 WRAPLIBS="$WRAPLIBS -lwrap -lnsl",
1395 AC_MSG_ERROR(Asked to use libwrap but I couldn't find it.))
1397 CPPFLAGS=${_cppflags}
1404 dnl rpm libraries only needed for the host resources mib software
1405 dnl installed tables (on linux in particular)
1407 if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
1408 dnl ARG. RPM is a real pain.
1409 dnl FWIW librpm.la, librpmio.la, and libpopt.la have correct dependencies.
1412 dnl zlib is required for newer versions of rpm
1413 _cppflags="${CPPFLAGS}"
1414 _ldflags="${LDFLAGS}"
1417 [ --with-zlib[=DIR] use libz in DIR],[
1418 if test -d "$withval"; then
1419 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1420 LDFLAGS="${LDFLAGS} -L$withval/lib"
1424 dnl dunno if this is needed for rpm-4.0.x, earlier probably needs.
1425 AC_CHECK_HEADER(zlib.h,
1426 AC_CHECK_LIB(z, gzread, , CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1427 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
1429 dnl two variants of bzip2 need checking.
1430 AC_CHECK_LIB(bz2, bzread, [_rpmlibs="$_rpmlibs -lbz2"],
1431 AC_CHECK_LIB(bz2, BZ2_bzread, [_rpmlibs="$_rpmlibs -lbz2"],))
1433 dnl two variants of db1 need checking.
1434 AC_CHECK_LIB(db1, dbopen, [_rpmlibs="-ldb1 $_rpmlibs"],
1435 AC_CHECK_LIB(db, dbopen, [_rpmlibs="-ldb $_rpmlibs"]))
1437 dnl two variants of db3 need checking.
1438 AC_CHECK_LIB(db-3.1, db_create, [_rpmlibs="-ldb-3.1 $_rpmlibs"],
1439 AC_CHECK_LIB(db-3.0, db_create, [_rpmlibs="-ldb-3.0 $_rpmlibs"]))
1441 dnl rpm-3.0.5 and later needs popt.
1442 AC_CHECK_LIB(popt, poptParseArgvString, [_rpmlibs="-lpopt $_rpmlibs"])
1444 dnl rpm-4.0.x needs rpmio.
1445 AC_CHECK_LIB(rpmio, Fopen, [_rpmlibs="-lrpmio $_rpmlibs"],,$_rpmlibs)
1447 dnl now check for rpm using the appropriate libraries.
1448 AC_CHECK_LIB(rpm, rpmGetFilesystemList,[
1449 AC_DEFINE(HAVE_LIBRPM)
1450 LIBS="-lrpm $_rpmlibs $LIBS"
1451 CFLAGS="$CFLAGS -I/usr/include/rpm"
1453 dnl rpm-4.0.3 librpmdb actually contains what we need.
1454 AC_CHECK_LIB(rpmdb, rpmdbOpen,[
1455 AC_DEFINE(HAVE_LIBRPM)
1456 LIBS="-lrpmdb -lrpm $_rpmlibs $LIBS"
1457 CFLAGS="$CFLAGS -I/usr/include/rpm"
1462 dnl Replace `main' with a function in -lkvm:
1463 AC_CHECK_LIB(kvm, kvm_read)
1464 dnl DYNAMIC MODULE SUPPORT
1465 AC_CHECK_LIB(dl, dlopen)
1466 AC_CHECK_FUNCS(dlopen)
1468 AC_CHECK_FUNCS(kvm_openfiles nlist knlist kvm_getprocs)
1469 echo "$with_mib_modules" | grep "ucd-snmp/diskio" >/dev/null
1470 dnl whether we need -ldevstat for diskio MIB
1471 if test $? -eq 0 ; then
1472 AC_CHECK_FUNC(getdevs, AC_DEFINE(HAVE_GETDEVS),
1473 AC_CHECK_LIB(devstat, getdevs, AC_DEFINE(HAVE_GETDEVS)
1474 LIBS="${LIBS} -ldevstat"))
1479 dnl Install the various perl modules
1482 if test "x$install_perl" = "xyes" -o "x$embed_perl" = "xyes"; then
1483 PERLTARGS="perlmodules"
1484 PERLINSTALLTARGS="perlinstall"
1486 AC_SUBST(PERLINSTALLTARGS)
1487 AC_MSG_CACHE_ADD(SNMP Perl modules: enabled)
1491 dnl Embedded Perl specific stuff
1493 if test "x$embed_perl" = "xyes"; then
1494 myperl=$ac_cv_path_PERLPROG
1495 if test $myperl = "no"; then
1496 AC_MSG_ERROR(--enable-embedded-perl requested but no perl executable found)
1499 AC_MSG_CHECKING(for perl CFLAGS)
1500 perlcflags=`$myperl -MExtUtils::Embed -e ccopts`
1501 AC_MSG_RESULT($perlcflags)
1502 CPPFLAGS="$CPPFLAGS $perlcflags"
1504 AC_MSG_CHECKING(for perl LDFLAGS)
1505 perlldopts=`$myperl -MExtUtils::Embed -e ldopts`
1506 AC_MSG_RESULT($perlldopts)
1507 LIBS="$LIBS $perlldopts"
1509 dnl newer perl vs older perl call functions
1510 AC_CHECK_FUNCS(eval_pv perl_eval_pv)
1512 AC_DEFINE(NETSNMP_EMBEDDED_PERL)
1513 OTHERAGENTLIBOBJS="snmp_perl.o"
1514 OTHERAGENTLIBLOBJS="snmp_perl.lo"
1516 EMBEDPERLINSTALL="embedperlinstall"
1517 AC_SUBST(EMBEDPERLINSTALL)
1518 AC_MSG_CACHE_ADD(Embedded perl support: enabled)
1525 dnl Checks for header files.
1529 AC_CHECK_HEADERS(stdarg.h string.h fcntl.h limits.h sys/file.h sys/ioctl.h syslog.h unistd.h netinet/tcpip.h netinet/in.h netinet/ip.h netinet/ip_icmp.h net/if.h netdb.h sys/dmap.h machine/pte.h xti.h sys/sockio.h sys/socket.h sys/un.h fstab.h sys/fs.h mtab.h ufs/fs.h ufs/ffs/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/mbuf.h sys/time.h sys/swap.h inet/mib2.h sys/statvfs.h sys/vfs.h sys/mnttab.h sys/user.h sys/proc.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)
1530 dnl FreeBSD required headers
1531 AC_CHECK_HEADERS(malloc.h sys/param.h net/if_dl.h sys/sysctl.h stdlib.h net/if_mib.h net/if_types.h net/if_var.h sys/queue.h osreldate.h machine/types.h sys/socketvar.h)
1533 AC_CHECK_HEADERS(sys/conf.h netinet/in_systm.h netinet/tcp.h netinet/udp.h netinet/in_var.h netinet/if_ether.h netinet/ip_var.h netinet/tcp_timer.h netinet/tcp_var.h netinet/tcp_fsm.h netinet/udp_var.h netinet/icmp_var.h sys/protosw.h nlist.h ioctls.h asm/page.h netipx/ipx.h)
1534 dnl NetBSD required headers
1535 AC_CHECK_HEADERS(arpa/inet.h kvm.h sys/pool.h uvm/uvm_param.h uvm/uvm_extern.h vm/vm_param.h vm/vm_extern.h)
1537 AC_CHECK_HEADERS(sys/mount.h vm/swap_pager.h ufs/ufs/dinode.h)
1539 AC_CHECK_HEADERS(sys/stat.h sys/vnode.h ufs/ufs/quota.h ufs/ufs/inode.h)
1541 AC_CHECK_HEADERS(sys/hashing.h sys/tcpipstats.h sys/sysmp.h)
1543 AC_CHECK_HEADERS(err.h sys/filio.h sgtty.h)
1544 dnl AIX needs this for statfs func
1545 AC_CHECK_HEADERS(sys/statfs.h)
1547 AC_CHECK_HEADERS(net/route.h)
1548 dnl for HostRes (HP-UX at least)
1549 AC_CHECK_HEADERS(sys/dkio.h sys/diskio.h sys/pstat.h linux/hdreg.h pkglocs.h)
1550 dnl for HostRes (Solaris 2.x at least)
1551 AC_CHECK_HEADERS(pkginfo.h,
1552 AC_CHECK_LIB(adm, pkginfo, AC_DEFINE(HAVE_PKGINFO)
1553 LIBS="${LIBS} -ladm"
1554 AGENTLIBS="${AGENTLIBS} -ladm"))
1556 AC_CHECK_HEADERS(winsock.h, AGENTLIBS="${AGENTLIBS} -liphlpapi")
1557 AC_CHECK_HEADERS(io.h)
1559 AC_CHECK_HEADERS(sys/stream.h)
1561 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)
1562 dnl DYNAMIC MODULE SUPPORT
1563 AC_CHECK_HEADERS(dlfcn.h)
1564 dnl table_array helper support
1565 AC_CHECK_HEADERS(search.h)
1567 dnl RPM subdirectory path (sigh)
1568 if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
1569 AC_CHECK_HEADERS(rpmio.h,, [
1570 AC_CHECK_HEADERS(rpm/rpmio.h, CFLAGS="-I/usr/include/rpm $CFLAGS")
1574 dnl OpenBSD 2.6 needs netinet/in.h before netinet/in_pcb.h
1575 AC_MSG_CHECKING([for netinet/in_pcb.h])
1576 AC_CACHE_VAL(cv_have_netinet_in_pcb_h,
1578 #include <netinet/in.h>
1579 #include <netinet/in_pcb.h>
1580 ], cv_have_netinet_in_pcb_h=yes, cv_have_netinet_in_pcb_h=no)])
1581 AC_MSG_RESULT($cv_have_netinet_in_pcb_h)
1582 if test $cv_have_netinet_in_pcb_h = yes; then
1583 AC_DEFINE(HAVE_NETINET_IN_PCB_H)
1586 dnl NetBSD needs machine/types.h before sys/disklabel.h
1587 AC_MSG_CHECKING([for sys/disklabel.h])
1588 AC_CACHE_VAL(cv_have_sys_disklabel_h,
1590 #include <machine/types.h>
1591 #include <sys/disklabel.h>
1592 ], cv_have_sys_disklabel_h=yes, cv_have_sys_disklabel_h=no)])
1593 AC_MSG_RESULT($cv_have_sys_disklabel_h)
1594 if test $cv_have_sys_disklabel_h = yes; then
1595 AC_DEFINE(HAVE_SYS_DISKLABEL_H)
1599 AC_CHECK_HEADERS(openssl/hmac.h openssl/evp.h openssl/aes.h openssl/des.h)
1602 AC_PATH_PROG(LPSTAT_PATH,lpstat)
1603 if test x$LPSTAT_PATH != x; then
1604 AC_DEFINE_UNQUOTED(LPSTAT_PATH,"$LPSTAT_PATH")
1605 AC_DEFINE(HAVE_LPSTAT)
1607 AC_CHECK_FUNCS(cgetnext)
1608 if test -r /etc/printcap; then
1609 AC_DEFINE(HAVE_PRINTCAP)
1612 AC_MSG_CHECKING(for authentication support)
1613 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
1614 dnl if OpenSSL is not found, default to using internal md5 support.
1615 AC_DEFINE(USE_INTERNAL_MD5)
1618 AC_MSG_RESULT(Internal MD5 Support)
1619 if test "x$askedopenssl" = "xyes"; then
1620 AC_MSG_ERROR(Asked to use OpenSSL but I couldn't find it.)
1623 if test "x$tryopenssl" = "xno"; then
1626 AC_DEFINE(USE_INTERNAL_MD5)
1627 AC_MSG_RESULT(Internal MD5 Support)
1629 authmodes="MD5 SHA1"
1630 if test $ac_cv_header_openssl_aes_h = "yes" ; then
1631 encrmodes="DES AES128 AES192 AES256"
1635 AC_DEFINE(USE_OPENSSL)
1636 AC_MSG_RESULT(OpenSSL Support)
1640 AC_MSG_CACHE_ADD(Authentication support: $authmodes)
1641 AC_MSG_CACHE_ADD(Encryption support: $encrmodes)
1643 dnl Checks for typedefs, structures, and compiler characteristics.
1648 dnl this should use AC_CHECK_TYPE, but it's broken at least in 2.13-14
1649 dnl so we do it by hand.
1650 AC_MSG_CHECKING(for socklen_t)
1651 AC_CACHE_VAL(ac_cv_type_$1,
1653 changequote(<<,>>)dnl
1654 <<socklen_t[^a-zA-Z_0-9]>>dnl
1655 changequote([,]), [#include <sys/types.h>
1660 #ifdef HAVE_SYS_SOCKET_H
1661 #include <sys/socket.h>
1662 #endif], ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no)])dnl
1664 AC_MSG_RESULT($ac_cv_type_socklen_t)
1665 if test $ac_cv_type_socklen_t = yes; then
1666 AC_DEFINE(HAVE_SOCKLEN_T)
1669 dnl AIX keeps in_addr_t in /usr/include/netinet/in.h
1670 AC_MSG_CHECKING(for in_addr_t)
1671 AC_CACHE_VAL(ac_cv_type_$1,
1673 changequote(<<,>>)dnl
1674 <<in_addr_t[^a-zA-Z_0-9]>>dnl
1675 changequote([,]), [#include <sys/types.h>
1680 #ifdef HAVE_NETINET_IN_H
1681 #include <netinet/in.h>
1682 #endif], ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)])dnl
1684 AC_MSG_RESULT($ac_cv_type_in_addr_t)
1685 if test $ac_cv_type_in_addr_t = yes; then
1686 AC_DEFINE(HAVE_IN_ADDR_T)
1690 AC_CACHE_CHECK(for correct flags to ps, ac_cv_ps_flags,
1691 [if test "`($PSPROG -e 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
1693 elif test "`($PSPROG -el 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
1694 ac_cv_ps_flags="-el"
1695 elif test "`($PSPROG acx 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
1696 ac_cv_ps_flags="acx"
1697 elif test "`($PSPROG -acx 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
1698 ac_cv_ps_flags="-acx"
1699 elif test "`($PSPROG -o pid,tt,state,time,ucomm 2>&1) | egrep ' ps *$' | awk '{print $NF}'`" = "ps" ; then
1700 ac_cv_ps_flags="-o pid,tt,state,time,ucomm"
1701 elif test "`($PSPROG ax 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
1704 AC_MSG_WARN(Unable to determine valid ps flags... defaulting...)
1705 ac_cv_ps_flags="-acx"
1709 PSCMD="$PSPROG $ac_cv_ps_flags"
1711 AC_DEFINE_UNQUOTED(PSCMD, "$PSPROG $ac_cv_ps_flags")
1713 dnl Checks for byte order
1714 if test $cross_compiling = yes; then
1715 if test $with_endianness = "big"; then
1716 AC_DEFINE(WORDS_BIGENDIAN)
1717 elif test -z $with_endianness; then
1718 AC_MSG_ERROR([You are cross-compiling, but you have not specified the target's endianness])
1721 if test $with_endianness; then
1722 AC_MSG_ERROR([Endianness has been specified, but you are not cross-compiling.])
1727 dnl Checks for library functions.
1729 AC_PROG_GCC_TRADITIONAL
1733 AC_CHECK_FUNCS(setmntent gethostname uname gettimeofday select socket strtol strtoul)
1734 AC_CHECK_FUNCS(strchr strdup memcpy memmove index bcopy strcasestr regcomp)
1735 AC_CHECK_FUNCS(signal setsid sigset sigblock sighold strerror setenv vsnprintf snprintf)
1736 AC_CHECK_FUNCS(sigaction)
1737 AC_CHECK_FUNCS(snprintf strtoul)
1738 AC_CHECK_FUNCS(random lrand48 rand)
1739 AC_CHECK_FUNCS(execv system fork getpid strncasecmp sigalrm)
1740 if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
1743 AC_CHECK_FUNCS(rpmGetPath)
1747 AC_CHECK_FUNCS(getloadavg)
1748 AC_CHECK_FUNCS(getaddrinfo getipnodebyname)
1749 dnl BSDi2 functions differ
1750 AC_CHECK_FUNCS(statvfs statfs)
1751 AC_CHECK_FUNCS(getdtablesize)
1753 AC_CHECK_FUNCS(getfsstat)
1754 AC_CHECK_FUNCS(usleep)
1755 AC_CHECK_FUNCS(setlocale)
1756 AC_CHECK_FUNCS(tcgetattr)
1757 AC_CHECK_FUNCS(if_nameindex if_freenameindex)
1759 AC_CHECK_FUNCS(getpagesize)
1760 AC_CHECK_FUNCS(mkstemp)
1761 AC_CHECK_FUNCS(getpwnam getgrnam setgid setuid setgroups)
1762 dnl High resolution alarm support
1763 AC_CHECK_FUNCS(setitimer)
1765 AC_MSG_CHECKING([for SIOCGIFADDR in sys/ioctl.h])
1766 AC_CACHE_VAL(cv_sys_ioctl_h_has_SIOCGIFADDR,
1767 [ AC_EGREP_CPP(xxxyesxxx,
1769 #ifdef HAVE_SYS_IOCTL_H
1770 #include <sys/ioctl.h>
1775 ], cv_sys_ioctl_h_has_SIOCGIFADDR=yes, cv_sys_ioctl_h_has_SIOCGIFADDR=no)])
1776 AC_MSG_RESULT($cv_sys_ioctl_h_has_SIOCGIFADDR)
1777 if test $cv_sys_ioctl_h_has_SIOCGIFADDR = yes; then
1778 AC_DEFINE(SYS_IOCTL_H_HAS_SIOCGIFADDR)
1782 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
1783 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
1785 #ifdef HAVE_SYS_PARAM_H
1786 #include <sys/param.h>
1788 #include <sys/types.h>
1789 #ifdef HAVE_SYS_MOUNT_H
1790 #include <sys/mount.h>
1792 #ifdef HAVE_SYS_FS_TYPES_H
1793 #include <sys/fs_types.h>
1798 /* Ultrix's statfs returns 1 for success,
1799 0 for not mounted, -1 for failure. */
1800 exit (statfs (".", &fsd) != 1);
1802 fu_cv_sys_stat_fs_data=yes,
1803 fu_cv_sys_stat_fs_data=no,
1804 fu_cv_sys_stat_fs_data=no)])
1805 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
1806 if test $fu_cv_sys_stat_fs_data = yes; then
1807 AC_DEFINE(STAT_STATFS_FS_DATA)
1810 dnl check if compiler pre-processor defines __FUNCTION__
1811 AC_CACHE_CHECK(if __FUNCTION__ is defined,ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED,
1814 char *cp = __FUNCTION__;
1815 ], ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=yes, ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=no)])
1817 if test "x$ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED" = "xyes"; then
1818 AC_DEFINE(HAVE_CPP_UNDERBAR_FUNCTION_DEFINED)
1821 AC_CHECK_STRUCT_FOR([
1822 #ifdef HAVE_SYS_PARAM_H
1823 #include <sys/param.h>
1825 #include <sys/types.h>
1826 #include <sys/signal.h>
1827 ], sigaction, sa_sigaction, no)
1829 AC_CHECK_STRUCT_FOR([
1830 #ifdef HAVE_SYS_PARAM_H
1831 #include <sys/param.h>
1833 #include <sys/types.h>
1836 #include <sys/socket.h>
1839 ], sockaddr, sa_len, no)
1841 AC_CHECK_STRUCT_FOR([
1842 #ifdef HAVE_SYS_PARAM_H
1843 #include <sys/param.h>
1845 #include <sys/types.h>
1848 #include <sys/socket.h>
1851 ], sockaddr, sa_union.sa_generic.sa_family2, no)
1853 AC_CHECK_STRUCT_FOR([
1854 #ifdef HAVE_SYS_PARAM_H
1855 #include <sys/param.h>
1857 #include <sys/types.h>
1860 #include <sys/socket.h>
1863 #include <net/route.h>
1864 ], rtentry, rt_dst, no)
1866 dnl checking for 4.3 vs 4.4 rtentry.
1867 AC_CACHE_CHECK(type of rtentry structure,ac_cv_RTENTRY_TYPE,
1872 #ifdef HAVE_SYS_PARAM_H
1873 #include <sys/param.h>
1875 #include <sys/types.h>
1878 #include <sys/socket.h>
1881 #include <net/route.h>
1884 #ifndef STRUCT_RTENTRY_HAS_RT_DST
1885 #define rt_dst rt_nodes->rn_key
1889 rt.rt_nodes[0].rn_flags = 1;
1891 ], ac_cv_RTENTRY_TYPE="BSD-4.4")
1894 if test "x$ac_cv_RTENTRY_TYPE" = "x"; then
1896 #ifdef HAVE_SYS_PARAM_H
1897 #include <sys/param.h>
1899 #include <sys/types.h>
1902 #include <sys/socket.h>
1905 #include <net/route.h>
1909 ], ac_cv_RTENTRY_TYPE="BSD-4.3")
1913 if test "x$ac_cv_RTENTRY_TYPE" = "x"; then
1914 AC_MSG_RESULT(Unknown)
1915 ac_cv_RTENTRY_TYPE="unknown"
1920 if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.4"; then
1921 AC_DEFINE(RTENTRY_4_4)
1924 dnl checking for alpha's ortentry vs rtentry
1925 if test "x$ac_cv_RTENTRY_TYPE" = "xunknown"; then
1926 AC_CACHE_CHECK(for struct rtentry, ac_cv_struct_rtentry,
1927 [AC_EGREP_CPP(ortentry, [#define KERNEL
1928 #include <net/route.h>
1929 ], ac_cv_struct_rtentry=ortentry, ac_cv_struct_rtentry=rtentry )
1930 if test "x$ac_cv_struct_rtentry" = "xrtentry" ; then
1931 ac_cv_struct_rtentry="rtentry"
1933 ac_cv_struct_rtentry="ortentry"
1937 RTENTRY_TYPE="rtentry"
1938 ac_cv_struct_rtentry="rtentry"
1941 if test "x$ac_cv_struct_rtentry" != "x"; then
1942 AC_DEFINE_UNQUOTED(RTENTRY,struct ${ac_cv_struct_rtentry})
1944 AC_DEFINE(RTENTRY,struct rtentry)
1947 dnl check for 4.3's rtentry->rt_next
1948 if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.3"; then
1949 AC_CACHE_CHECK(for struct rtentry has a rt_next node,
1950 ac_cv_struct_rtentry_rt_next,
1953 #ifdef HAVE_SYS_PARAM_H
1954 #include <sys/param.h>
1956 #include <sys/types.h>
1959 #include <sys/socket.h>
1962 #include <net/route.h>
1966 ], ac_cv_struct_rtentry_rt_next=yes, ac_cv_struct_rtentry_rt_next=no )
1969 if test "x$ac_cv_struct_rtentry_rt_next" = "xyes"; then
1970 AC_DEFINE(RTENTRY_RT_NEXT)
1975 dnl Check struct rtentry for various things.
1976 AC_CHECK_STRUCT_FOR([
1977 #ifdef HAVE_SYS_PARAM_H
1978 #include <sys/param.h>
1980 #include <sys/types.h>
1983 #include <sys/socket.h>
1986 #include <net/route.h>
1987 ], rtentry, rt_unit)
1989 AC_CHECK_STRUCT_FOR([
1990 #ifdef HAVE_SYS_PARAM_H
1991 #include <sys/param.h>
1993 #include <sys/types.h>
1996 #include <sys/socket.h>
1999 #include <net/route.h>
2000 ], rtentry, rt_refcnt)
2002 AC_CHECK_STRUCT_FOR([
2003 #ifdef HAVE_SYS_PARAM_H
2004 #include <sys/param.h>
2006 #include <sys/types.h>
2009 #include <sys/socket.h>
2012 #include <net/route.h>
2013 ], rtentry, rt_hash)
2015 AC_CHECK_STRUCT_FOR([
2016 #ifdef HAVE_SYS_PARAM_H
2017 #include <sys/param.h>
2019 #include <sys/types.h>
2022 #include <sys/socket.h>
2025 #include <net/route.h>
2028 dnl Check tcpstat for tcpstat.tcp_rcvmemdrop
2029 AC_CHECK_STRUCT_FOR([
2030 #ifdef HAVE_SYS_PARAM_H
2031 #include <sys/param.h>
2033 #include <sys/types.h>
2034 #include <netinet/tcp.h>
2035 #ifdef HAVE_NETINET_TCP_TIMER_H
2036 #include <netinet/tcp_timer.h>
2039 #ifdef HAVE_NETINET_TCP_VAR_H
2040 #include <netinet/tcp_var.h>
2042 ], tcpstat, tcp_rcvmemdrop)
2046 AC_CHECK_STRUCT_FOR([
2047 #ifdef HAVE_SYS_PARAM_H
2048 #include <sys/param.h>
2050 #include <sys/types.h>
2051 #include <sys/socket.h>
2053 #ifdef HAVE_NET_IF_VAR_H
2054 #include <net/if_var.h>
2058 if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xno"; then
2059 AC_CACHE_CHECK(if _KERNEL needs to be defined for if_mtu, ac_cv_IFNET_NEEDS_KERNEL,
2061 if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xyes"; then
2062 ac_cv_IFNET_NEEDS_KERNEL=no
2066 #ifdef HAVE_SYS_PARAM_H
2067 #include <sys/param.h>
2069 #include <sys/types.h>
2070 #include <sys/socket.h>
2071 #ifdef HAVE_SYS_TIME_H
2072 #include <sys/time.h>
2075 #ifdef HAVE_NET_IF_VAR_H
2076 #include <net/if_var.h>
2079 struct ifnet testit;
2081 ], ac_cv_IFNET_NEEDS_KERNEL=yes, ac_cv_IFNET_NEEDS_KERNEL=no)
2085 if test "x$ac_cv_IFNET_NEEDS_KERNEL" = "xyes"; then
2086 AC_DEFINE(IFNET_NEEDS_KERNEL)
2090 AC_CHECK_STRUCT_FOR([
2091 #ifdef IFNET_NEEDS_KERNEL
2094 #ifdef HAVE_SYS_PARAM_H
2095 #include <sys/param.h>
2097 #include <sys/types.h>
2098 #include <sys/socket.h>
2099 #ifdef HAVE_SYS_TIME_H
2100 #include <sys/time.h>
2103 #ifdef HAVE_NET_IF_VAR_H
2104 #include <net/if_var.h>
2106 ], ifaddr, ifa_next)
2108 dnl Check ifnet entries using macro defined in aclocal.m4.
2110 dnl XXX Broken on FreeBSD where these are #define'd in <net/if.h>
2112 AC_CHECK_IFNET_FOR(if_baudrate)
2113 AC_CHECK_IFNET_FOR(if_baudrate.ifs_value)
2114 AC_CHECK_IFNET_FOR(if_speed)
2115 AC_CHECK_IFNET_FOR(if_type)
2116 AC_CHECK_IFNET_FOR(if_imcasts)
2117 AC_CHECK_IFNET_FOR(if_iqdrops)
2118 AC_CHECK_IFNET_FOR(if_noproto)
2119 AC_CHECK_IFNET_FOR(if_omcasts)
2120 AC_CHECK_IFNET_FOR(if_xname,no)
2121 AC_CHECK_IFNET_FOR(if_lastchange.tv_sec)
2122 AC_CHECK_IFNET_FOR(if_obytes)
2123 AC_CHECK_IFNET_FOR(if_ibytes)
2124 AC_CHECK_IFNET_FOR(if_addrlist)
2125 AC_CHECK_IFNET_FOR(if_addrhead.tqh_first)
2127 AC_CHECK_STRUCT_FOR([
2128 #include <sys/types.h>
2129 #if HAVE_NETINET_IN_H
2130 #include <netinet/in.h>
2132 #if HAVE_NETINET_IP_VAR_H
2133 #include <netinet/ip_var.h>
2135 #if HAVE_NETINET_UDP_H
2136 #include <netinet/udp.h>
2138 #if HAVE_NETINET_UDP_VAR_H
2139 #include <netinet/udp_var.h>
2141 ],udpstat,udps_discard)
2143 AC_CHECK_STRUCT_FOR([
2144 #include <sys/types.h>
2145 #if HAVE_NETINET_IN_H
2146 #include <netinet/in.h>
2148 #if HAVE_NETINET_IP_VAR_H
2149 #include <netinet/ip_var.h>
2151 #if HAVE_NETINET_UDP_H
2152 #include <netinet/udp.h>
2154 #if HAVE_NETINET_UDP_VAR_H
2155 #include <netinet/udp_var.h>
2157 ],udpstat,udps_noport)
2159 AC_CHECK_STRUCT_FOR([
2160 #include <sys/types.h>
2161 #if HAVE_NETINET_IN_H
2162 #include <netinet/in.h>
2164 #if HAVE_NETINET_IP_VAR_H
2165 #include <netinet/ip_var.h>
2167 #if HAVE_NETINET_UDP_H
2168 #include <netinet/udp.h>
2170 #if HAVE_NETINET_UDP_VAR_H
2171 #include <netinet/udp_var.h>
2173 ],udpstat,udps_noportbcast)
2175 AC_CHECK_STRUCT_FOR([
2176 #include <sys/types.h>
2177 #if HAVE_NETINET_IN_H
2178 #include <netinet/in.h>
2180 #if HAVE_NETINET_IP_VAR_H
2181 #include <netinet/ip_var.h>
2183 #if HAVE_NETINET_UDP_H
2184 #include <netinet/udp.h>
2186 #if HAVE_NETINET_UDP_VAR_H
2187 #include <netinet/udp_var.h>
2189 ],udpstat,udps_fullsock)
2191 AC_CHECK_STRUCT_FOR([
2192 #ifdef HAVE_SYS_PARAM_H
2193 #include <sys/param.h>
2195 #include <sys/types.h>
2196 #include <sys/socket.h>
2197 #ifdef HAVE_SYS_TIME_H
2198 #include <sys/time.h>
2201 #if HAVE_NETINET_IN_H
2202 #include <netinet/in.h>
2204 #if HAVE_NETINET_IF_ETHER_H
2205 #include <netinet/if_ether.h>
2209 AC_CHECK_STRUCT_FOR([
2211 #include <sys/conf.h>
2213 ],swdevt,sw_nblksenabled)
2215 AC_CHECK_STRUCT_FOR([
2216 #ifdef HAVE_SYS_STAT_H
2217 #include <sys/stat.h>
2219 #if HAVE_SYS_STATFS_H
2220 #include <sys/statfs.h>
2222 #if HAVE_SYS_STATVFS_H
2223 #include <sys/statvfs.h>
2227 AC_CHECK_STRUCT_FOR([
2228 #ifdef HAVE_SYS_STAT_H
2229 #include <sys/stat.h>
2231 #if HAVE_SYS_STATFS_H
2232 #include <sys/statfs.h>
2234 #if HAVE_SYS_STATVFS_H
2235 #include <sys/statvfs.h>
2239 AC_CHECK_STRUCT_FOR([
2240 #ifdef HAVE_SYS_STAT_H
2241 #include <sys/stat.h>
2243 #if HAVE_SYS_STATFS_H
2244 #include <sys/statfs.h>
2246 #ifdef HAVE_SYS_PARAM_H
2247 #include <sys/param.h>
2248 #include <sys/types.h>
2250 #ifdef HAVE_SYS_MOUNT_H
2251 #include <sys/mount.h>
2255 AC_CHECK_STRUCT_FOR([
2256 #ifdef HAVE_SYS_STAT_H
2257 #include <sys/stat.h>
2259 #if HAVE_SYS_STATFS_H
2260 #include <sys/statfs.h>
2262 #ifdef HAVE_SYS_PARAM_H
2263 #include <sys/param.h>
2264 #include <sys/types.h>
2266 #ifdef HAVE_SYS_MOUNT_H
2267 #include <sys/mount.h>
2271 AC_CHECK_STRUCT_FOR([
2272 #ifdef HAVE_SYS_STAT_H
2273 #include <sys/stat.h>
2275 #if HAVE_SYS_STATFS_H
2276 #include <sys/statfs.h>
2278 #ifdef HAVE_SYS_PARAM_H
2279 #include <sys/param.h>
2280 #include <sys/types.h>
2282 #ifdef HAVE_SYS_MOUNT_H
2283 #include <sys/mount.h>
2287 AC_CHECK_STRUCT_FOR([
2293 dnl check struct ipstat for various things
2294 AC_CHECK_STRUCT_FOR([
2295 #include <sys/types.h>
2296 #if HAVE_NETINET_IN_H
2297 #include <netinet/in.h>
2299 #if HAVE_NETINET_IP_VAR_H
2300 #include <netinet/ip_var.h>
2302 ], ipstat, ips_cantforward)
2304 AC_CHECK_STRUCT_FOR([
2305 #include <sys/types.h>
2306 #if HAVE_NETINET_IN_H
2307 #include <netinet/in.h>
2309 #if HAVE_NETINET_IP_VAR_H
2310 #include <netinet/ip_var.h>
2312 ], ipstat, ips_cantfrag)
2314 AC_CHECK_STRUCT_FOR([
2315 #include <sys/types.h>
2316 #if HAVE_NETINET_IN_H
2317 #include <netinet/in.h>
2319 #if HAVE_NETINET_IP_VAR_H
2320 #include <netinet/ip_var.h>
2322 ], ipstat, ips_delivered)
2324 AC_CHECK_STRUCT_FOR([
2325 #include <sys/types.h>
2326 #if HAVE_NETINET_IN_H
2327 #include <netinet/in.h>
2329 #if HAVE_NETINET_IP_VAR_H
2330 #include <netinet/ip_var.h>
2332 ], ipstat, ips_fragdropped)
2334 AC_CHECK_STRUCT_FOR([
2335 #include <sys/types.h>
2336 #if HAVE_NETINET_IN_H
2337 #include <netinet/in.h>
2339 #if HAVE_NETINET_IP_VAR_H
2340 #include <netinet/ip_var.h>
2342 ], ipstat, ips_fragtimeout)
2344 AC_CHECK_STRUCT_FOR([
2345 #include <sys/types.h>
2346 #if HAVE_NETINET_IN_H
2347 #include <netinet/in.h>
2349 #if HAVE_NETINET_IP_VAR_H
2350 #include <netinet/ip_var.h>
2352 ], ipstat, ips_localout)
2354 AC_CHECK_STRUCT_FOR([
2355 #include <sys/types.h>
2356 #if HAVE_NETINET_IN_H
2357 #include <netinet/in.h>
2359 #if HAVE_NETINET_IP_VAR_H
2360 #include <netinet/ip_var.h>
2362 ], ipstat, ips_noproto)
2364 AC_CHECK_STRUCT_FOR([
2365 #include <sys/types.h>
2366 #if HAVE_NETINET_IN_H
2367 #include <netinet/in.h>
2369 #if HAVE_NETINET_IP_VAR_H
2370 #include <netinet/ip_var.h>
2372 ], ipstat, ips_noroute)
2374 AC_CHECK_STRUCT_FOR([
2375 #include <sys/types.h>
2376 #if HAVE_NETINET_IN_H
2377 #include <netinet/in.h>
2379 #if HAVE_NETINET_IP_VAR_H
2380 #include <netinet/ip_var.h>
2382 ], ipstat, ips_odropped)
2384 AC_CHECK_STRUCT_FOR([
2385 #include <sys/types.h>
2386 #if HAVE_NETINET_IN_H
2387 #include <netinet/in.h>
2389 #if HAVE_NETINET_IP_VAR_H
2390 #include <netinet/ip_var.h>
2392 ], ipstat, ips_ofragments)
2394 AC_CHECK_STRUCT_FOR([
2395 #include <sys/types.h>
2396 #if HAVE_NETINET_IN_H
2397 #include <netinet/in.h>
2399 #if HAVE_NETINET_IP_VAR_H
2400 #include <netinet/ip_var.h>
2402 ], ipstat, ips_reassembled)
2404 dnl check for the des_ks_struct.weak_key attribute, which indicates the
2405 dnl older opensll version is being used.
2406 if test "x$ac_cv_header_openssl_des_h" = "xyes" ; then
2407 AC_CHECK_STRUCT_FOR([
2408 #include <openssl/des.h>
2409 ], des_ks_struct, weak_key)
2412 dnl attempt to figure out if sysctl is usable
2414 if test $cross_compiling = yes; then
2415 AC_MSG_WARN([Can't check sysctl, manually define CAN_USE_SYSCTL if platform support available])
2417 AC_CACHE_CHECK(if sysctl can read kernel information,ac_cv_CAN_USE_SYSCTL,
2419 #if TIME_WITH_SYS_TIME
2420 # include <sys/time.h>
2423 # if HAVE_SYS_TIME_H
2424 # include <sys/time.h>
2429 #if HAVE_SYS_PARAM_H
2430 # include <sys/param.h>
2432 #include <sys/types.h>
2433 #if HAVE_SYS_SYSCTL_H
2434 # include <sys/sysctl.h>
2440 struct timeval boottime;
2443 mib[1] = KERN_BOOTTIME;
2445 len = sizeof(boottime);
2446 sysctl(mib, 2, &boottime, &len, NULL, NULL);
2447 if (boottime.tv_sec != 0)
2452 ], ac_cv_CAN_USE_SYSCTL=yes, ac_cv_CAN_USE_SYSCTL=no, ac_cv_CAN_USE_SYSCTL=no)])
2455 if test "x$ac_cv_CAN_USE_SYSCTL" = "xyes"; then
2456 AC_DEFINE(CAN_USE_SYSCTL)
2460 dnl In FreeBSD 4.x, the TCP timer constants aren't. They are defined
2461 dnl in terms of `hz', the kernel clock tick. In this case,
2462 dnl we need to have a local variable `hz' in scope and set to a useful
2463 dnl value whenever we use one of these constants.
2465 AC_CACHE_CHECK(whether TCP timers depend on \`hz',ac_cv_TCPTV_NEEDS_HZ,
2467 [#include <netinet/tcp_timer.h>
2469 ], ac_cv_TCPTV_NEEDS_HZ=yes, ac_cv_TCPTV_NEEDS_HZ=no)])
2471 if test "x$ac_cv_TCPTV_NEEDS_HZ" = "xyes"; then
2472 AC_DEFINE(TCPTV_NEEDS_HZ)
2476 dnl define the agent libraries variable
2479 AC_SUBST(OTHERAGENTLIBOBJS)
2480 AC_SUBST(OTHERAGENTLIBLOBJS)
2483 dnl Prompt for various bits of user information
2486 if test "x$ac_cv_user_prompt_LOGFILE" = "x" -o "x$ac_cv_user_prompt_SYS_LOC" = "x" -o "x$ac_cv_user_prompt_SYS_CONTACT" = "x" -o "x$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" = "x"; then
2487 AC_CACHE_CHECK(if you have run configure before, ac_cv_have_warned,
2489 if test "x$defaults" = "xno"; then
2492 ************** Configuration Section **************
2494 You are about to be prompted with a series of questions. Answer
2495 them carefully, as they determine how the SNMP agent and related
2496 applications are to function.
2498 After the configure script finishes, you can browse the newly
2499 created config.h file for further - less important - parameters to
2500 modify. Be careful if you re-run configure though, since config.h will
2503 -Press return to continue-
2507 ac_cv_have_warned="yes"
2508 echo $ac_n "disabling above prompt for future runs... $ac_c"
2510 ac_cv_have_warned="no"
2514 ac_cv_have_warned="yes"
2518 if test -f /etc/resolv.conf; then
2519 LOC=`cat /etc/resolv.conf | grep '^domain' | tail -1 | awk '{print $NF}'`
2524 AC_PROMPT_USER(DEFAULT_SNMP_VERSION,[
2526 *** Default SNMP Version:
2528 Starting with Net-SNMP 5.0, you can choose the default version of
2529 the SNMP protocol to use when no version is given explicitly on the
2530 command line, or via an 'snmp.conf' file. In the past this was set to
2531 SNMPv1, but you can use this to switch to SNMPv3 if desired. SNMPv3
2532 will provide a more secure management environment (and thus you're
2533 encouraged to switch to SNMPv3), but may break existing scripts that
2534 rely on the old behaviour. (Though such scripts will probably need to
2535 be changed to use the '-c' community flag anyway, as the SNMPv1
2536 command line usage has changed as well.).
2537 At this prompt you can select \"1\", \"2\" (for SNMPv2c), or \"3\" as
2538 the default version for the command tools (snmpget, ...) to use. This
2539 can always be overridden at runtime using the -v flag to the tools, or
2540 by using the \"defVersion\" token in your snmp.conf file.
2542 Default version of SNMP to use],3,unquoted)
2544 dnl we tested this above before the prompt, but the prompt may give a new value.
2545 if test "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "3"; then
2546 AC_MSG_ERROR([Illegal version number. Only 1, 2 (for SNMPv2c) and 3 are supported.])
2549 AC_PROMPT_USER(SYS_CONTACT,[
2551 *** System Contact Information:
2553 Describes who should be contacted about the host the agent is
2554 running on. This information is available in the MIB-II tree. This
2555 can also be over-ridden using the \"syscontact\" syntax in the agent's
2556 configuration files.
2558 System Contact Information],$ME@$LOC,quoted)
2560 AC_PROMPT_USER(SYS_LOC,[
2562 *** System Location:
2564 Describes the location of the system. This information is
2565 available in the MIB-II tree. this can also be over-ridden using the
2566 \"syslocation\" syntax in the agent's configuration files.
2568 System Location],Unknown,quoted)
2570 if test -d /var/log; then
2571 defaultlog="/var/log/snmpd.log"
2573 defaultlog="/usr/adm/snmpd.log"
2576 AC_PROMPT_USER(LOGFILE,[
2578 *** Logfile location:
2580 Enter the default location for the snmpd agent to dump
2581 information & errors to. If not defined (enter the keyword \"none\"
2582 at the prompt below) the agent will use stdout and stderr instead.
2583 (Note: This value can be over-ridden using command line options.)
2585 Location to write logfile],$defaultlog,quoted)
2587 if test -d /var; then
2588 defaultstore="/var/net-snmp"
2589 ucddefaultstore="/var/ucd-snmp"
2591 defaultstore="/etc/net-snmp"
2592 ucddefaultstore="/etc/ucd-snmp"
2595 AC_PROMPT_USER(PERSISTENT_DIRECTORY,[
2597 *** snmpd persistent storage location:
2599 Enter a directory for the SNMP library to store persistent
2600 data in the form of a configuration file. This default location is
2601 different than the old default location (which was for ucd-snmp). If
2602 you stay with the new path, I'll ask you in a second if you wish to
2603 copy your files over to the new location (once only). If you pick
2604 some other path than the default, you'll have to copy them yourself.
2605 There is nothing wrong with picking the old path ($ucddefaultstore) if
2608 Location to write persistent information],$defaultstore,quoted)
2610 PERSISTENT_DIRECTORY=$ac_cv_user_prompt_PERSISTENT_DIRECTORY
2611 AC_SUBST(PERSISTENT_DIRECTORY)
2612 UCDPERSISTENT_DIRECTORY=$ucddefaultstore
2613 AC_SUBST(UCDPERSISTENT_DIRECTORY)
2615 if test $PERSISTENT_DIRECTORY = "$defaultstore" -a -d "$ucddefaultstore" -a ! -d "$defaultstore" ; then
2616 AC_CACHE_CHECK(If we should copy the old persistent directory, ac_cv_user_prompt_COPY_PERSISTENT_FILES,
2618 AC_PROMPT_USER_NO_DEFINE(ac_cv_user_prompt_COPY_PERSISTENT_FILES,[
2620 *** Copying old ucd-snmp persistent files to net-snmp persistent directory:
2622 Would you like to copy the older ucd-snmp persistent files
2623 into your new net-snmp persistent file path? This will functionally
2624 save all your ucd-snmp data and let it be used within the net-snmp
2625 tools. This will only be done once when you run make install. If you
2626 wish to do this, enter "yes" at the prompt.
2628 Copy ucd-snmp data into the net-snmp data directory],"yes")
2631 ac_cv_user_prompt_COPY_PERSISTENT_FILES="no"
2633 COPY_PERSISTENT_FILES="$ac_cv_user_prompt_COPY_PERSISTENT_FILES"
2634 AC_SUBST(COPY_PERSISTENT_FILES)
2639 Makefile:Makefile.top:Makefile.in:Makefile.rules
2640 snmplib/Makefile:Makefile.top:snmplib/Makefile.in:Makefile.rules:snmplib/Makefile.depend
2641 apps/Makefile:Makefile.top:apps/Makefile.in:Makefile.rules:apps/Makefile.depend
2642 apps/snmpnetstat/Makefile:Makefile.top:apps/snmpnetstat/Makefile.in:Makefile.rules:apps/snmpnetstat/Makefile.depend
2643 agent/Makefile:Makefile.top:agent/Makefile.in:Makefile.rules:agent/Makefile.depend
2644 agent/helpers/Makefile:Makefile.top:agent/helpers/Makefile.in:Makefile.rules:agent/helpers/Makefile.depend
2645 agent/mibgroup/Makefile:Makefile.top:agent/mibgroup/Makefile.in:Makefile.rules:agent/mibgroup/Makefile.depend
2646 local/Makefile:Makefile.top:local/Makefile.in:Makefile.rules
2647 testing/Makefile:Makefile.top:testing/Makefile.in
2648 man/Makefile:Makefile.top:man/Makefile.in:Makefile.rules
2649 mibs/Makefile:Makefile.top:mibs/Makefile.in:Makefile.rules
2650 net-snmp-config:net-snmp-config.in
2651 ], echo timestamp > stamp-h)
2653 AC_MSG_CACHE_DISPLAY()
2655 dnl Local Variables:
2657 dnl comment-start: "dnl"