Revert changes with new dnscrypto-proxy.
[tomato.git] / release / src / router / snmp / configure.in
blobf5e26d934ef5737228d5947019d2911037e30304
1 dnl Portions of this file are subject to the following copyright.  See
2 dnl the Net-SNMP's COPYING file for more details and other copyrights
3 dnl that may apply:
4 dnl
5 dnl Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
6 dnl Use is subject to license terms specified in the COPYING file
7 dnl distributed with the Net-SNMP package.
8 dnl
10 dnl
11 dnl Process this file with autoconf to produce a configure script.
12 dnl
13 AC_INIT(agent/mibgroup/ucd-snmp/extensible.c)
14 AC_CONFIG_HEADER(include/net-snmp/net-snmp-config.h)
15 AC_MSG_CACHE_INIT()
17 dnl
18 dnl save the configure arguments
19 dnl
20 AC_DEFINE_UNQUOTED(CONFIGURE_OPTIONS,"\"$ac_configure_args\"")
21 CONFIGURE_OPTIONS="\"$ac_configure_args\""
22 AC_SUBST(CONFIGURE_OPTIONS)
24 dnl
25 dnl Compilation setup
26 dnl
27 AC_ARG_WITH(cc, [
28 Compiler Options:
29   --with-cc=CC                    use CC to compile (default=gcc).],
30     [CC=$with_cc;export CC])
32 AC_ARG_WITH(ar,
33 [  --with-ar=AR                    use AR as the archiver.],
34     [AR=$with_ar; export AR])
36 AC_ARG_WITH(endianness,
37 [  --with-endianness=big|little    define endianness of target platform when
38                                   cross-compiling.],
39     [if test $with_endianness != "big" -a $with_endianness != "little" ; then
40        AC_MSG_ERROR([Endianness must be big or little, not \"$with_endianness\".]);
41      fi
44 AC_ARG_WITH(cflags,
45 [  --with-cflags=CFLAGS            use CFLAGS as compile time arguments.],
46     [CFLAGS=$with_cflags; export CFLAGS])
48 AC_ARG_WITH(ldflags,
49 [  --with-ldflags=LDFLAGS          use LDFLAGS as link time arguments to ld.],
50     [LDFLAGS=$with_ldflags; export LDFLAGS])
52 AC_ARG_WITH(libs,
53 [  --with-libs=LIBS                use LIBS as link time arguments to ld.],
54     [LIBS=$with_libs; export LIBS])
56 AC_ARG_ENABLE(silent-libtool,
57 [  --enable-silent-libtool         Pass --silent to libtool.],
58         LIBTOOLFLAGS=--silent)
59 AC_SUBST(LIBTOOLFLAGS)
61 AC_ARG_ENABLE(mini_agent,
62 [  --enable-mini-agent             Build a minimal agent.],
63     mini_agent="yes",mini_agent="no")
65 AC_ARG_ENABLE(ipv6,
66 [  --enable-ipv6                   Generate IPv6 ready version.],
67     [if test "x$enable_ipv6" = "xyes"; then
68       AC_DEFINE(INET6)
69     fi])
71 AC_ARG_ENABLE(debugging,
72 [  --enable-debugging              Outputs extra debugging information at all
73                                   times.  Normally, you should not enable this,
74                                   but instead use the -D flag of the commands,
75                                   which toggles debbuging output at runtime.
76   --disable-debugging             Disallows debugging code to be built in.
77                                   This might provide some speed benefits.],
78     AC_DEFINE(SNMP_ALWAYS_DEBUG))
80 AC_ARG_ENABLE(developer,
81 [  --enable-developer              Turns on super-duper-extra-compile-warnings
82                                   when using gcc.],
83     developer=yes)
85 if test "x$enable_debugging" = "xno"; then
86     AC_DEFINE(SNMP_NO_DEBUGGING)
89 AC_ARG_WITH(dmalloc,
90 [  --with-dmalloc=PATH             Use dmalloc library (www.dmalloc.com)],
91     if test "x$withval" = "xyes"; then
92       LIBS="$LIBS -ldmalloc"
93       AC_DEFINE(HAVE_DMALLOC_H)
94     elif test -d "$withval"; then
95       AC_ADD_SEARCH_PATH($withval)
96       LIBS="$LIBS -ldmalloc"
97       AC_DEFINE(HAVE_DMALLOC_H)
98     fi
100 AC_SUBST(HAVE_DMALLOC_H)
102 AC_ARG_WITH(efence,
103 [  --with-efence                   Look for and use libefence (malloc).],
104       use_efence="$withval")
106 tryrsaref=no
107 AC_ARG_WITH(rsaref,
108 [  --with-rsaref=PATH              Look for librsaref in PATH/lib.],
109     if test "x$withval" = "xyes"; then
110       tryrsaref=yes
111     elif test "x$withval" = "xno"; then
112       tryrsaref=no
113     elif test -d "$withval"; then
114       AC_ADD_SEARCH_PATH($withval)
115       tryrsaref=yes
116     fi,
119 tryopenssl=defaultyes
120 askedopenssl=no
121 AC_ARG_WITH(openssl,
122 [  --with-openssl=PATH             Look for openssl in PATH/lib.],
123     if test "x$withval" = "xyes"; then
124       tryopenssl=yes
125       askedopenssl=yes
126     elif test "x$withval" = "xno"; then
127       tryopenssl=no
128     elif test -d "$withval"; then
129       AC_ADD_SEARCH_PATH($withval)
130       tryopenssl=yes
131       askedopenssl=yes
132     fi,
134 if test "x$tryopenssl" = "xdefaultyes"; then
135       AC_ADD_SEARCH_PATH(/usr/local/ssl)
136       tryopenssl=yes
140 AC_ARG_ENABLE(privacy,
141 [  --disable-privacy               Don't compile in support for privacy.])
142 if test "x$enable_privacy" != "xno"; then
143   AC_DEFINE(SCAPI_AUTHPRIV)
146 AC_ARG_ENABLE(internal-md5,
147 [  --enable-internal-md5           Use the internal MD5 support.],
148 AC_DEFINE(USE_INTERNAL_MD5))
151 AC_ARG_WITH(opaque-special-types,
152 [  --without-opaque-special-types  Don't use special opaque encodings.
153                                   SNMP normally cannot handle
154                                   floating numbers, nor large 64 bit
155                                   integers well.  By default, the
156                                   net-snmp package compiles in
157                                   support for these extra datatypes
158                                   (in a legal way)])
160 AC_ARG_WITH(mibdirs,
161 [  --with-mibdirs=\"dir1:dir2:\"     Default directories to look for mibs.
162                                     (Default: \$HOME/.snmp/mibs:DATADIR/snmp/mibs)],
163     [DEFAULT_MIBDIRS="$with_mibdirs"
164     AC_DEFINE_UNQUOTED(DEFAULT_MIBDIRS,"$with_mibdirs")])
166 AC_ARG_WITH(mibs,
167 [  --with-mibs=\"item1:item2:\"      Default mib IDs to read.
168                                     (The default list is \"IP-MIB:IF-MIB:
169                                     TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB\"
170                                     with the addition of any mibs used
171                                     by the mib modules the agent is
172                                     configured with)],
173     DEFAULT_MIBS="$with_mibs")
175 AC_ARG_WITH(mibfiles,
176 [  --with-mibfiles=\"file1:file2\"   Default mib files to load.
177                                     (Default:  none.  uses IDs above instead.)],
178     AC_DEFINE_UNQUOTED(DEFAULT_MIBFILES,"$with_mibfiles"))
181 AC_ARG_ENABLE(testing-code,
182 [  --enable-testing-code           Enables some code sections that should 
183                                   only be used for testing of certain
184                                   SNMP functionalities.  This should *not* 
185                                   be turned on for production use.  Ever.],
186     AC_DEFINE(SNMP_TESTING_CODE))
188 AC_ARG_ENABLE(reentrant,
189 [  --enable-reentrant              Enables locking functions that protect
190                                   library resources in some multi-threading
191                                   environments.  This does not guarantee
192                                   thread-safe operation.
193                                   Currently an experimental setting.],
194     with_res_locks="yes",with_res_locks="no")
196 AC_ARG_WITH(root-access,
198 Configuring the agent:
199   --without-root-access           The snmpd agent won't require root access to
200                                   run it.  The information it returns in the
201                                   mib-II tree may not be correct, however.])
203 AC_ARG_WITH(kmem-usage,
205 Configuring the agent:
206   --without-kmem-usage            Do not include any code related to the use
207                                   of kmem. This option can only be used with
208                                   the option --enable-mini-agent.])
210 AC_ARG_WITH(dummy-values,
211 [  --with-dummy-values             Provide 'placeholder' dummy values where
212                                   the necessary information is not available.
213                                   This is technically not compliant with the
214                                   SNMP specifications, but was how the agent
215                                   operated for versions < 4.0.])
217 AC_ARG_WITH(persistent-directory,
218 [  --with-persistent-directory=\"directory\"
219                                   Default directory for persistent data storage.],ac_cv_user_prompt_PERSISTENT_DIRECTORY="$with_persistent_directory")
221 AC_ARG_WITH(copy_persistent_files,
222 [  --with-copy-persistent-files=\"no\" Don't copy persistent files
223                                        (or use \"yes\" to copy them).
224                                        (Default: yes)],
225     ac_cv_user_prompt_COPY_PERSISTENT_FILES="$with_copy_persistent_files")
227 AC_ARG_WITH(default-snmp-version,
228 [  --with-default-snmp-version=\"3\" Default version of SNMP to use.
229                                   (Default: 3)
230                                   Legal values: 1, 2 (for SNMPv2c) or 3.],
231     ac_cv_user_prompt_DEFAULT_SNMP_VERSION="$with_default_snmp_version")
233 dnl we test this now and later as well.  we test it now so configure can die
234 dnl early on with an error rather than waiting till the end of the script.
235 if test "x$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "x"; then
236   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
237     AC_MSG_ERROR(Illegal version number passed to --with-default-snmp-version)
238   fi
241 AC_ARG_WITH(sys_contact,
242 [  --with-sys-contact=\"who@where\"  Default system contact.
243                                     (Default: LOGIN@DOMAINNAME)],
244     ac_cv_user_prompt_SYS_CONTACT="$with_sys_contact")
246 AC_ARG_WITH(sys_location,
247 [  --with-sys-location=\"location\"  Default system location.
248                                     (Default: Unknown)],
249     ac_cv_user_prompt_SYS_LOC="$with_sys_location")
251 AC_ARG_WITH(logfile,
252 [  --with-logfile=\"location\"       Default log file location for snmpd.],
253     ac_cv_user_prompt_LOGFILE="$with_logfile")
255 dnl This can't be within AC_ARG_WITH.  I don't want to read autoconf m4
256 dnl to find out why.
257 AC_SUBST(WRAPLIBS)
259 AC_ARG_WITH(transports,
260 [  --with-transports=\"t1 t2 ...\"   Compile in the given SNMP transport
261                                     modules (space separated list).])
262 AC_ARG_WITH(out_transports,
263 [  --with-out-transports=\"t1 ...\"  Exclude listed SNMP transports
264                                     (space separated list).
266   Available SNMP transport modules are:
268     UDP         support for SNMP over UDP/IP.
269                 This transport is always compiled in.
270     UDPIPv6     support for SNMP over UDP/IPv6.
271                 This transport is available for Linux, Solaris and
272                 FreeBSD.
273                 It is never compiled in by default.
274     TCPIPv6     support for SNMP over UDP/IPv6.
275                 This transport is available for Linux, Solaris and
276                 FreeBSD.
277                 It is never compiled in by default.
278     TCP         support for SNMP over TCP/IP.
279                 This transport is compiled in by default, but may be omitted.
280     Unix        support for SNMP over Unix domain protocols.
281                 This transport is compiled in by default except on Win32
282                 platforms, and may be omitted.
283     Callback    support for SNMP over an internal locally connected pair
284                 of snmp_sessions.
285     AAL5PVC     support for SNMP over AAL5 PVCs.
286                 This transport is presently only available for Linux,
287                 is never compiled in by default and may be omitted.
288     IPX         support for SNMP over IPX per RFC 1420.
289                 This transport is presently only available for Linux,
290                 is never compiled in by default and may be omitted.
294 dnl Catch common mistakes in transport options
296 AC_ARG_WITH(transport,,    AC_MSG_ERROR([ Invalid option. Use --with-transports instead ])     )
297 AC_ARG_WITH(out_transport,,AC_MSG_ERROR([ Invalid option. Use --with-out-transports instead ]) )
300 dnl security modules
303 AC_ARG_WITH(security-modules,
304 [  --with-security-modules=\"s1 s2 ...\"   Compile in the given SNMP security
305                                     module services (space separated list).
307   Available SNMP security services:
309         usm                support for user based SNMP security
310                            (required and always compiled in)
311         ksm                support for kerberos based SNMP security
315 dnl mib modules
318 AC_ARG_WITH(mib_modules,
319 [  --with-mib-modules=\"item1 ...\"  Compile with additional mib modules
320                                     (Space separated list).])
322 AC_ARG_WITH(out_mib_modules,
323 [  --with-out-mib-modules=\"list\"   Compile without these mib modules.
325   Default mib modules compiled into the agent (which can be removed):
326   
327     mibII                  support for the mib-II tree.
328     snmpv3mibs             support for the snmpv3 mib modules.
329     ucd_snmp               UCD-SNMP-MIB specific extensions.
330     agent_mibs             NET-SNMP-AGENT-MIB extensions
331     agentx                 (see below)
332     notification           mibs supporting specification of trap destinations.
333     target                 Support for the SNMP WGs TARGET-MIB.
334     utilities              general agent configuration utilities.
336   Optional mib modules that can be built into the agent include:
337     host                   host resources mib support.
338                              (beta level code for linux, hpux, solaris, bsdi)
339     disman/event-mib       support for the DISMAN-EVENT-MIB (beta)
340                              (supports self monitoring and notification 
341                               delivery when error conditions are found)
342     smux                   smux support to allow subagents to attach to snmpd.
343     mibII/mta_sendmail     Sendmail statistics monitoring (MTA-MIB)
344     misc/ipfwacc           accounting rules IP firewall information (linux).
345     ipfwchains/ipfwchains  firewall chains under ipfw for linux.
346                            (Download separately from the ucd-snmp ftp site.)
347     ucd-snmp/diskio        Table of io-devices and how much data they have
348                            read/written.  (only tested on Solaris)
349     tunnel                 Linux TUNNEL-MIB support (ifTable extension)
351   AgentX support:  (warning: beta code)
352     agentx/subagent        allows the agent to run as either a snmp agent
353                            or as an agentX sub-agent.
354     agentx/master          makes the agent run as an agentX master agent
355                            as well as a normal snmp agent.
356     agentx                 includes both agentx/master and agentx/client.
358   Optional modules for C coders to look at and/or include as extension examples:
359   
360     examples/ucdDemoPublic  SNMPv3 interoperability testing mib.
361     examples/example        example C code extension.])
365 AC_ARG_WITH(enterprise-oid,
366 [Enterprise OIDs:  (warning: this should be used with caution.)
368   --with-enterprise-oid              The enterprise number assigned to the
369                                      vendor by IANA.  See
370                                      http://www.iana.org/cgi-bin/enterprise.pl
371                                      to get one, though using the default is
372                                      probably the right choice is most cases.
373                                      (default 8072 = "enterprise.net-snmp")],[
374   if test "$withval" = yes; then
375     AC_MSG_ERROR([ Please provide a value for the enterprise number ]);
376   fi
377   AC_DEFINE_UNQUOTED(ENTERPRISE_OID, $withval)
378   ent_oid="1,3,6,1,4,1,$withval"
379   AC_DEFINE_UNQUOTED(ENTERPRISE_MIB, $ent_oid)
380   ent_dot_oid="1.3.6.1.4.1.$withval"
381   AC_DEFINE_UNQUOTED(ENTERPRISE_DOT_MIB, $ent_dot_oid)
382   AC_MSG_RESULT(using enterprise number $withval)
384   AC_MSG_RESULT(using default "enterprise.net-snmp")
387 AC_ARG_WITH(enterprise-sysoid,
389   --with-enterprise-sysoid           The base OID for the sysObjectID
390                                      of the system group
391                                      (default .1.3.6.1.4.1.8072.3.2... = 
392                                       "netSnmpAgentOIDs...")],[
393   if test "$withval" = yes; then
394     AC_MSG_ERROR([ Please provide a base OID value ]);
395   fi
396   sys_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'`
397   AC_DEFINE_UNQUOTED(SYSTEM_MIB, $sys_oid)
398   sys_dot_oid=`echo "$withval" | sed 's/^\.//'`
399   AC_DEFINE_UNQUOTED(SYSTEM_DOT_MIB, $sys_dot_oid)
400   sysoid_len=`echo "$withval" | sed 's/[^\.]//g' | awk -F\. '{ print NF }'`
401   AC_DEFINE_UNQUOTED(SYSTEM_DOT_MIB_LENGTH, $sysoid_len)
402   AC_MSG_RESULT(using enterprise sysOID $withval ....)
404   AC_MSG_RESULT(using default enterprise sysOID "NET-SNMP-MIB::netSnmpAgentOIDs...")
407 AC_ARG_WITH(enterprise-notification-oid,
409   --with-enterprise-notification-oid The OID used for the root of
410                                      enterprise specific notifications.
411                                      (default .1.3.6.1.4.1.2021 = "enterprise.ucdavis")],[
412   if test "$withval" = yes; then
413     AC_MSG_ERROR([ Please provide a base OID value ]);
414   fi
415   notification_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'`
416   AC_DEFINE_UNQUOTED(NOTIFICATION_MIB, $notification_oid)
417   notification_dot_oid=`echo "$withval" | sed 's/^\.//'`
418   AC_DEFINE_UNQUOTED(NOTIFICATION_DOT_MIB, $notification_dot_oid)
419   notificationoid_len=`echo "$withval" | sed 's/[^\.]//g' | awk -F\. '{ print NF }'`
420   AC_DEFINE_UNQUOTED(NOTIFICATION_DOT_MIB_LENGTH, $notificationoid_len)
421   AC_MSG_RESULT(using enterprise notifications $withval)
423   AC_MSG_RESULT(using default notifications "NET-SNMP-MIB::netSnmpNotifications")
426 dnl Catch common mistakes in configure options
428 AC_ARG_WITH(mib_module,,    AC_MSG_ERROR([ Invalid option. Use --with-mib-modules instead ])     )
429 AC_ARG_WITH(out_mib_module,,AC_MSG_ERROR([ Invalid option. Use --with-out-mib-modules instead ]) )
432 dnl Perl specific
434 AC_ARG_WITH(perl-modules,
436 Perl:
437   --with-perl-modules[=ARGS]      Install the perl modules along with the rest
438                                   of the net-snmp toolkit.  If ARGS is
439                                   specified, they're passed to the
440                                   Makefile.PL script.],[
441     install_perl=yes
442     if test "$withval" = yes; then
443       PERLARGS=""
444     else
445       PERLARGS="$withval"
446     fi
449 AC_ARG_ENABLE(embedded-perl,
451   --enable-embedded-perl          Embed perl in the SNMP agent.
452                                   [forces --with-perl-modules as well.]],
453     embed_perl="yes", embed_perl="no")
456 dnl otherwise prompted information
458 AC_ARG_WITH(defaults,
460 Miscellaneous:
461   --with-defaults          Use defaults for prompted values.],
462     defaults="yes",defaults="no")
464 AC_ARG_ENABLE(ucd-snmp-compatibility,
465 [--enable-ucd-snmp-compatibility  Install ucd-snmp look-alike headers and libs.], ucd_compat=yes, ucd_compat=no)
467 dnl setup install targets
469 if test "x$ucd_compat" != "xno" ; then  
470   installucdheaders=installucdheaders
471   installucdlibs=installucdlibs
472   AC_MSG_CACHE_ADD(UCD-SNMP compatability:     enabled)
474 AC_SUBST(installucdheaders)
475 AC_SUBST(installucdlibs)
477 dnl Only define if specifically chosen as --without (i.e., default to true). 
478 if test "x$with_root_access" = "xno"; then
479   AC_DEFINE(NO_ROOT_ACCESS)
482 dnl Only define if specifically chosen as --without (i.e., default to true).
483 if test "x$with_kmem_usage" = "xno"; then
484   AC_DEFINE(NO_KMEM_USAGE)
487 dnl Define unless specifically suppressed (i.e., option defaults to false). 
488 if test "x$with_dummy_values" != "xyes"; then
489   AC_DEFINE(NO_DUMMY_VALUES)
492 dnl Only define if specifically chosen as --without (i.e., default to true). 
493 if test "x$with_opaque_special_types" != "xno"; then
494   AC_DEFINE(OPAQUE_SPECIAL_TYPES)
498 dnl overflow problems with hpux's sh
499 dnl taken from Perl's Configure script 
501 AC_MSG_CHECKING(if I need to feed myself to ksh)
502 if test -f /hp-ux -a -f /bin/ksh; then
503   if (PATH=.; alias -x) >/dev/null 2>&1; then
504     AC_MSG_RESULT(no)
505   else
506     AC_MSG_RESULT(yes)
507     if test "x$1" = "x"; then
508       exec /bin/ksh $0
509     else
510       exec /bin/ksh $0 "$@"
511     fi
512   fi
513 else
514   AC_MSG_RESULT(no)
517 if test "x$developer" != "xno" -a -f $srcdir/remove-files; then
518   dnl turn on the developer flag when taken from a CVS checkout (not a release)
519   developer="yes"
522 dnl disable --enable-shared by default in cvs/developer cases.
523 if test "x$developer" = "xyes"; then
524   dnl don't do anything if option set via cmdline
525   if test "${enable_shared+set}" != set; then
526     enable_shared=no
527   fi
530 dnl perl requires shared libs
531 if test "x$embed_perl" = "xyes"; then
532     if test "x$enable_shared" != "xyes"; then
533       AC_MSG_ERROR(--enable-embedded-perl requires --enable-shared)
534     fi
537 AC_PROG_CC
538 AC_PROG_CPP
539 AC_AIX
540 AC_EXEEXT
542 dnl libtool stuff for shared/static libraries.
543 AC_LIBTOOL_DLOPEN
544 AC_LIBTOOL_WIN32_DLL
545 AC_PROG_LIBTOOL
547 dnl Checks for programs.
548 AC_PROG_INSTALL
549 AC_PROG_LN_S
550 AC_PROG_MAKE_SET
551 AC_PATH_PROG(PSPROG,ps)
552 AC_PATH_PROG(PERLPROG,perl)
553 AC_CHECK_PROGS(WHOAMI, whoami logname, whoami)
554 AC_CHECK_PROGS(SED,sed gsed)
555 AC_CHECK_PROG(AUTOCONF, autoconf)
556 AC_CHECK_PROG(AUTOHEADER, autoheader)
557 if test "x$ac_cv_prog_AUTOCONF" = "x"; then
558         AUTOCONF=":"
559         AC_SUBST(AUTOCONF)
561 if test "x$ac_cv_prog_AUTOHEADER" = "x"; then
562         AUTOHEADER=":"
563         AC_SUBST(AUTOHEADER)
566 AC_PATH_PROG(UNAMEPROG,uname)
567 AC_DEFINE_UNQUOTED(UNAMEPROG,"$UNAMEPROG")
569 AC_C_CONST
570 AC_C_INLINE
572 dnl get version number.
573 AC_MSG_CHECKING(for net-snmp version number)
574 VERSION=`grep NetSnmpVersionInfo.*= $srcdir/snmplib/snmp_version.c | sed 's/";.*//;s/.*"//;s/pre/0./;'`
575 changequote(, )
576 RELEASEVERSION=`echo $VERSION | sed 's/^\([0-9]\)\.\([0-9]\)/\1:\2:0/'`
577 changequote([, ])
578 AC_SUBST(VERSION)
579 AC_SUBST(RELEASEVERSION)
580 AC_MSG_RESULT($VERSION)
581 AC_MSG_CACHE_ADD(Net-SNMP Version:           $VERSION)
583 dnl super type checking
584 AC_MSG_CHECKING(for developer gcc flags)
585 if test "x$developer" = "xyes" -a "x$ac_cv_prog_gcc" = "xyes"; then
586   DEVFLAGS="-Wall -Wstrict-prototypes -Wwrite-strings -Wcast-qual -Wno-char-subscripts"
587 else
588   DEVFLAGS=""
590 AC_MSG_RESULT($DEVFLAGS)
591 AC_SUBST(DEVFLAGS)
593 dnl system check
594 AC_CANONICAL_SYSTEM
595 changequote(, )
596 PARTIALTARGETOS=`echo $target_os | sed 's/[-._].*//'`
597 CFLAGS="$CFLAGS -D$PARTIALTARGETOS"
598 changequote([, ])
599 AC_MSG_CACHE_ADD(Building for:               $PARTIALTARGETOS)
602 dnl check for special includes and pick one
605 AC_MSG_CHECKING(for system include file)
606 changequote(, )
607 filebase=$target_os
608 dnl ignore binary format indication
609 filebase=`echo $filebase | sed 's/elf//'`
610 filebase=`echo $filebase | sed 's/aout//'`
611 filebase=`echo $filebase | sed 's/ecoff//'`
612 filebase=`echo $filebase | sed 's/coff//'`
613 while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/system/$filebase.h
615     last=$filebase
616     filebase=`echo $filebase | sed 's/[-._][^-._]*$//'`
617     if test "x$filebase" = "x$last"; then
618         filebase=`echo $filebase | sed 's/[0-9]*$//'`
619     fi
620 done
622 if test "x$filebase" = "x$last"; then
623     filebase="generic"
625 ac_cv_SYSTEM_INCLUDE_FILE="net-snmp/system/$filebase.h"
627 changequote([, ])
628 AC_MSG_RESULT($ac_cv_SYSTEM_INCLUDE_FILE)
629 AC_DEFINE_UNQUOTED(SYSTEM_INCLUDE_FILE, "$ac_cv_SYSTEM_INCLUDE_FILE")
631 dnl second part, the CPU type.
633 AC_MSG_CHECKING(for machine-type include file)
634 changequote(, )
635 filebase=$target_cpu
636 while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/machine/$filebase.h
638     last=$filebase
639     filebase=`echo $filebase | sed 's/[-._][^-._]*$//'`
640 done
642 if test "x$filebase" = "x$last"; then
643     filebase="generic"
645 ac_cv_MACHINE_INCLUDE_FILE="net-snmp/machine/$filebase.h"
647 changequote([, ])
648 AC_MSG_RESULT($ac_cv_MACHINE_INCLUDE_FILE)
649 AC_DEFINE_UNQUOTED(MACHINE_INCLUDE_FILE, "$ac_cv_MACHINE_INCLUDE_FILE")
651 AC_PATH_PROG(CCPATH,$CC)
652 dnl watch out for /usr/ucb/cc on solaris, it doesn't work with this package.
653 case $target_os in
654     bsdi*)
655         if test "x$CCPATH" = "x/usr/ucb/cc" -o "x$CCPATH" = "x/usr/bin/cc"; then
656             AC_MSG_ERROR([
658 *** The BSDI /usr/ucb/cc compiler does not work with this package.  
659 *** Please run configure with --with-cc=gcc
661         fi
662     ;;
663     solaris*)
664         if test "x$CCPATH" = "x/usr/ucb/cc"; then
665             AC_MSG_ERROR([
667 *** The solaris /usr/ucb/cc compiler does not work with this package.  
668 *** Please put a different compiler in your path first or run
669 *** configure with --with-cc=XX, where XX is the compiler you want to use.
671         fi
672     ;;
673 esac
674     
675 AC_MSG_CHECKING(for additional cpp flags)
676 dnl gcc extra CPPFLAGS
677 if test "x$GCC" = "xyes" -a "x$CPP" = "x$CC -E"; then
678   dnl extra cpp flags for gnu c compiler to allow .in file extensions.
679   EXTRACPPFLAGS="-x c"
680 else
681   EXTRACPPFLAGS=""
684 dnl Solaris extra cpp flags.
685 if test "x$GCC" != "xyes"; then
686   case $target_os in
687     solaris*) EXTRACPPFLAGS="$EXTRACPPFLAGS -Xs" ;;
688   esac
691 AC_SUBST(EXTRACPPFLAGS)
692 AC_MSG_RESULT($EXTRACPPFLAGS)
694 dnl Prefixes must begin with "/"
696 if test "x$prefix" = "xNONE"; then
697   prefix=/usr/local
700 fch=`echo $prefix | sed 's/\(.\).*/\1/'`
701 if test $fch != "/" ; then
702    prefix=`pwd`/$prefix
703    echo "adjusting prefix to $prefix"
706 if test "x$exec_prefix" = "xNONE"; then
707   exec_prefix=$prefix
710 fch=`echo $exec_prefix | sed 's/\(.\).*/\1/'`
711 if test $fch != "/" ; then
712    exec_prefix=`pwd`/$exec_prefix
713    echo "adjusting exec_prefix to $exec_prefix"
716 dnl Set SNMPLIBPATH & SNMPSHAREPATH
718 SNMPLIBPATH=""
719 tmpset="$libdir/snmp"
720 while test "x$tmpset" != "x$SNMPLIBPATH"; do
721   SNMPLIBPATH="$tmpset"
722   eval tmpset="$tmpset"
723 done
724 AC_DEFINE_UNQUOTED(SNMPLIBPATH,"$SNMPLIBPATH")
725 AC_DEFINE_UNQUOTED(SNMPDLMODPATH,"$SNMPLIBPATH/dlmod")
727 SNMPSHAREPATH=""
728 tmpset="$datadir/snmp"
729 while test "x$tmpset" != "x$SNMPSHAREPATH"; do
730   SNMPSHAREPATH="$tmpset"
731   eval tmpset="$tmpset"
732 done
733 AC_DEFINE_UNQUOTED(SNMPSHAREPATH,"$SNMPSHAREPATH")
735 if test "x$DEFAULT_MIBDIRS" = "x"; then
736   AC_DEFINE_UNQUOTED(DEFAULT_MIBDIRS,"\$HOME/.snmp/mibs:$SNMPSHAREPATH/mibs")
739 SNMPCONFPATH=""
740 tmpset="$sysconfdir/snmp"
741 while test "x$tmpset" != "x$SNMPCONFPATH"; do
742   SNMPCONFPATH="$tmpset"
743   eval tmpset="$tmpset"
744 done
745 AC_DEFINE_UNQUOTED(SNMPCONFPATH,"$SNMPCONFPATH")
746 AC_SUBST(SNMPCONFPATH)
748 dnl guess IPv6 stack type.
749 if test "x$enable_ipv6" = "xyes"; then
750         v6type=unknown
751         v6lib=none
752         v6trylibc=no
754         AC_MSG_CHECKING([ipv6 stack type])
755         for i in v6d toshiba kame inria zeta linux-glibc linux-inet6; do
756                 case $i in
757                 v6d)
758                         AC_EGREP_CPP(yes, [dnl
759 #include </usr/local/v6/include/sys/types.h>
760 #ifdef __V6D__
762 #endif],
763                                 [v6type=$i; v6lib=v6;
764                                 v6libdir=/usr/local/v6/lib;
765                                 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
766                         ;;
767                 toshiba)
768                         AC_EGREP_CPP(yes, [dnl
769 #include <sys/param.h>
770 #ifdef _TOSHIBA_INET6
772 #endif],
773                                 [v6type=$i; v6lib=inet6;
774                                 v6libdir=/usr/local/v6/lib;
775                                 CFLAGS="-DINET6 $CFLAGS"])
776                         ;;
777                 kame)
778                         AC_EGREP_CPP(yes, [dnl
779 #include <netinet/in.h>
780 #ifdef __KAME__
782 #endif],
783                                 [v6type=$i; v6lib=inet6;
784                                 v6libdir=/usr/local/v6/lib;
785                                 v6trylibc=yes;
786                                 CFLAGS="-DINET6 $CFLAGS"])
787                         ;;
788                 inria)
789                         AC_EGREP_CPP(yes, [dnl
790 #include <netinet/in.h>
791 #ifdef IPV6_INRIA_VERSION
793 #endif],
794                                 [v6type=$i;
795                                 v6lib=dummy;
796                                 v6libdir=none;
797                                 v6trylibc=yes;
798                                 CFLAGS="-DINET6 $CFLAGS"])
799                         ;;
800                 zeta)
801                         AC_EGREP_CPP(yes, [dnl
802 #include <sys/param.h>
803 #ifdef _ZETA_MINAMI_INET6
806 #endif],
807                                 [v6type=$i; v6lib=inet6;
808                                 v6libdir=/usr/local/v6/lib;
809                                 CFLAGS="-DINET6 $CFLAGS"])
810                         ;;
811                 linux-glibc)
812                         AC_EGREP_CPP(yes, [dnl
813 #include <features.h>
814 #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC_ > 2))
816 #endif],
817                                 [v6type=$i;
818                                 v6lib=dummy;
819                                 v6libdir=none;
820                                 v6trylibc=yes;
821                                 CFLAGS="-DINET6 $CFLAGS"])
822                         ;;
823                 linux-inet6)
824                         if test -d /usr/inet6; then
825                                 v6type=$i
826                                 v6lib=inet6
827                                 v6libdir=/usr/inet6/lib
828                                 CFLAGS="-DINET6 $CFLAGS"
829                         fi
830                         ;;
831                 esac
832                 if test "$v6type" != "unknown"; then
833                         break
834                 fi
835         done
837         if test "$v6lib" != "none"; then
838                 if test -d $v6libdir -a -f $v6libdir/lib$v6lib.a; then
839                         LIBS="-L$v6libdir -l$v6lib $LIBS"
840                         enable_ipv6="yes"
841                         AC_MSG_RESULT(["$v6type, $enable_ipv6, using lib$v6lib"])
842                 elif test "$v6trylibc" = "yes"; then
843                         enable_ipv6="yes"
844                         AC_MSG_RESULT(["$v6type, $enable_ipv6, using libc"])
845                 else
846                         AC_MSG_ERROR(no IPv6 library lib$v6lib.a found.)
847                         exit 1
848                 fi
849         else
850                 enable_ipv6="no"
851                 AC_MSG_RESULT(["$v6type, $enable_ipv6"])
852         fi
856 dnl Maybe add library extensions for thread mutex locking.
859 if test "x$with_res_locks" = "xyes"; then
860   AC_DEFINE(NS_REENTRANT)
863     case $target_os in
865     aix*)
866         CC_RUNTIME_ARG="$CC_RUNTIME_ARG -lpthreads"
867         ;;
869     *)
870         ;;
872     esac
875 AC_MSG_CHECKING(whether we have to build PIC code)
876 echo "$with_mib_modules" | grep "ucd-snmp/dlmod" >/dev/null
877 if test $? -eq 0 ; then
878         DLLIBS="-ldl"
879         LIB_CFLAGS="$LIB_CFLAGS $SHLIB_CFLAGS"
880         AC_MSG_RESULT(yes)
881 else
882         DLLIBS=""
883         AC_MSG_RESULT(no)
887 dnl Do transport module processing.
889 AC_MSG_CHECKING(for and configuring transport modules to use)
890 transport_src_list=""
891 transport_hdr_list=""
892 transport_def_list=""
893 transport_result_list=""
894 transport_add_list=""
895 new_with_transport_list=`echo $with_transports | sed 's/,/ /g;'`
896 new_with_out_transport_list=`echo $with_out_transports | sed 's/,/ /g;'`
899 dnl Add the default transports to the list
901 if test "x$PARTIALTARGETOS" = "xcygwin"; then
902   transport_default_list="UDP TCP Callback"
903 else
904   transport_default_list="UDP TCP Unix Callback"
906 if test "x$enable_ipv6" = "xyes"; then
907   transport_default_list="UDPIPv6 TCPIPv6 $transport_default_list"
909 for i in $transport_default_list; do
910   if echo " $new_with_transport_list " | grep " $i " >/dev/null; then
911     :
912   else
913     transport_add_list="$i $transport_add_list"
914   fi
915 done
916 new_transport_list="$transport_add_list $new_with_transport_list"
918 for i in $new_transport_list; do
919   if echo " $new_with_out_transport_list " | grep " $i " >/dev/null; then
920     if test "x$i" = "xUDP"; then
921       echo
922       AC_MSG_ERROR(It is not possible to compile without UDP/IP support.)
923     fi
924   else
925     if test "x$i" = "xAAL5PVC"; then
926       if test "x$PARTIALTARGETOS" != "xlinux"; then
927         echo
928         AC_MSG_ERROR(AAL5 PVC support unavailable for this platform (Linux only))
929       fi
930     fi
931     if test "x$i" = "xIPX"; then
932       if test "x$PARTIALTARGETOS" != "xlinux"; then
933         echo
934         AC_MSG_ERROR(IPX support unavailable for this platform (Linux only))
935       fi
936     fi
937     if test "x$i" = "xUnix"; then
938       if test "x$PARTIALTARGETOS" = "xcygwin"; then
939         echo
940         AC_MSG_ERROR(Unix domain protocol support unavailable for this platform)
941       fi
942     fi
943     transport_src="snmp"$i"Domain.c"
944     transport_hdr="snmp"$i"Domain.h"
945     rel_transport_src="snmplib/"$transport_src
946     rel_transport_hdr="include/net-snmp/library/"$transport_hdr
947     if test -f "$srcdir/$rel_transport_src"; then
948       transport_result_list="$transport_result_list $i"
949       transport_src_list="$transport_src $transport_src_list"
950       if test -f "$srcdir/$rel_transport_hdr"; then
951         transport_hdr_list="$transport_hdr $transport_hdr_list"
952       fi
953       transport_def=`echo $i | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
954       transport_def_list="SNMP_TRANSPORT_"$transport_def"_DOMAIN $transport_def_list"
955     else
956       echo
957       AC_MSG_ERROR(Cannot find file $transport_src to support SNMP transport domain $i.)
958     fi
959   fi
960 done
961 transport_obj_list=`echo " $transport_src_list " | sed 's/\.c/\.o/g'`
962 transport_lobj_list=`echo " $transport_src_list " | sed 's/\.c/\.lo/g'`
963 AC_SUBST(transport_hdr_list)
964 AC_SUBST(transport_src_list)
965 AC_SUBST(transport_obj_list)
966 AC_SUBST(transport_lobj_list)
967 for i in $transport_def_list; do
968   AC_DEFINE_UNQUOTED($i)
969 done
970 AC_MSG_RESULT($transport_result_list.)
971 AC_MSG_CACHE_ADD(Network transport support: $transport_result_list)
974 dnl Security modules to use
975 dnl 
977 AC_MSG_CHECKING(for security modules to use)
978 security_def_list="usm"
979 security_src_list=""
980 security_obj_list=""
981 security_lobj_list=""
982 security_init_file="snmplib/snmpsm_init.h"
983 security_incl_file="include/net-snmp/library/snmpv3-security-includes.h"
984 new_with_security=`echo $with_security_modules | sed 's/,/ /g;'`
985 new_with_out_security=`echo $with_out_security_modules | sed 's/,/ /g;'`
987 if test ! -d include; then
988   mkdir include
990 if test ! -d include/net-snmp; then
991   mkdir include/net-snmp
993 if test ! -d include/net-snmp/agent; then
994   mkdir include/net-snmp/agent
996 if test ! -d include/net-snmp/library; then
997   mkdir include/net-snmp/library
999 if test ! -d include/ucd-snmp; then
1000   mkdir include/ucd-snmp
1003 if test ! -d snmplib; then
1004   mkdir snmplib
1006 echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $security_init_file
1007 echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $security_incl_file
1009 for i in $security_def_list; do
1010   if echo " $new_with_out_security " | grep " $i " > /dev/null; then
1011     if test "x$i" = "xusm"; then
1012         echo
1013         AC_MSG_ERROR(The USM security module is mandatory)
1014     fi
1015   else
1016     new_with_security="$new_with_security $i"
1017   fi
1018 done
1020 for i in $new_with_security; do
1021   cfile="snmp"$i".c"
1022   hfile="snmp"$i".h"
1024   # make sure support exists for it
1025   if test -f $srcdir"/snmplib/"$cfile -a -f $srcdir"/include/net-snmp/library/"$hfile; then
1026     :
1027   else
1028     echo
1029     AC_MSG_ERROR(No such security module: $i / $cfile / $hfile)
1030   fi
1032   # define a bunch of stuff to enable it
1033   security_src_list="$security_src_list $cfile"
1034   security_hdr_list="$security_hdr_list $hfile"
1035   security_obj_list="$security_obj_list snmp"$i".o"
1036   security_lobj_list="$security_lobj_list snmp"$i".lo"
1037   def_name="SNMP_SECMOD_"`echo $i | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1038   echo "init_"$i"();" >> $security_init_file
1039   echo "#include <net-snmp/library/$hfile>" >> $security_incl_file
1040   AC_DEFINE_UNQUOTED($def_name)
1041 done
1043 AC_SUBST(security_src_list)
1044 AC_SUBST(security_obj_list)
1045 AC_SUBST(security_lobj_list)
1046 AC_SUBST(security_hdr_list)
1047 AC_MSG_RESULT($new_with_security)
1048 AC_MSG_CACHE_ADD(SNMPv3 Security Modules:   $new_with_security)
1051 dnl Handle the special case of KSM to see which crypto API we support
1054 for sec in $new_with_security
1056   if test x$sec = xksm; then
1057     AC_MSG_CHECKING(to see which crypto API we need to use)
1059     AC_CHECK_FUNC(krb5_c_encrypt,[
1060       AC_MSG_RESULT(new MIT crypto API)
1061       AC_DEFINE(MIT_NEW_CRYPTO)],[
1062       AC_MSG_RESULT(old MIT crypto API)])
1063   fi
1064 done
1067 dnl Do hairy agent module processing.
1069 AC_MSG_CHECKING(for and configuring mib modules to use)
1070 changequote(, )
1072 mibdir="agent/mibgroup"
1073 module_list=""
1074 module_list_code=""
1075 new_with_mib_modules=`echo $with_mib_modules | sed 's/,/ /g;'`
1076 new_with_out_mib_modules=`echo $with_out_mib_modules | sed 's/,/ /g;'`
1077 new_module_list="mibII ucd_snmp snmpv3mibs notification target agent_mibs agentx agent_mibs utilities $new_with_mib_modules"
1078 default_mibs=IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB:NOTIFICATION-LOG-MIB
1080 if test "x$mini_agent" = "xyes"; then
1081 new_with_out_mib_modules="mibII $new_with_out_mib_modules"
1082 new_module_list="snmpv3mibs mibII/snmp_mib mibII/system_mib mibII/sysORTable mibII/vacm_vars $new_with_mib_modules"
1083 default_mibs=SNMPv2-MIB:RFC1213-MIB
1084 default_mibs_install=" "
1088 if test "x$enable_ipv6" = "xyes"; then
1089         new_module_list="$new_module_list mibII/ipv6"
1092 dnl Create include file list for snmp_vars.h to use.
1093 if test ! -d agent; then
1094   mkdir agent
1096 if test ! -d agent/mibgroup; then
1097   mkdir agent/mibgroup
1099 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
1100   rm -f $i
1101   echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $i
1102 done
1104 test_modules="$new_module_list"
1105 new_module_list=""
1106 module_list_h=""
1108 for i in $test_modules
1109  do
1110   if echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
1111     :
1112   else
1113     new_module_list="$new_module_list $i"
1114   fi
1115 done
1117 changequote([, ])
1118 AC_MSG_RESULT($new_module_list.)
1119 AC_MSG_CACHE_ADD(Agent MIB code:            $new_module_list)
1121 AC_MSG_CHECKING(for and configuring mib modules pieces to use)
1122 FD=AC_FD_MSG
1123 changequote(, )
1125 while test "x$new_module_list" != "x"; do
1126   for i in $new_module_list
1127     do
1128     if echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
1129       :
1130     else
1131       if test -f $srcdir/$mibdir/$i.h; then
1132         new_list=""
1133         new_list_arch=`grep config_arch_require $srcdir/$mibdir/$i.h | sed 's/.*config_arch_require(\(.*\), *\(.*\)).*/\1-xarchx-\2/'`
1134         if test "x$new_list_arch" != "x"; then
1135           for j in $new_list_arch
1136             do
1137             archtest=`echo $j | sed 's/-xarchx-.*//'`
1138             if test "x$target_os" = "x$archtest" -o "x$PARTIALTARGETOS" = "x$archtest"; then
1139               new_list="$new_list `echo $j | sed 's/.*-xarchx-//'`"
1140             fi
1141           done
1142         fi
1143         new_list="$new_list `grep config_require $srcdir/$mibdir/$i.h | sed 's/.*config_require(\(.*\)).*/\1/'`"
1144         if test "x$new_list" != "x"; then
1145           for j in $new_list
1146             do
1147             if test ! -f $srcdir/$mibdir/$j.h; then
1148               changequote([, ])
1149               AC_MSG_ERROR(mib module "$i" requires module "$j" but $j.h or $j.c could not be found in $srcdir/$mibdir)
1150               changequote(, )
1151             elif echo " $new_with_out_mib_modules " | grep " $j " > /dev/null; then
1152               changequote([, ])
1153               AC_MSG_WARN(mib module "$i" requires module "$j" but you told me to compile without it)
1154               changequote(, )
1155             elif echo " $module_list $new_list_two $new_module_list " | grep " $j " > /dev/null; then
1156               :
1157             else
1158               new_list_two="$new_list_two $j"
1159             fi
1160           done
1161         fi
1162         new_mibs=`grep config_add_mib $srcdir/$mibdir/$i.h | sed 's/.*config_add_mib(\(.*\)).*/\1/'`
1163         if test "x$new_mibs" != "x"; then
1164             for j in $new_mibs
1165                 do
1166                 if test "x`echo :$default_mibs: | grep :$j:`" = "x"; then
1167                     default_mibs="$default_mibs:$j"
1168                 fi
1169                 if test -f $srcdir/mibs/$j.txt; then
1170                     if echo $default_mibs_install | grep " $j " > /dev/null; then
1171                             :
1172                     else
1173                             default_mibs_install="$default_mibs_install $j.txt"
1174                     fi
1175                 fi
1176             done
1177         fi
1178       else
1179         changequote([, ])
1180         AC_MSG_ERROR(module files $i.h or $i.c could not be found in $srcdir/$mibdir)
1181         changequote(, )
1182       fi
1183       module_list="$module_list $i"
1184       echo '#include "'"mibgroup/$i.h"'"' >> $mibdir/mib_module_includes.h
1185       module_list_h="$module_list_h mibgroup/$i.h"
1186       if test -f $srcdir/$mibdir/$i.c; then
1187         module_list_code="$module_list_code $i"
1188         mnm=`echo $i | sed 's/.*\///;s/\.c$//;'`
1189         temp_init=`grep init_$mnm $srcdir/$mibdir/$i.c | grep -v _init_$mnm`
1190         if test "x$temp_init" != "x"; then
1191             echo "  if (should_init(\"$mnm\")) init_$mnm();" >> $mibdir/mib_module_inits.h
1192         fi
1193         if grep shutdown_`basename $i` $srcdir/$mibdir/$i.c > /dev/null; then
1194             echo "  if (should_init(\"`basename $i`\")) shutdown_`basename $i`();" >> $mibdir/mib_module_shutdown.h
1195         fi
1196       fi
1197       if test "x`echo $i | sed 's/\///g;'`" != "x$i"; then
1198         mnd=`echo $i | sed 's/\/[^/]*$//;'`
1199         if test ! -d ./$mibdir/$mnd; then
1200             module_directories="$module_directories ./$mibdir/$mnd"
1201         fi
1202       fi
1203       if grep config_load_mib $srcdir/$mibdir/$i.h > /dev/null 2>&1; then
1204         changequote([, ])
1205         AC_MSG_WARN(mib module "$i" uses the "config_load_mib" directive, which is no longer supported.  It probably won't work.)
1206         changequote(, )
1207       fi
1208       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
1209       sym="`echo ${i} | sed 's/[^a-zA-Z0-9_]/_/g' | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`"
1210       echo "/* Define if compiling with the ${i} module files.  */" >> include/net-snmp/agent/mib_module_config.h
1211       echo "#define USING_${sym}_MODULE 1" >> include/net-snmp/agent/mib_module_config.h
1212       echo " " >> include/net-snmp/agent/mib_module_config.h
1213       echo $ac_n " $i$ac_c" >&$FD
1214     fi
1215   done
1216   new_module_list="$new_list_two"
1217   new_list_two=""
1218 done
1219 module_list_o=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.o /g'`
1220 module_list_lo=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.lo /g'`
1221 module_list_c=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.c /g'`
1222 mibgroup_list_o=`echo " $module_list_o " | sed 's@ \([^ ]*\)\.o@ mibgroup/\1.o @g'`
1223 mibgroup_list_lo=`echo " $module_list_lo " | sed 's@ \([^ ]*\)\.lo@ mibgroup/\1.lo @g'`
1224 changequote([, ])
1225 MODULE_LIST=$module_list_code
1226 AC_SUBST(MODULE_LIST)
1227 AC_SUBST(module_list_c)
1228 AC_SUBST(module_list_h)
1229 AC_SUBST(module_list_o)
1230 AC_SUBST(module_list_lo)
1231 AC_SUBST(mibgroup_list_o)
1232 AC_SUBST(mibgroup_list_lo)
1233 AC_SUBST(module_list)
1234 AC_SUBST(default_mibs_install)
1236 AC_MSG_RESULT(.)
1238 AC_MSG_CHECKING(if directories need to be created)
1239 for i in $module_directories; do
1240   $srcdir/mkinstalldirs $i
1241 done
1242 AC_MSG_RESULT(.)
1244 AC_MSG_CHECKING(default mib files to read)
1245 if test "x$DEFAULT_MIBS" = "x"; then
1246   DEFAULT_MIBS="$default_mibs"
1248 AC_DEFINE_UNQUOTED(DEFAULT_MIBS,"$DEFAULT_MIBS")
1249 AC_MSG_RESULT($DEFAULT_MIBS)
1252 dnl Check for kernel location
1255 AC_CACHE_CHECK(for location of system kernel,ac_cv_KERNEL_LOC,
1256 [ac_cv_KERNEL_LOC="unknown"
1257 dnl First determine if test expects a -f or a -c (character device (SYSV))
1259 if test -c /dev/null; then
1260   CFLAG="-c"
1261 elif test -f /dev/null; then
1262   CFLAG="-f"
1263 else
1264   dnl fall back
1265   CFLAG="-f"
1267 for i in /vmunix /hp-ux /stand/vmunix /dev/ksyms /kernel/unix /kernel/genunix /netbsd /unix /kernel /bsd /mach_kernel
1268   do
1269   if test -f $i -o $CFLAG $i; then
1270     ac_cv_KERNEL_LOC="$i"
1271     break;
1272   fi
1273 done
1274 if test $i = "unknown"; then
1275   AC_MSG_WARN(Can't find system kernel...  Setting to /vmunix)
1276   ac_cv_KERNEL_LOC="/vmunix"
1280 AC_DEFINE_UNQUOTED(KERNEL_LOC,"$ac_cv_KERNEL_LOC")
1283 dnl Check for mount table location
1286 AC_CACHE_CHECK(for mount table location,ac_cv_ETC_MNTTAB,
1287 [ac_cv_ETC_MNTTAB="unknown"
1288 for i in /etc/mnttab /etc/mtab /etc/filesystems
1289   do
1290   if test -f $i; then
1291     ac_cv_ETC_MNTTAB="$i"
1292     break;
1293   fi
1294 done
1297 AC_DEFINE_UNQUOTED(ETC_MNTTAB,"$ac_cv_ETC_MNTTAB")
1299 dnl Check for /dev/dmem or /dev/drum location
1300 AC_CACHE_CHECK(for location of swap device,ac_cv_DMEM_LOC,
1302 dnl First determine if test expects a -f or a -c (character device (SYSV))
1304 if test -f /dev/kmem; then
1305   CTEST="test -f"
1306 elif test -c /dev/kmem; then
1307   CTEST="test -c"
1308 else
1309   dnl fall back
1310   CTEST="test -f"
1313 if $CTEST /dev/dmem; then
1314   ac_cv_DMEM_LOC="/dev/dmem"
1315 elif $CTEST /dev/drum; then
1316   ac_cv_DMEM_LOC="/dev/drum"
1317 else
1318   ac_cv_DMEM_LOC="none"
1322 if test "x$ac_cv_DMEM_LOC" != "xnone"; then
1323   AC_DEFINE_UNQUOTED(DMEM_LOC,"$ac_cv_DMEM_LOC")
1326 dnl forced efence turned off.
1327 dnl if test "x$developer" = "xyes" -a "x$use_efence" != "xno"; then
1328 dnl    use_efence="yes"
1329 dnl fi
1331 if test "x$use_efence" = "xyes"; then
1332     AC_CHECK_LIB(efence, EF_Exit)
1335 dnl Checks for libraries.
1336 dnl AC_CHECK_LIB(des, main)
1337 AC_CHECK_LIB(m, asin)
1338 dnl nlist is needed for uptime on some sytems in the generic library
1339 AC_CHECK_LIB(elf, nlist)
1341 dnl On some platforms (Irix) libnsl and libsocket should not be used.
1342 AC_CHECK_FUNC(gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME),
1343         AC_CHECK_LIB(nsl, gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME)
1344         LIBS="${LIBS} -lnsl"))
1345 AC_CHECK_FUNC(getservbyname, AC_DEFINE(HAVE_GETSERVBYNAME),
1346         AC_CHECK_LIB(socket, getservbyname, AC_DEFINE(HAVE_GETSERVBYNAME)
1347         LIBS="${LIBS} -lsocket"))
1349 dnl Replace `main' with a function in -lkstat:
1350 AC_CHECK_LIB(kstat, kstat_lookup)
1351 dnl Check for nlist in mld (irix)
1352 AC_CHECK_LIB(mld, nlist)
1354 dnl Check for security related functions
1355 if test "x$tryopenssl" != "xno"; then
1356     if test "x$tryrsaref" != "xno"; then
1357          AC_CHECK_LIB(rsaref, RSAPrivateDecrypt)
1358          AC_CHECK_LIB(RSAglue, RSA_PKCS1_RSAref)
1359     fi
1361     AC_CHECK_LIB(crypto, EVP_md5)
1362     AC_CHECK_FUNCS(AES_cfb128_encrypt)
1365 dnl Check for libraries that the agent needs
1366 dnl saving old libraries
1367 NONAGENTLIBS=$LIBS
1369 dnl check for tcp wrapper support
1370 _cppflags="${CPPFLAGS}"
1371 _ldflags="${LDFLAGS}"
1373 AC_ARG_WITH(libwrap,
1374 [  --with-libwrap[=LIBPATH] Compile in libwrap (tcp_wrappers) support.],[
1375   if test "$with_libwrap" != "no"; then
1376     if test "$with_libwrap" != "yes"; then
1377       CPPFLAGS="${CPPFLAGS} -I$with_libwrap/include"
1378       LDFLAGS="${LDFLAGS} -L$with_libwrap/lib"
1379     fi
1381     _libs=${LIBS}
1382     AC_CHECK_HEADER(tcpd.h, ,
1383             AC_MSG_ERROR(Asked to use libwrap but I couldn't find tcpd.h.))
1385     LIBS="$LIBS -lwrap"
1386         AC_MSG_CHECKING(for TCP wrappers library -lwrap)
1387         AC_TRY_LINK([#include <tcpd.h>
1388                      int allow_severity = 0;
1389                      int deny_severity  = 0;
1390                     ],[hosts_access((void *)0)],
1391         [
1392             AC_MSG_RESULT(yes)
1393             AC_DEFINE(USE_LIBWRAP)
1394             test "$with_libwrap" != no -a "$with_libwrap" != yes && WRAPLIBS="-L$with_libwrap/lib"
1395             WRAPLIBS="$WRAPLIBS -lwrap"],
1396         [
1397             AC_MSG_RESULT(no)
1398             dnl Linux RedHat 6.1 won't link libwrap without libnsl
1399             AC_CHECK_FUNC(yp_get_default_domain, ,
1400                 AC_CHECK_LIB(nsl, yp_get_default_domain))
1401             AC_MSG_CHECKING(for TCP wrappers library -lwrap linked with -lnsl)
1402             AC_TRY_LINK([#include <tcpd.h>
1403                          int allow_severity = 0;
1404                          int deny_severity  = 0;
1405                         ],[hosts_access((void *)0)],
1407                         AC_MSG_RESULT(yes)
1408                         AC_DEFINE(USE_LIBWRAP)
1409                         test "$with_libwrap" != no -a "$with_libwrap" != yes && WRAPLIBS="-L$with_libwrap/lib"
1410                         WRAPLIBS="$WRAPLIBS -lwrap -lnsl",
1412                         AC_MSG_RESULT(no)
1413                         AC_MSG_ERROR(Asked to use libwrap but I couldn't find it.))
1414         ])
1415     CPPFLAGS=${_cppflags}
1416     LDFLAGS=${_ldflags}
1417     LIBS=${_libs}
1418   fi
1422 dnl rpm libraries only needed for the host resources mib software
1423 dnl installed tables (on linux in particular)
1425 if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
1426   dnl ARG.  RPM is a real pain.
1427   dnl FWIW librpm.la, librpmio.la, and libpopt.la have correct dependencies.
1428   _rpmlibs=""
1430   dnl zlib is required for newer versions of rpm
1431   _cppflags="${CPPFLAGS}"
1432   _ldflags="${LDFLAGS}"
1434   AC_ARG_WITH(zlib,
1435   [  --with-zlib[=DIR]        use libz in DIR],[
1436     if test -d "$withval"; then
1437       CPPFLAGS="${CPPFLAGS} -I$withval/include"
1438       LDFLAGS="${LDFLAGS} -L$withval/lib"
1439     fi
1440   ])
1442   dnl dunno if this is needed for rpm-4.0.x, earlier probably needs.
1443   AC_CHECK_HEADER(zlib.h,
1444       AC_CHECK_LIB(z, gzread, , CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1445       CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
1447   dnl two variants of bzip2 need checking.
1448   AC_CHECK_LIB(bz2, bzread, [_rpmlibs="$_rpmlibs -lbz2"],
1449      AC_CHECK_LIB(bz2, BZ2_bzread, [_rpmlibs="$_rpmlibs -lbz2"],))
1451   dnl two variants of db1 need checking.
1452   AC_CHECK_LIB(db1, dbopen, [_rpmlibs="-ldb1 $_rpmlibs"],
1453      AC_CHECK_LIB(db, dbopen, [_rpmlibs="-ldb $_rpmlibs"]))
1455   dnl two variants of db3 need checking.
1456   AC_CHECK_LIB(db-3.1, db_create, [_rpmlibs="-ldb-3.1 $_rpmlibs"],
1457     AC_CHECK_LIB(db-3.0, db_create, [_rpmlibs="-ldb-3.0 $_rpmlibs"]))
1458   
1459   dnl rpm-3.0.5 and later needs popt.
1460   AC_CHECK_LIB(popt, poptParseArgvString, [_rpmlibs="-lpopt $_rpmlibs"])
1461   
1462   dnl rpm-4.0.x needs rpmio.
1463   AC_CHECK_LIB(rpmio, Fopen, [_rpmlibs="-lrpmio $_rpmlibs"],,$_rpmlibs)
1464   
1465   dnl now check for rpm using the appropriate libraries.
1466   AC_CHECK_LIB(rpm, rpmGetFilesystemList,[
1467     AC_DEFINE(HAVE_LIBRPM)
1468     LIBS="-lrpm $_rpmlibs $LIBS"
1469     CFLAGS="$CFLAGS -I/usr/include/rpm"
1470   ],[
1471     dnl rpm-4.0.3 librpmdb actually contains what we need.
1472     AC_CHECK_LIB(rpmdb, rpmdbOpen,[
1473       AC_DEFINE(HAVE_LIBRPM)
1474       LIBS="-lrpmdb -lrpm $_rpmlibs $LIBS"
1475       CFLAGS="$CFLAGS -I/usr/include/rpm"
1476     ],,-lrpm $_rpmlibs)
1477   ])
1479   
1480 dnl Replace `main' with a function in -lkvm:
1481 AC_CHECK_LIB(kvm, kvm_read)
1482 dnl DYNAMIC MODULE SUPPORT
1483 AC_CHECK_LIB(dl, dlopen)
1484 AC_CHECK_FUNCS(dlopen)
1486 AC_CHECK_FUNCS(kvm_openfiles nlist knlist kvm_getprocs)
1487 echo "$with_mib_modules" | grep "ucd-snmp/diskio" >/dev/null
1488 dnl whether we need -ldevstat for diskio MIB
1489 if test $? -eq 0 ; then
1490         AC_CHECK_FUNC(getdevs, AC_DEFINE(HAVE_GETDEVS),
1491                 AC_CHECK_LIB(devstat, getdevs, AC_DEFINE(HAVE_GETDEVS)
1492                 LIBS="${LIBS} -ldevstat"))
1497 dnl Install the various perl modules
1500 if test "x$embed_perl" = "xyes" -a "x$install_perl" = "xno" ; then
1501   install_perl="yes"
1503 if test "x$install_perl" != "x" -a "x$install_perl" != "xno"; then
1504     PERLTARGS="perlmodules"
1505     PERLINSTALLTARGS="perlinstall"
1506     AC_SUBST(PERLTARGS)
1507     AC_SUBST(PERLINSTALLTARGS)
1508     AC_SUBST(PERLARGS)
1509     AC_MSG_CACHE_ADD(SNMP Perl modules:          enabled)
1513 dnl Embedded Perl specific stuff
1515 if test "x$embed_perl" = "xyes"; then
1516     myperl=$ac_cv_path_PERLPROG
1517     if test $myperl = "no"; then
1518       AC_MSG_ERROR(--enable-embedded-perl requested but no perl executable found)
1519     fi
1521     AC_MSG_CHECKING(for perl CFLAGS)
1522     perlcflags=`$myperl -MExtUtils::Embed -e ccopts`
1523     AC_MSG_RESULT($perlcflags)
1524     CPPFLAGS="$CPPFLAGS $perlcflags"
1526     AC_MSG_CHECKING(for perl LDFLAGS)
1527     perlldopts=`$myperl -MExtUtils::Embed -e ldopts`
1528     AC_MSG_RESULT($perlldopts)
1529     LIBS="$LIBS $perlldopts"
1531     dnl newer perl vs older perl call functions
1532     AC_CHECK_FUNCS(eval_pv perl_eval_pv)
1534     AC_DEFINE(NETSNMP_EMBEDDED_PERL)
1535     OTHERAGENTLIBOBJS="snmp_perl.o"
1536     OTHERAGENTLIBLOBJS="snmp_perl.lo"
1538     EMBEDPERLINSTALL="embedperlinstall"
1539     AC_SUBST(EMBEDPERLINSTALL)
1540     AC_MSG_CACHE_ADD(Embedded perl support:      enabled)
1543 dnl reset libs
1544 AGENTLIBS=$LIBS
1545 LIBS=$NONAGENTLIBS
1547 dnl Checks for header files.
1548 AC_HEADER_STDC
1549 AC_HEADER_DIRENT
1550 AC_HEADER_SYS_WAIT
1551 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)
1552 dnl FreeBSD required headers
1553 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)
1554 dnl Linux
1555 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)
1556 dnl NetBSD required headers
1557 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)
1558 dnl BSDi2 headers
1559 AC_CHECK_HEADERS(sys/mount.h vm/swap_pager.h ufs/ufs/dinode.h)
1560 dnl BSDi3 headers
1561 AC_CHECK_HEADERS(sys/stat.h sys/vnode.h ufs/ufs/quota.h ufs/ufs/inode.h)
1562 dnl irix headers
1563 AC_CHECK_HEADERS(sys/hashing.h sys/tcpipstats.h sys/sysmp.h)
1564 dnl from smux stuff
1565 AC_CHECK_HEADERS(err.h sys/filio.h sgtty.h)
1566 dnl AIX needs this for statfs func
1567 AC_CHECK_HEADERS(sys/statfs.h)
1568 dnl Dynix
1569 AC_CHECK_HEADERS(net/route.h)
1570 dnl for HostRes (HP-UX at least)
1571 AC_CHECK_HEADERS(sys/dkio.h sys/diskio.h sys/pstat.h linux/hdreg.h pkglocs.h)
1572 dnl for HostRes (Solaris 2.x at least)
1573 AC_CHECK_HEADERS(pkginfo.h,
1574     AC_CHECK_LIB(adm, pkginfo, AC_DEFINE(HAVE_PKGINFO)
1575     LIBS="${LIBS} -ladm"
1576     AGENTLIBS="${AGENTLIBS} -ladm"))
1577 dnl WIN32
1578 AC_CHECK_HEADERS(winsock.h, AGENTLIBS="${AGENTLIBS} -liphlpapi")
1579 AC_CHECK_HEADERS(io.h)
1580 dnl SCO
1581 AC_CHECK_HEADERS(sys/stream.h)
1582 dnl KAME
1583 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)
1584 dnl DYNAMIC MODULE SUPPORT
1585 AC_CHECK_HEADERS(dlfcn.h)
1586 dnl table_array helper support
1587 AC_CHECK_HEADERS(search.h)
1589 dnl RPM subdirectory path (sigh)
1590 if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
1591   AC_CHECK_HEADERS(rpmio.h,, [
1592      AC_CHECK_HEADERS(rpm/rpmio.h, CFLAGS="-I/usr/include/rpm $CFLAGS")
1593   ])
1596 dnl OpenBSD 2.6 needs netinet/in.h before netinet/in_pcb.h
1597 AC_MSG_CHECKING([for netinet/in_pcb.h])
1598 AC_CACHE_VAL(cv_have_netinet_in_pcb_h,
1599 [ AC_TRY_CPP( [
1600 #include <netinet/in.h>
1601 #include <netinet/in_pcb.h>
1602 ], cv_have_netinet_in_pcb_h=yes, cv_have_netinet_in_pcb_h=no)])
1603 AC_MSG_RESULT($cv_have_netinet_in_pcb_h)
1604 if test $cv_have_netinet_in_pcb_h = yes; then
1605   AC_DEFINE(HAVE_NETINET_IN_PCB_H)
1608 dnl NetBSD needs machine/types.h before sys/disklabel.h
1609 AC_MSG_CHECKING([for sys/disklabel.h])
1610 AC_CACHE_VAL(cv_have_sys_disklabel_h,
1611 [ AC_TRY_CPP( [
1612 #include <machine/types.h>
1613 #include <sys/disklabel.h>
1614 ], cv_have_sys_disklabel_h=yes, cv_have_sys_disklabel_h=no)])
1615 AC_MSG_RESULT($cv_have_sys_disklabel_h)
1616 if test $cv_have_sys_disklabel_h = yes; then
1617   AC_DEFINE(HAVE_SYS_DISKLABEL_H)
1620 dnl OpenSSL
1621 AC_CHECK_HEADERS(openssl/hmac.h openssl/evp.h openssl/aes.h openssl/des.h)
1623 dnl Printing
1624 AC_PATH_PROG(LPSTAT_PATH,lpstat)
1625 if test x$LPSTAT_PATH != x; then
1626     AC_DEFINE_UNQUOTED(LPSTAT_PATH,"$LPSTAT_PATH")
1627     AC_DEFINE(HAVE_LPSTAT)
1629 AC_CHECK_FUNCS(cgetnext)
1630 if test -r /etc/printcap; then
1631     AC_DEFINE(HAVE_PRINTCAP)
1634 AC_MSG_CHECKING(for authentication support)
1635 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
1636 dnl if OpenSSL is not found, default to using internal md5 support.
1637     AC_DEFINE(USE_INTERNAL_MD5)
1638     authmodes="MD5"
1639     encrmodes=""
1640     AC_MSG_RESULT(Internal MD5 Support)
1641     if test "x$askedopenssl" = "xyes"; then
1642         AC_MSG_ERROR(Asked to use OpenSSL but I couldn't find it.)
1643     fi
1644 else
1645     if test "x$tryopenssl" = "xno"; then
1646         authmodes="MD5"
1647         encrmodes=""
1648         AC_DEFINE(USE_INTERNAL_MD5)
1649         AC_MSG_RESULT(Internal MD5 Support)
1650     else
1651         authmodes="MD5 SHA1"
1652         if test "x$enable_privacy" != "xno" ; then
1653             if test $ac_cv_header_openssl_aes_h = "yes" ; then
1654                 encrmodes="DES AES128 AES192 AES256"
1655             else
1656                 encrmodes="DES"
1657             fi
1658         else
1659             encrmodes="[disabled]"
1660         fi
1661         AC_DEFINE(USE_OPENSSL)
1662         AC_MSG_RESULT(OpenSSL Support)
1663     fi
1666 AC_MSG_CACHE_ADD(Authentication support:     $authmodes)
1667 AC_MSG_CACHE_ADD(Encryption support:         $encrmodes)
1669 dnl Checks for typedefs, structures, and compiler characteristics.
1670 AC_TYPE_OFF_T
1671 AC_TYPE_PID_T
1672 AC_HEADER_TIME
1674 dnl this should use AC_CHECK_TYPE, but it's broken at least in 2.13-14
1675 dnl so we do it by hand.
1676 AC_MSG_CHECKING(for socklen_t)
1677 AC_CACHE_VAL(ac_cv_type_$1,
1678 [AC_EGREP_CPP(dnl
1679 changequote(<<,>>)dnl
1680 <<socklen_t[^a-zA-Z_0-9]>>dnl
1681 changequote([,]), [#include <sys/types.h>
1682 #if STDC_HEADERS
1683 #include <stdlib.h>
1684 #include <stddef.h>
1685 #endif
1686 #ifdef HAVE_SYS_SOCKET_H
1687 #include <sys/socket.h>
1688 #endif], ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no)])dnl
1690 AC_MSG_RESULT($ac_cv_type_socklen_t)
1691 if test $ac_cv_type_socklen_t = yes; then
1692   AC_DEFINE(HAVE_SOCKLEN_T)
1695 dnl AIX keeps in_addr_t in /usr/include/netinet/in.h
1696 AC_MSG_CHECKING(for in_addr_t)
1697 AC_CACHE_VAL(ac_cv_type_$1,
1698 [AC_EGREP_CPP(dnl
1699 changequote(<<,>>)dnl
1700 <<in_addr_t[^a-zA-Z_0-9]>>dnl
1701 changequote([,]), [#include <sys/types.h>
1702 #if STDC_HEADERS
1703 #include <stdlib.h>
1704 #include <stddef.h>
1705 #endif
1706 #ifdef HAVE_NETINET_IN_H
1707 #include <netinet/in.h>
1708 #endif], ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)])dnl
1710 AC_MSG_RESULT($ac_cv_type_in_addr_t)
1711 if test $ac_cv_type_in_addr_t = yes; then
1712   AC_DEFINE(HAVE_IN_ADDR_T)
1715 dnl Check ps args
1716 AC_CACHE_CHECK(for correct flags to ps, ac_cv_ps_flags,
1717 [if test "`($PSPROG -e 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
1718   ac_cv_ps_flags="-e"
1719 elif test "`($PSPROG -el 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
1720   ac_cv_ps_flags="-el"
1721 elif test "`($PSPROG acx 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
1722   ac_cv_ps_flags="acx"
1723 elif test "`($PSPROG -acx 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
1724   ac_cv_ps_flags="-acx"
1725 elif test "`($PSPROG -o pid,tt,state,time,ucomm 2>&1) | egrep ' ps *$' | awk '{print $NF}'`" = "ps" ; then
1726   ac_cv_ps_flags="-o pid,tt,state,time,ucomm"
1727 elif test "`($PSPROG ax 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
1728   ac_cv_ps_flags="ax"
1729 else
1730   AC_MSG_WARN(Unable to determine valid ps flags...  defaulting...)
1731   ac_cv_ps_flags="-acx"
1735 PSCMD="$PSPROG $ac_cv_ps_flags"
1736 AC_SUBST(PSCMD)
1737 AC_DEFINE_UNQUOTED(PSCMD, "$PSPROG $ac_cv_ps_flags")
1739 dnl Checks for byte order
1740 if test $cross_compiling = yes; then
1741   if test $with_endianness = "big"; then
1742     AC_DEFINE(WORDS_BIGENDIAN)
1743   elif test -z $with_endianness; then
1744     AC_MSG_ERROR([You are cross-compiling, but you have not specified the target's endianness])
1745   fi
1746 else
1747   if test $with_endianness; then
1748     AC_MSG_ERROR([Endianness has been specified, but you are not cross-compiling.])
1749   fi
1750   AC_C_BIGENDIAN
1753 dnl Checks for library functions.
1754 AC_FUNC_ALLOCA
1755 AC_PROG_GCC_TRADITIONAL
1756 AC_FUNC_MEMCMP
1757 AC_TYPE_SIGNAL
1758 AC_FUNC_GETMNTENT
1759 AC_CHECK_FUNCS(setmntent gethostname uname gettimeofday select socket strtol strtoul strlcpy)
1760 AC_CHECK_FUNCS(strchr strdup memcpy memmove index bcopy strcasestr regcomp)
1761 AC_CHECK_FUNCS(signal setsid sigset sigblock sighold strerror setenv vsnprintf snprintf)
1762 AC_CHECK_FUNCS(sigaction)
1763 AC_CHECK_FUNCS(snprintf strtoul)
1764 AC_CHECK_FUNCS(random lrand48 rand)
1765 AC_CHECK_FUNCS(execv system fork getpid strncasecmp sigalrm)
1766 if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
1767   OLDLIBS=$LIBS
1768   LIBS=$AGENTLIBS
1769   AC_CHECK_FUNCS(rpmGetPath)
1770   LIBS=$OLDLIBS
1773 AC_CHECK_FUNCS(getloadavg)
1774 AC_CHECK_FUNCS(getaddrinfo getipnodebyname)
1775 dnl BSDi2 functions differ
1776 AC_CHECK_FUNCS(statvfs statfs)
1777 AC_CHECK_FUNCS(getdtablesize)
1778 dnl freebsd2 checks
1779 AC_CHECK_FUNCS(getfsstat)
1780 AC_CHECK_FUNCS(usleep)
1781 AC_CHECK_FUNCS(setlocale)
1782 AC_CHECK_FUNCS(tcgetattr)
1783 AC_CHECK_FUNCS(if_nameindex if_freenameindex)
1784 dnl solaris checks
1785 AC_CHECK_FUNCS(getpagesize)
1786 AC_CHECK_FUNCS(mkstemp)
1787 AC_CHECK_FUNCS(getpwnam getgrnam setgid setuid setgroups)
1788 dnl High resolution alarm support
1789 AC_CHECK_FUNCS(setitimer)
1791 AC_MSG_CHECKING([for SIOCGIFADDR in sys/ioctl.h])
1792 AC_CACHE_VAL(cv_sys_ioctl_h_has_SIOCGIFADDR,
1793 [ AC_EGREP_CPP(xxxyesxxx,
1795 #ifdef HAVE_SYS_IOCTL_H
1796 #include <sys/ioctl.h>
1797 #endif
1798 #ifdef SIOCGIFADDR
1799 xxxyesxxx
1800 #endif
1801 ], cv_sys_ioctl_h_has_SIOCGIFADDR=yes, cv_sys_ioctl_h_has_SIOCGIFADDR=no)])
1802 AC_MSG_RESULT($cv_sys_ioctl_h_has_SIOCGIFADDR)
1803 if test $cv_sys_ioctl_h_has_SIOCGIFADDR = yes; then
1804   AC_DEFINE(SYS_IOCTL_H_HAS_SIOCGIFADDR)
1807 # ultrix
1808 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
1809 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
1810 [AC_TRY_RUN([
1811 #ifdef HAVE_SYS_PARAM_H
1812 #include <sys/param.h>
1813 #endif
1814 #include <sys/types.h>
1815 #ifdef HAVE_SYS_MOUNT_H
1816 #include <sys/mount.h>
1817 #endif
1818 #ifdef HAVE_SYS_FS_TYPES_H
1819 #include <sys/fs_types.h>
1820 #endif
1821 main ()
1823 struct fs_data fsd;
1824 /* Ultrix's statfs returns 1 for success,
1825    0 for not mounted, -1 for failure.  */
1826 exit (statfs (".", &fsd) != 1);
1828 fu_cv_sys_stat_fs_data=yes,
1829 fu_cv_sys_stat_fs_data=no,
1830 fu_cv_sys_stat_fs_data=no)])
1831 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
1832 if test $fu_cv_sys_stat_fs_data = yes; then
1833   AC_DEFINE(STAT_STATFS_FS_DATA)
1836 dnl check if compiler pre-processor defines __FUNCTION__
1837 AC_CACHE_CHECK(if __FUNCTION__ is defined,ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED,
1839 AC_TRY_COMPILE(,[
1840     char *cp = __FUNCTION__;
1841 ], ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=yes, ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=no)])
1843 if test "x$ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED" = "xyes"; then
1844   AC_DEFINE(HAVE_CPP_UNDERBAR_FUNCTION_DEFINED)
1847 AC_CHECK_STRUCT_FOR([
1848 #ifdef HAVE_SYS_PARAM_H
1849 #include <sys/param.h>
1850 #endif
1851 #include <sys/types.h>
1852 #include <sys/signal.h>
1853 ], sigaction, sa_sigaction, no)
1855 AC_CHECK_STRUCT_FOR([
1856 #ifdef HAVE_SYS_PARAM_H
1857 #include <sys/param.h>
1858 #endif
1859 #include <sys/types.h>
1860 #define KERNEL
1861 #define _KERNEL
1862 #include <sys/socket.h>
1863 #undef KERNEL
1864 #undef _KERNEL
1865 ], sockaddr, sa_len, no)
1867 AC_CHECK_STRUCT_FOR([
1868 #ifdef HAVE_SYS_PARAM_H
1869 #include <sys/param.h>
1870 #endif
1871 #include <sys/types.h>
1872 #define KERNEL
1873 #define _KERNEL
1874 #include <sys/socket.h>
1875 #undef KERNEL
1876 #undef _KERNEL
1877 ], sockaddr, sa_union.sa_generic.sa_family2, no)
1879 AC_CHECK_STRUCT_FOR([
1880 #ifdef HAVE_SYS_PARAM_H
1881 #include <sys/param.h>
1882 #endif
1883 #include <sys/types.h>
1884 #define KERNEL
1885 #define _KERNEL
1886 #include <sys/socket.h>
1887 #undef KERNEL
1888 #undef _KERNEL
1889 #include <net/route.h>
1890 ], rtentry, rt_dst, no)
1892 dnl checking for 4.3 vs 4.4 rtentry.
1893 AC_CACHE_CHECK(type of rtentry structure,ac_cv_RTENTRY_TYPE,
1896 dnl 4.4 compat
1897 AC_TRY_COMPILE([
1898 #ifdef HAVE_SYS_PARAM_H
1899 #include <sys/param.h>
1900 #endif
1901 #include <sys/types.h>
1902 #define KERNEL
1903 #define _KERNEL
1904 #include <sys/socket.h>
1905 #undef KERNEL
1906 #undef _KERNEL
1907 #include <net/route.h>
1910 #ifndef STRUCT_RTENTRY_HAS_RT_DST
1911 #define rt_dst rt_nodes->rn_key
1912 #endif
1914   struct rtentry rt; 
1915   rt.rt_nodes[0].rn_flags = 1;
1916   rt.rt_dst;
1917   ], ac_cv_RTENTRY_TYPE="BSD-4.4")
1919 dnl 4.3 compat
1920 if test "x$ac_cv_RTENTRY_TYPE" = "x"; then
1921 AC_TRY_COMPILE([
1922 #ifdef HAVE_SYS_PARAM_H
1923 #include <sys/param.h>
1924 #endif
1925 #include <sys/types.h>
1926 #define KERNEL
1927 #define _KERNEL
1928 #include <sys/socket.h>
1929 #undef KERNEL
1930 #undef _KERNEL
1931 #include <net/route.h>
1933 struct rtentry rt; 
1934 rt.rt_hash;
1935 ], ac_cv_RTENTRY_TYPE="BSD-4.3")
1938 dnl else ack.
1939 if test "x$ac_cv_RTENTRY_TYPE" = "x"; then
1940   AC_MSG_RESULT(Unknown)
1941   ac_cv_RTENTRY_TYPE="unknown"
1946 if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.4"; then
1947   AC_DEFINE(RTENTRY_4_4)
1950 dnl checking for alpha's ortentry vs rtentry
1951 if test "x$ac_cv_RTENTRY_TYPE" = "xunknown"; then
1952 AC_CACHE_CHECK(for struct rtentry, ac_cv_struct_rtentry,
1953 [AC_EGREP_CPP(ortentry, [#define KERNEL
1954 #include <net/route.h>
1955 ],  ac_cv_struct_rtentry=ortentry,  ac_cv_struct_rtentry=rtentry )
1956 if test "x$ac_cv_struct_rtentry" = "xrtentry" ; then
1957   ac_cv_struct_rtentry="rtentry"
1958 else
1959   ac_cv_struct_rtentry="ortentry"
1962 else
1963   RTENTRY_TYPE="rtentry"
1964   ac_cv_struct_rtentry="rtentry"
1967 if test "x$ac_cv_struct_rtentry" != "x"; then
1968   AC_DEFINE_UNQUOTED(RTENTRY,struct ${ac_cv_struct_rtentry})
1969 else
1970   AC_DEFINE(RTENTRY,struct rtentry)
1973 dnl check for 4.3's rtentry->rt_next
1974 if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.3"; then
1975 AC_CACHE_CHECK(for struct rtentry has a rt_next node, 
1976         ac_cv_struct_rtentry_rt_next,
1978 AC_TRY_COMPILE([
1979 #ifdef HAVE_SYS_PARAM_H
1980 #include <sys/param.h>
1981 #endif
1982 #include <sys/types.h>
1983 #define KERNEL
1984 #define _KERNEL
1985 #include <sys/socket.h>
1986 #undef KERNEL
1987 #undef _KERNEL
1988 #include <net/route.h>
1990 struct rtentry rt; 
1991 rt.rt_next;
1992 ], ac_cv_struct_rtentry_rt_next=yes,  ac_cv_struct_rtentry_rt_next=no )
1995 if test "x$ac_cv_struct_rtentry_rt_next" = "xyes"; then
1996   AC_DEFINE(RTENTRY_RT_NEXT)
2001 dnl Check struct rtentry for various things.
2002 AC_CHECK_STRUCT_FOR([
2003 #ifdef HAVE_SYS_PARAM_H
2004 #include <sys/param.h>
2005 #endif
2006 #include <sys/types.h>
2007 #define KERNEL
2008 #define _KERNEL
2009 #include <sys/socket.h>
2010 #undef KERNEL
2011 #undef _KERNEL
2012 #include <net/route.h>
2013 ], rtentry, rt_unit)
2015 AC_CHECK_STRUCT_FOR([
2016 #ifdef HAVE_SYS_PARAM_H
2017 #include <sys/param.h>
2018 #endif
2019 #include <sys/types.h>
2020 #define KERNEL
2021 #define _KERNEL
2022 #include <sys/socket.h>
2023 #undef KERNEL
2024 #undef _KERNEL
2025 #include <net/route.h>
2026 ], rtentry, rt_refcnt)
2028 AC_CHECK_STRUCT_FOR([
2029 #ifdef HAVE_SYS_PARAM_H
2030 #include <sys/param.h>
2031 #endif
2032 #include <sys/types.h>
2033 #define KERNEL
2034 #define _KERNEL
2035 #include <sys/socket.h>
2036 #undef KERNEL
2037 #undef _KERNEL
2038 #include <net/route.h>
2039 ], rtentry, rt_hash)
2041 AC_CHECK_STRUCT_FOR([
2042 #ifdef HAVE_SYS_PARAM_H
2043 #include <sys/param.h>
2044 #endif
2045 #include <sys/types.h>
2046 #define KERNEL
2047 #define _KERNEL
2048 #include <sys/socket.h>
2049 #undef KERNEL
2050 #undef _KERNEL
2051 #include <net/route.h>
2052 ], rtentry, rt_use)
2054 dnl Check tcpstat for tcpstat.tcp_rcvmemdrop
2055 AC_CHECK_STRUCT_FOR([
2056 #ifdef HAVE_SYS_PARAM_H
2057 #include <sys/param.h>
2058 #endif
2059 #include <sys/types.h>
2060 #include <netinet/tcp.h>
2061 #ifdef HAVE_NETINET_TCP_TIMER_H
2062 #include <netinet/tcp_timer.h>
2063 #endif
2065 #ifdef HAVE_NETINET_TCP_VAR_H
2066 #include <netinet/tcp_var.h>
2067 #endif
2068 ], tcpstat, tcp_rcvmemdrop)
2070 dnl irix checks
2072 AC_CHECK_STRUCT_FOR([
2073 #ifdef HAVE_SYS_PARAM_H
2074 #include <sys/param.h>
2075 #endif
2076 #include <sys/types.h>
2077 #include <sys/socket.h>
2078 #include <net/if.h>
2079 #ifdef HAVE_NET_IF_VAR_H
2080 #include <net/if_var.h>
2081 #endif
2082 ], ifnet, if_mtu)
2084 if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xno"; then
2085 AC_CACHE_CHECK(if _KERNEL needs to be defined for if_mtu, ac_cv_IFNET_NEEDS_KERNEL,
2087 if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xyes"; then
2088   ac_cv_IFNET_NEEDS_KERNEL=no
2089 else
2090 AC_TRY_COMPILE([
2091 #define _KERNEL 1
2092 #ifdef HAVE_SYS_PARAM_H
2093 #include <sys/param.h>
2094 #endif
2095 #include <sys/types.h>
2096 #include <sys/socket.h>
2097 #ifdef HAVE_SYS_TIME_H
2098 #include <sys/time.h>
2099 #endif
2100 #include <net/if.h>
2101 #ifdef HAVE_NET_IF_VAR_H
2102 #include <net/if_var.h>
2103 #endif
2105 struct ifnet testit;
2106 testit.if_mtu = 0;
2107 ], ac_cv_IFNET_NEEDS_KERNEL=yes, ac_cv_IFNET_NEEDS_KERNEL=no)
2111 if test "x$ac_cv_IFNET_NEEDS_KERNEL" = "xyes"; then
2112   AC_DEFINE(IFNET_NEEDS_KERNEL)
2116 AC_CHECK_STRUCT_FOR([
2117 #ifdef IFNET_NEEDS_KERNEL
2118 #define _KERNEL 1
2119 #endif
2120 #ifdef HAVE_SYS_PARAM_H
2121 #include <sys/param.h>
2122 #endif
2123 #include <sys/types.h>
2124 #include <sys/socket.h>
2125 #ifdef HAVE_SYS_TIME_H
2126 #include <sys/time.h>
2127 #endif
2128 #include <net/if.h>
2129 #ifdef HAVE_NET_IF_VAR_H
2130 #include <net/if_var.h>
2131 #endif
2132 ], ifaddr, ifa_next)
2134 dnl Check ifnet entries using macro defined in aclocal.m4.
2136 dnl XXX  Broken on FreeBSD where these are #define'd in <net/if.h>
2138 AC_CHECK_IFNET_FOR(if_baudrate)
2139 AC_CHECK_IFNET_FOR(if_baudrate.ifs_value)
2140 AC_CHECK_IFNET_FOR(if_speed)
2141 AC_CHECK_IFNET_FOR(if_type)
2142 AC_CHECK_IFNET_FOR(if_imcasts)
2143 AC_CHECK_IFNET_FOR(if_iqdrops)
2144 AC_CHECK_IFNET_FOR(if_noproto)
2145 AC_CHECK_IFNET_FOR(if_omcasts)
2146 AC_CHECK_IFNET_FOR(if_xname,no)
2147 AC_CHECK_IFNET_FOR(if_lastchange.tv_sec)
2148 AC_CHECK_IFNET_FOR(if_obytes)
2149 AC_CHECK_IFNET_FOR(if_ibytes)
2150 AC_CHECK_IFNET_FOR(if_addrlist)
2151 AC_CHECK_IFNET_FOR(if_addrhead.tqh_first)
2153 AC_CHECK_STRUCT_FOR([
2154 #include <sys/types.h>
2155 #if HAVE_NETINET_IN_H
2156 #include <netinet/in.h>
2157 #endif
2158 #if HAVE_NETINET_IP_VAR_H
2159 #include <netinet/ip_var.h>
2160 #endif
2161 #if HAVE_NETINET_UDP_H
2162 #include <netinet/udp.h>
2163 #endif
2164 #if HAVE_NETINET_UDP_VAR_H
2165 #include <netinet/udp_var.h>
2166 #endif
2167 ],udpstat,udps_discard)
2169 AC_CHECK_STRUCT_FOR([
2170 #include <sys/types.h>
2171 #if HAVE_NETINET_IN_H
2172 #include <netinet/in.h>
2173 #endif
2174 #if HAVE_NETINET_IP_VAR_H
2175 #include <netinet/ip_var.h>
2176 #endif
2177 #if HAVE_NETINET_UDP_H
2178 #include <netinet/udp.h>
2179 #endif
2180 #if HAVE_NETINET_UDP_VAR_H
2181 #include <netinet/udp_var.h>
2182 #endif
2183 ],udpstat,udps_noport)
2185 AC_CHECK_STRUCT_FOR([
2186 #include <sys/types.h>
2187 #if HAVE_NETINET_IN_H
2188 #include <netinet/in.h>
2189 #endif
2190 #if HAVE_NETINET_IP_VAR_H
2191 #include <netinet/ip_var.h>
2192 #endif
2193 #if HAVE_NETINET_UDP_H
2194 #include <netinet/udp.h>
2195 #endif
2196 #if HAVE_NETINET_UDP_VAR_H
2197 #include <netinet/udp_var.h>
2198 #endif
2199 ],udpstat,udps_noportbcast)
2201 AC_CHECK_STRUCT_FOR([
2202 #include <sys/types.h>
2203 #if HAVE_NETINET_IN_H
2204 #include <netinet/in.h>
2205 #endif
2206 #if HAVE_NETINET_IP_VAR_H
2207 #include <netinet/ip_var.h>
2208 #endif
2209 #if HAVE_NETINET_UDP_H
2210 #include <netinet/udp.h>
2211 #endif
2212 #if HAVE_NETINET_UDP_VAR_H
2213 #include <netinet/udp_var.h>
2214 #endif
2215 ],udpstat,udps_fullsock)
2217 AC_CHECK_STRUCT_FOR([
2218 #ifdef HAVE_SYS_PARAM_H
2219 #include <sys/param.h>
2220 #endif
2221 #include <sys/types.h>
2222 #include <sys/socket.h>
2223 #ifdef HAVE_SYS_TIME_H
2224 #include <sys/time.h>
2225 #endif
2226 #include <net/if.h>
2227 #if HAVE_NETINET_IN_H
2228 #include <netinet/in.h>
2229 #endif
2230 #if HAVE_NETINET_IF_ETHER_H
2231 #include <netinet/if_ether.h>
2232 #endif
2233 ],arphd,at_next)
2235 AC_CHECK_STRUCT_FOR([
2236 #if HAVE_SYS_CONF_H
2237 #include <sys/conf.h>
2238 #endif
2239 ],swdevt,sw_nblksenabled)
2241 AC_CHECK_STRUCT_FOR([
2242 #ifdef HAVE_SYS_STAT_H
2243 #include <sys/stat.h>
2244 #endif
2245 #if HAVE_SYS_STATFS_H
2246 #include <sys/statfs.h>
2247 #endif
2248 #if HAVE_SYS_STATVFS_H
2249 #include <sys/statvfs.h>
2250 #endif
2251 ],statvfs,f_frsize)
2253 AC_CHECK_STRUCT_FOR([
2254 #ifdef HAVE_SYS_STAT_H
2255 #include <sys/stat.h>
2256 #endif
2257 #if HAVE_SYS_STATFS_H
2258 #include <sys/statfs.h>
2259 #endif
2260 #if HAVE_SYS_STATVFS_H
2261 #include <sys/statvfs.h>
2262 #endif
2263 ],statvfs,f_files)
2265 AC_CHECK_STRUCT_FOR([
2266 #ifdef HAVE_SYS_STAT_H
2267 #include <sys/stat.h>
2268 #endif
2269 #if HAVE_SYS_STATFS_H
2270 #include <sys/statfs.h>
2271 #endif
2272 #ifdef HAVE_SYS_PARAM_H
2273 #include <sys/param.h>
2274 #include <sys/types.h>
2275 #endif
2276 #ifdef HAVE_SYS_MOUNT_H
2277 #include <sys/mount.h>
2278 #endif
2279 ],statfs,f_files)
2281 AC_CHECK_STRUCT_FOR([
2282 #ifdef HAVE_SYS_STAT_H
2283 #include <sys/stat.h>
2284 #endif
2285 #if HAVE_SYS_STATFS_H
2286 #include <sys/statfs.h>
2287 #endif
2288 #ifdef HAVE_SYS_PARAM_H
2289 #include <sys/param.h>
2290 #include <sys/types.h>
2291 #endif
2292 #ifdef HAVE_SYS_MOUNT_H
2293 #include <sys/mount.h>
2294 #endif
2295 ],statfs,f_ffree)
2297 AC_CHECK_STRUCT_FOR([
2298 #ifdef HAVE_SYS_STAT_H
2299 #include <sys/stat.h>
2300 #endif
2301 #if HAVE_SYS_STATFS_H
2302 #include <sys/statfs.h>
2303 #endif
2304 #ifdef HAVE_SYS_PARAM_H
2305 #include <sys/param.h>
2306 #include <sys/types.h>
2307 #endif
2308 #ifdef HAVE_SYS_MOUNT_H
2309 #include <sys/mount.h>
2310 #endif
2311 ],statfs,f_favail)
2313 AC_CHECK_STRUCT_FOR([
2314 #if HAVE_NLIST_H
2315 #include <nlist.h>
2316 #endif
2317 ],nlist,n_value)
2319 dnl check struct ipstat for various things
2320 AC_CHECK_STRUCT_FOR([
2321 #include <sys/types.h>
2322 #if HAVE_NETINET_IN_H
2323 #include <netinet/in.h>
2324 #endif
2325 #if HAVE_NETINET_IP_VAR_H
2326 #include <netinet/ip_var.h>
2327 #endif
2328 ], ipstat, ips_cantforward)
2330 AC_CHECK_STRUCT_FOR([
2331 #include <sys/types.h>
2332 #if HAVE_NETINET_IN_H
2333 #include <netinet/in.h>
2334 #endif
2335 #if HAVE_NETINET_IP_VAR_H
2336 #include <netinet/ip_var.h>
2337 #endif
2338 ], ipstat, ips_cantfrag)
2340 AC_CHECK_STRUCT_FOR([
2341 #include <sys/types.h>
2342 #if HAVE_NETINET_IN_H
2343 #include <netinet/in.h>
2344 #endif
2345 #if HAVE_NETINET_IP_VAR_H
2346 #include <netinet/ip_var.h>
2347 #endif
2348 ], ipstat, ips_delivered)
2350 AC_CHECK_STRUCT_FOR([
2351 #include <sys/types.h>
2352 #if HAVE_NETINET_IN_H
2353 #include <netinet/in.h>
2354 #endif
2355 #if HAVE_NETINET_IP_VAR_H
2356 #include <netinet/ip_var.h>
2357 #endif
2358 ], ipstat, ips_fragdropped)
2360 AC_CHECK_STRUCT_FOR([
2361 #include <sys/types.h>
2362 #if HAVE_NETINET_IN_H
2363 #include <netinet/in.h>
2364 #endif
2365 #if HAVE_NETINET_IP_VAR_H
2366 #include <netinet/ip_var.h>
2367 #endif
2368 ], ipstat, ips_fragtimeout)
2370 AC_CHECK_STRUCT_FOR([
2371 #include <sys/types.h>
2372 #if HAVE_NETINET_IN_H
2373 #include <netinet/in.h>
2374 #endif
2375 #if HAVE_NETINET_IP_VAR_H
2376 #include <netinet/ip_var.h>
2377 #endif
2378 ], ipstat, ips_localout)
2380 AC_CHECK_STRUCT_FOR([
2381 #include <sys/types.h>
2382 #if HAVE_NETINET_IN_H
2383 #include <netinet/in.h>
2384 #endif
2385 #if HAVE_NETINET_IP_VAR_H
2386 #include <netinet/ip_var.h>
2387 #endif
2388 ], ipstat, ips_noproto)
2390 AC_CHECK_STRUCT_FOR([
2391 #include <sys/types.h>
2392 #if HAVE_NETINET_IN_H
2393 #include <netinet/in.h>
2394 #endif
2395 #if HAVE_NETINET_IP_VAR_H
2396 #include <netinet/ip_var.h>
2397 #endif
2398 ], ipstat, ips_noroute)
2400 AC_CHECK_STRUCT_FOR([
2401 #include <sys/types.h>
2402 #if HAVE_NETINET_IN_H
2403 #include <netinet/in.h>
2404 #endif
2405 #if HAVE_NETINET_IP_VAR_H
2406 #include <netinet/ip_var.h>
2407 #endif
2408 ], ipstat, ips_odropped)
2410 AC_CHECK_STRUCT_FOR([
2411 #include <sys/types.h>
2412 #if HAVE_NETINET_IN_H
2413 #include <netinet/in.h>
2414 #endif
2415 #if HAVE_NETINET_IP_VAR_H
2416 #include <netinet/ip_var.h>
2417 #endif
2418 ], ipstat, ips_ofragments)
2420 AC_CHECK_STRUCT_FOR([
2421 #include <sys/types.h>
2422 #if HAVE_NETINET_IN_H
2423 #include <netinet/in.h>
2424 #endif
2425 #if HAVE_NETINET_IP_VAR_H
2426 #include <netinet/ip_var.h>
2427 #endif
2428 ], ipstat, ips_reassembled)
2430 dnl check for the des_ks_struct.weak_key attribute, which indicates the 
2431 dnl older opensll version is being used.
2432 if test "x$ac_cv_header_openssl_des_h" = "xyes" ; then
2433 AC_CHECK_STRUCT_FOR([
2434 #include <openssl/des.h>
2435 ], des_ks_struct, weak_key)
2438 dnl attempt to figure out if sysctl is usable
2440 if test $cross_compiling = yes; then
2441   AC_MSG_WARN([Can't check sysctl, manually define CAN_USE_SYSCTL if platform support available])
2442 else
2443   AC_CACHE_CHECK(if sysctl can read kernel information,ac_cv_CAN_USE_SYSCTL,
2444   [AC_TRY_RUN([
2445 #if TIME_WITH_SYS_TIME
2446 # include <sys/time.h>
2447 # include <time.h>
2448 #else
2449 # if HAVE_SYS_TIME_H
2450 #  include <sys/time.h>
2451 # else
2452 #  include <time.h>
2453 # endif
2454 #endif
2455 #if HAVE_SYS_PARAM_H
2456 # include <sys/param.h>
2457 #endif
2458 #include <sys/types.h>
2459 #if HAVE_SYS_SYSCTL_H
2460 # include <sys/sysctl.h>
2461 #endif
2463 main() {
2464   int                 mib[2];
2465   size_t              len;
2466   struct timeval boottime;
2467   
2468   mib[0] = CTL_KERN;
2469   mib[1] = KERN_BOOTTIME;
2470   
2471   len = sizeof(boottime);
2472   sysctl(mib, 2, &boottime, &len, NULL, NULL);
2473   if (boottime.tv_sec != 0)
2474     exit(0);
2475   else
2476     exit(1);
2478   ], ac_cv_CAN_USE_SYSCTL=yes, ac_cv_CAN_USE_SYSCTL=no, ac_cv_CAN_USE_SYSCTL=no)])
2481 if test "x$ac_cv_CAN_USE_SYSCTL" = "xyes"; then
2482   AC_DEFINE(CAN_USE_SYSCTL)
2486 dnl In FreeBSD 4.x, the TCP timer constants aren't.  They are defined
2487 dnl in terms of `hz', the kernel clock tick.  In this case,
2488 dnl we need to have a local variable `hz' in scope and set to a useful
2489 dnl value whenever we use one of these constants.
2491 AC_CACHE_CHECK(whether TCP timers depend on \`hz',ac_cv_TCPTV_NEEDS_HZ,
2492 [AC_EGREP_CPP(hz,
2493 [#include <netinet/tcp_timer.h>
2494 TCPTV_SRTTDFLT
2495 ], ac_cv_TCPTV_NEEDS_HZ=yes, ac_cv_TCPTV_NEEDS_HZ=no)])
2497 if test "x$ac_cv_TCPTV_NEEDS_HZ" = "xyes"; then
2498   AC_DEFINE(TCPTV_NEEDS_HZ)
2502 dnl define the agent libraries variable
2504 AC_SUBST(AGENTLIBS)
2505 AC_SUBST(OTHERAGENTLIBOBJS)
2506 AC_SUBST(OTHERAGENTLIBLOBJS)
2509 dnl Prompt for various bits of user information
2512 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
2513 AC_CACHE_CHECK(if you have run configure before, ac_cv_have_warned,
2515 if test "x$defaults" = "xno"; then
2516 cat << EOF
2518          ************** Configuration Section **************
2520         You are about to be prompted with a series of questions.  Answer
2521 them carefully, as they determine how the SNMP agent and related
2522 applications are to function.
2524         After the configure script finishes, you can browse the newly
2525 created config.h file for further - less important - parameters to
2526 modify.  Be careful if you re-run configure though, since config.h will
2527 be overwritten.
2529 -Press return to continue-
2532 read tmpinput
2533 ac_cv_have_warned="yes"
2534 echo $ac_n "disabling above prompt for future runs...  $ac_c"
2535 else
2536   ac_cv_have_warned="no"
2539 else
2540   ac_cv_have_warned="yes"
2543 ME=`$WHOAMI`
2544 if test -f /etc/resolv.conf; then
2545   LOC=`cat /etc/resolv.conf | grep '^domain' | tail -1 | awk '{print $NF}'`
2546 else
2547   LOC="@no.where"
2550 AC_PROMPT_USER(DEFAULT_SNMP_VERSION,[
2552 *** Default SNMP Version:
2554         Starting with Net-SNMP 5.0, you can choose the default version of
2555 the SNMP protocol to use when no version is given explicitly on the
2556 command line, or via an 'snmp.conf' file.  In the past this was set to
2557 SNMPv1, but you can use this to switch to SNMPv3 if desired.  SNMPv3
2558 will provide a more secure management environment (and thus you're
2559 encouraged to switch to SNMPv3), but may break existing scripts that
2560 rely on the old behaviour.  (Though such scripts will probably need to
2561 be changed to use the '-c' community flag anyway, as the SNMPv1
2562 command line usage has changed as well.).
2563    At this prompt you can select \"1\", \"2\" (for SNMPv2c), or \"3\" as
2564 the default version for the command tools (snmpget, ...) to use.  This
2565 can always be overridden at runtime using the -v flag to the tools, or
2566 by using the \"defVersion\" token in your snmp.conf file.
2567    Providing the --with-default-snmp-version=\"x\" parameter to ./configure
2568 will avoid this prompt.
2570 Default version of SNMP to use],3,unquoted)
2572 dnl we tested this above before the prompt, but the prompt may give a new value.
2573 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
2574   AC_MSG_ERROR([Illegal version number.  Only 1, 2 (for SNMPv2c) and 3 are supported.])
2577 AC_PROMPT_USER(SYS_CONTACT,[
2579 *** System Contact Information:
2581         Describes who should be contacted about the host the agent is
2582 running on.  This information is available in the MIB-II tree.  This
2583 can also be over-ridden using the \"syscontact\" syntax in the agent's
2584 configuration files.
2585   Providing the --with-sys-contact=\"contact\" parameter to ./configure
2586 will avoid this prompt.
2588 System Contact Information],$ME@$LOC,quoted)
2590 AC_PROMPT_USER(SYS_LOC,[
2592 *** System Location:
2594         Describes the location of the system.  This information is
2595 available in the MIB-II tree.  this can also be over-ridden using the
2596 \"syslocation\" syntax in the agent's configuration files.
2597   Providing the --with-sys-location=\"location\" parameter to ./configure
2598 will avoid this prompt.
2600 System Location],Unknown,quoted)
2602 if test -d /var/log; then
2603   defaultlog="/var/log/snmpd.log"
2604 else
2605   defaultlog="/usr/adm/snmpd.log"
2607   
2608 AC_PROMPT_USER(LOGFILE,[
2610 *** Logfile location:
2612         Enter the default location for the snmpd agent to dump
2613 information & errors to.  If not defined (enter the keyword \"none\"
2614 at the prompt below) the agent will use stdout and stderr instead.
2615 (Note: This value can be over-ridden using command line options.)
2616   Providing the --with-logfile=\"path\" parameter to ./configure
2617 will avoid this prompt.
2619 Location to write logfile],$defaultlog,quoted)
2621 if test -d /var; then
2622   defaultstore="/var/net-snmp"
2623   ucddefaultstore="/var/ucd-snmp"
2624 else
2625   defaultstore="/etc/net-snmp"
2626   ucddefaultstore="/etc/ucd-snmp"
2628   
2629 AC_PROMPT_USER(PERSISTENT_DIRECTORY,[
2631 *** snmpd persistent storage location:
2633         Enter a directory for the SNMP library to store persistent
2634 data in the form of a configuration file.  This default location is
2635 different than the old default location (which was for ucd-snmp).  If
2636 you stay with the new path, I'll ask you in a second if you wish to
2637 copy your files over to the new location (once only).  If you pick
2638 some other path than the default, you'll have to copy them yourself.
2639 There is nothing wrong with picking the old path ($ucddefaultstore) if
2640 you'd rather.
2641   Providing the --with-persistent-directory=\"path\" parameter to
2642 ./configure will avoid this prompt.
2644 Location to write persistent information],$defaultstore,quoted)
2646 PERSISTENT_DIRECTORY=$ac_cv_user_prompt_PERSISTENT_DIRECTORY
2647 AC_SUBST(PERSISTENT_DIRECTORY)
2648 UCDPERSISTENT_DIRECTORY=$ucddefaultstore
2649 AC_SUBST(UCDPERSISTENT_DIRECTORY)
2651 if test $PERSISTENT_DIRECTORY = "$defaultstore" -a -d "$ucddefaultstore" -a ! -d "$defaultstore" ; then
2652 AC_CACHE_CHECK(If we should copy the old persistent directory, ac_cv_user_prompt_COPY_PERSISTENT_FILES,
2654 AC_PROMPT_USER_NO_DEFINE(ac_cv_user_prompt_COPY_PERSISTENT_FILES,[
2656 *** Copying old ucd-snmp persistent files to net-snmp persistent directory:
2658         Would you like to copy the older ucd-snmp persistent files
2659 into your new net-snmp persistent file path?  This will functionally
2660 save all your ucd-snmp data and let it be used within the net-snmp
2661 tools.  This will only be done once when you run make install.  If you
2662 wish to do this, enter "yes" at the prompt.
2663   Providing the --with-copy-persistent-files=\"no\" (or \"yes\")
2664 parameters to ./configure will avoid this prompt.
2666 Copy ucd-snmp data into the net-snmp data directory],"yes")
2668 else
2669 ac_cv_user_prompt_COPY_PERSISTENT_FILES="no"
2671 COPY_PERSISTENT_FILES="$ac_cv_user_prompt_COPY_PERSISTENT_FILES"
2672 AC_SUBST(COPY_PERSISTENT_FILES)
2674 AC_SUBST(DLLIBS)
2676 AC_OUTPUT([
2677  Makefile:Makefile.top:Makefile.in:Makefile.rules
2678  snmplib/Makefile:Makefile.top:snmplib/Makefile.in:Makefile.rules:snmplib/Makefile.depend
2679  apps/Makefile:Makefile.top:apps/Makefile.in:Makefile.rules:apps/Makefile.depend
2680  apps/snmpnetstat/Makefile:Makefile.top:apps/snmpnetstat/Makefile.in:Makefile.rules:apps/snmpnetstat/Makefile.depend
2681  agent/Makefile:Makefile.top:agent/Makefile.in:Makefile.rules:agent/Makefile.depend
2682  agent/helpers/Makefile:Makefile.top:agent/helpers/Makefile.in:Makefile.rules:agent/helpers/Makefile.depend
2683  agent/mibgroup/Makefile:Makefile.top:agent/mibgroup/Makefile.in:Makefile.rules:agent/mibgroup/Makefile.depend
2684  local/Makefile:Makefile.top:local/Makefile.in:Makefile.rules
2685  testing/Makefile:Makefile.top:testing/Makefile.in
2686  man/Makefile:Makefile.top:man/Makefile.in:Makefile.rules
2687  mibs/Makefile:Makefile.top:mibs/Makefile.in:Makefile.rules
2688  net-snmp-config:net-snmp-config.in
2689 ], [
2690  echo timestamp > stamp-h
2691  chmod 755 net-snmp-config
2694 AC_MSG_CACHE_DISPLAY()
2696 dnl Local Variables:
2697 dnl mode: Autoconf
2698 dnl comment-start: "dnl"
2699 dnl End: