| dnl Process this file with autoconf to produce a configure script. |
| dnl |
| AC_INIT(agent/mibgroup/ucd-snmp/extensible.c) |
| AC_CONFIG_HEADER(config.h) |
| |
| dnl |
| dnl save the configure arguments |
| dnl |
| AC_DEFINE_UNQUOTED(CONFIGURE_OPTIONS,"$ac_configure_args") |
| |
| dnl |
| dnl Compilation setup |
| dnl |
| AC_ARG_WITH(cc, [ |
| Compiler Options: |
| --with-cc=CC use CC to compile (default=gcc).], |
| [CC=$with_cc;export CC]) |
| |
| AC_ARG_WITH(cflags, |
| [ --with-cflags=CFLAGS use CFLAGS as compile time arguments.], |
| [CFLAGS=$with_cflags; export CFLAGS]) |
| |
| AC_ARG_WITH(ldflags, |
| [ --with-ldflags=LDFLAGS use LDFLAGS as link time arguments to ld.], |
| [LIBS=$with_ldflags; export LIBS]) |
| |
| AC_ARG_ENABLE(shared, |
| [ --enable-shared Compile, use, and install shared libraries.], |
| with_shared="yes",with_shared="no") |
| |
| AC_ARG_ENABLE(debugging, |
| [ --enable-debugging Outputs extra debugging information at all |
| times. Normally, you should not enable this, |
| but instead use the -D flag of the commands, |
| which toggles debbuging output at runtime. |
| --disable-debugging Disallows debugging code to be built in. |
| This might provide some speed benefits.], |
| AC_DEFINE(SNMP_ALWAYS_DEBUG)) |
| |
| AC_ARG_ENABLE(developer, |
| [ --enable-developer Turns on super-duper-extra-compile-warnings |
| when using gcc.], |
| developer=yes) |
| |
| if test "x$enable_debugging" = "xno"; then |
| AC_DEFINE(SNMP_NO_DEBUGGING) |
| fi |
| |
| AC_ARG_WITH(KMT, |
| [ --with-KMT=PATH Look for libkmt in PATH/lib.], |
| AC_ADD_SEARCH_PATH($withval) |
| ) |
| |
| AC_ARG_WITH(SSLeay, |
| [ --with-SSLeay=PATH Look for SSLeay installation in PATH.], |
| AC_ADD_SEARCH_PATH($withval) |
| ) |
| |
| AC_ARG_ENABLE(privacy,[ --disable-privacy Don't compile in support for privacy.]) |
| if test "x$enable_privacy" != "xno"; then |
| AC_DEFINE(SCAPI_AUTHPRIV) |
| fi |
| |
| AC_ARG_ENABLE(internal-md5, [ --enable-internal-md5 Use the internal MD5 support.], AC_DEFINE(USE_INTERNAL_MD5)) |
| |
| |
| AC_ARG_ENABLE(eol-terminated-comments, [ |
| Configuring the SNMP library (and the applications that use it): |
| --enable-mib-eol-comments Treat \"--\" as a mib comment terminated only |
| by an end of line condition. (This can now |
| be turned on/off at runtime instead.)], |
| AC_DEFINE(MIB_COMMENT_IS_EOL_TERMINATED)) |
| |
| AC_ARG_WITH(opaque-special-types, |
| [ --without-opaque-special-types Don't use special opaque encodings. |
| SNMP normally can not handle |
| floating numbers, nor large 64 bit |
| integers well. By default, the |
| ucd-snmp package compiles in |
| support for these extra datatypes |
| (in a legal way)]) |
| |
| AC_ARG_WITH(mibdirs, |
| [ --with-mibdirs=\"dir1:dir2:\" Default directories to look for mibs. |
| (Default: DATADIR/snmp/mibs)], |
| [DEFAULT_MIBDIRS="$with_mibdirs" |
| AC_DEFINE_UNQUOTED(DEFAULT_MIBDIRS,"$with_mibdirs")]) |
| |
| AC_ARG_WITH(mibs, |
| [ --with-mibs=\"item1:item2:\" Default mib IDs to read. |
| (The default list is \"IP-MIB:IF-MIB: |
| TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB\" |
| with the addition of any mibs used |
| by the mib modules the agent is |
| configured with)], |
| DEFAULT_MIBS="$with_mibs") |
| |
| AC_ARG_WITH(mibfiles, |
| [ --with-mibfiles=\"file1:file2\" Default mib files to load. |
| (Default: none. uses IDs above instead.)], |
| AC_DEFINE_UNQUOTED(DEFAULT_MIBFILES,"$with_mibfiles")) |
| |
| |
| AC_ARG_ENABLE(testing-code, |
| [ --enable-testing-code Enables some code sections that should |
| only be used for testing of certain |
| SNMP functionalities. This should *not* |
| be turned on for production use. Ever.], |
| AC_DEFINE(SNMP_TESTING_CODE)) |
| |
| AC_ARG_ENABLE(reentrant, |
| [ --enable-reentrant Enables locking functions that protect |
| library resources in some multi-threading |
| environments. This does not guarantee |
| thread-safe operation. |
| Currently an experimental setting.], |
| with_res_locks="yes",with_res_locks="no") |
| |
| AC_ARG_WITH(root-access, |
| [ |
| Configuring the agent: |
| --without-root-access The snmpd agent won't require root access to |
| run it. The information it returns in the |
| mib-II tree may not be correct, however.]) |
| |
| AC_ARG_WITH(dummy-values, |
| [ --with-dummy-values Provide 'placeholder' dummy values where |
| the necessary information is not available. |
| This is technically not compliant with the |
| SNMP specifications, but was how the agent |
| operated for versions < 4.0.]) |
| |
| AC_ARG_WITH(persistent-directory, |
| [ --with-persistent-directory=\"directory\" |
| Default directory for persistent data storage.],ac_cv_user_prompt_PERSISTENT_DIRECTORY="$with_persistent_directory") |
| |
| AC_ARG_WITH(sys_contact, |
| [ --with-sys-contact=\"who@where\" Default system contact. |
| (Default: LOGIN@DOMAINNAME)], |
| ac_cv_user_prompt_SYS_CONTACT="$with_sys_contact") |
| |
| AC_ARG_WITH(sys_location, |
| [ --with-sys-location=\"location\" Default system location. |
| (Default: Unknown)], |
| ac_cv_user_prompt_SYS_LOC="$with_sys_location") |
| |
| AC_ARG_WITH(logfile, |
| [ --with-logfile=\"location\" Default log file location for snmpd.], |
| ac_cv_user_prompt_LOGFILE="$with_logfile") |
| |
| AC_ARG_WITH(libwrap, |
| [ --with-libwrap[=LIBPATH] Compile in libwrap (tcp_wrappers) support.], |
| if test "x$withval" != "x" -a -d "$withval"; then |
| WRAPLIBS="-L$withval -lwrap" |
| elif test "x$withval" = "xyes"; then |
| WRAPLIBS="-lwrap" |
| else |
| WRAPLIBS="$withval $LIBS" |
| fi |
| AC_DEFINE(USE_LIBWRAP) |
| ) |
| |
| dnl This can't be within AC_ARG_WITH. I don't want to read autoconf m4 |
| dnl to find out why. |
| AC_SUBST(WRAPLIBS) |
| |
| AC_ARG_WITH(mib_modules, |
| [ --with-mib-modules=\"item1 ...\" Compile with additional mib modules |
| (Space separated list).]) |
| |
| AC_ARG_WITH(out_mib_modules, |
| [ --with-out-mib-modules=\"list\" Compile without these mib modules. |
| |
| Default mib modules compiled into the agent (which can be removed): |
| |
| mibII: support for the mib-II tree. |
| snmpv3: support for the snmpv3 mib modules. |
| ucd_snmp: ucd-snmp specific extensions. |
| |
| Optional mib modules that can be built into the agent include: |
| host: host resources mib support. |
| (alpha level code for linux, hpux, solaris) |
| smux: smux sub-agent support. |
| misc/ipfwacc: accounting rules IP firewall information. |
| (only under linux) |
| ipfwchains/ipfwchains: firewall chains under ipfw for linux. |
| (Download separately from the ucd-snmp ftp site.) |
| target: Support for the TARGET-MIB. |
| ucd-snmp/pass_persist: Persistent pass scripts that stay around. |
| Not currently included by default solely because |
| it needs more testing. |
| |
| AgentX support: (warning: alpha code) |
| agentx/client: allows the agent to run as either a snmp agent |
| or as an agentX sub-agent. |
| agentx/master: makes the agent run as an agentX master agent |
| as well as a normal snmp agent. |
| agentx: includes both agentx/master and agentx/client. |
| |
| Optional modules for C coders to look at and/or include as extension examples: |
| |
| examples/ucdDemoPublic: SNMPv3 interoperability testing mib. |
| examples/example: example C code extension. |
| examples/wombat: template file similar to example.]) |
| |
| dnl |
| dnl otherwise prompted information |
| dnl |
| AC_ARG_WITH(defaults, |
| [ |
| Miscellaneous: |
| --with-defaults Use defaults for prompted values.], |
| defaults="yes",defaults="no") |
| |
| dnl Only define if specifically chosen as --without (ie, default to true). |
| if test "x$with_root_access" = "xno"; then |
| AC_DEFINE(NO_ROOT_ACCESS) |
| fi |
| |
| dnl Define unless specifically suppressed (ie, option defaults to false). |
| if test "x$with_dummy_values" != "xyes"; then |
| AC_DEFINE(NO_DUMMY_VALUES) |
| fi |
| |
| dnl Only define if specifically chosen as --without (ie, default to true). |
| if test "x$with_opaque_special_types" != "xno"; then |
| AC_DEFINE(OPAQUE_SPECIAL_TYPES) |
| fi |
| |
| dnl overflow problems with hpux's sh |
| dnl taken from Perl's Configure script |
| |
| echo $ac_n "Checking if I need to feed myself to ksh... $ac_c" |
| if test -f /hp-ux -a -f /bin/ksh; then |
| if (PATH=.; alias -x) >/dev/null 2>&1; then |
| echo "no" |
| else |
| echo "yes" |
| if test "x$1" = "x"; then |
| exec /bin/ksh $0 |
| else |
| exec /bin/ksh $0 "$@" |
| fi |
| fi |
| else |
| echo "no" |
| fi |
| |
| dnl Checks for programs. |
| AC_PROG_CC |
| AC_PROG_CPP |
| AC_PROG_INSTALL |
| AC_PROG_LN_S |
| AC_PROG_MAKE_SET |
| AC_PATH_PROG(PSPROG,ps) |
| AC_CHECK_PROGS(WHOAMI, whoami logname, whoami) |
| AC_CHECK_PROGS(SED,sed gsed) |
| AC_PATH_PROG(UNAMEPROG,uname) |
| AC_DEFINE_UNQUOTED(UNAMEPROG,"$UNAMEPROG") |
| |
| AC_AIX |
| |
| AC_C_CONST |
| |
| dnl super type checking |
| AC_MSG_CHECKING(for developer flags) |
| if test "x$developer" = "xyes" -a "x$ac_cv_prog_gcc" = "xyes"; then |
| devflags="-Wall -Wstrict-prototypes -Wwrite-strings -Wcast-qual -pedantic -Wno-unused -Wno-char-subscripts" |
| CFLAGS="$CFLAGS $devflags" |
| else |
| devflags="none" |
| fi |
| AC_MSG_RESULT($devflags) |
| |
| dnl system check |
| AC_CANONICAL_SYSTEM |
| changequote(, ) |
| PARTIALTARGETOS=`echo $target_os | sed 's/[-._].*//'` |
| CFLAGS="$CFLAGS -D$PARTIALTARGETOS" |
| changequote([, ]) |
| |
| dnl |
| dnl check for special includes and pick one |
| dnl |
| |
| AC_MSG_CHECKING(for system include file) |
| changequote(, ) |
| filebase=$target_os |
| while test "x$filebase" != "x$last" -a ! -f $srcdir/s/$filebase.h |
| do |
| last=$filebase |
| filebase=`echo $filebase | sed 's/[-._][^-._]*$//'` |
| if test "x$filebase" = "x$last"; then |
| filebase=`echo $filebase | sed 's/[0-9]*$//'` |
| fi |
| done |
| |
| if test "x$filebase" = "x$last"; then |
| filebase="generic" |
| fi |
| ac_cv_SYSTEM_INCLUDE_FILE="s/$filebase.h" |
| |
| changequote([, ]) |
| AC_MSG_RESULT($ac_cv_SYSTEM_INCLUDE_FILE) |
| AC_DEFINE_UNQUOTED(SYSTEM_INCLUDE_FILE, "$ac_cv_SYSTEM_INCLUDE_FILE") |
| |
| dnl second part, the CPU type. |
| |
| AC_MSG_CHECKING(for machine-type include file) |
| changequote(, ) |
| filebase=$target_cpu |
| while test "x$filebase" != "x$last" -a ! -f $srcdir/m/$filebase.h |
| do |
| last=$filebase |
| filebase=`echo $filebase | sed 's/[-._][^-._]*$//'` |
| done |
| |
| if test "x$filebase" = "x$last"; then |
| filebase="generic" |
| fi |
| ac_cv_MACHINE_INCLUDE_FILE="m/$filebase.h" |
| AC_MSG_RESULT($ac_cv_MACHINE_INCLUDE_FILE) |
| |
| changequote([, ]) |
| AC_DEFINE_UNQUOTED(MACHINE_INCLUDE_FILE, "$ac_cv_MACHINE_INCLUDE_FILE") |
| |
| AC_PATH_PROG(CCPATH,$CC) |
| dnl watch out for /usr/ucb/cc on solaris, it doesn't work with this package. |
| case $target_os in |
| bsdi*) |
| if test "x$CCPATH" = "x/usr/ucb/cc"; then |
| AC_MSG_ERROR([ |
| |
| *** The BSDI /usr/ucb/cc compiler does not work with this package. |
| *** Please run configure with --with-cc=gcc |
| ]) |
| fi |
| ;; |
| solaris*) |
| if test "x$CCPATH" = "x/usr/ucb/cc"; then |
| AC_MSG_ERROR([ |
| |
| *** The solaris /usr/ucb/cc compiler does not work with this package. |
| *** Please put a different compiler in your path first or run |
| *** configure with --with-cc=XX, where XX is the compiler you want to use. |
| ]) |
| fi |
| ;; |
| esac |
| |
| AC_MSG_CHECKING(for additional cpp flags) |
| dnl gcc extra CPPFLAGS |
| if test "x$GCC" = "xyes" -a "x$CPP" = "x$CC -E"; then |
| dnl extra cpp flags for gnu c compiler to allow .in file extensions. |
| EXTRACPPFLAGS="-x c" |
| else |
| EXTRACPPFLAGS="" |
| fi |
| |
| dnl Solaris extra cpp flags. |
| if test "x$GCC" != "xyes"; then |
| case $target_os in |
| solaris*) EXTRACPPFLAGS="$EXTRACPPFLAGS -Xs" ;; |
| esac |
| fi |
| |
| AC_SUBST(EXTRACPPFLAGS) |
| AC_MSG_RESULT($EXTRACPPFLAGS) |
| |
| dnl Set SNMPLIBPATH & SNMPSHAREPATH |
| |
| if test "x$prefix" = "xNONE"; then |
| prefix=/usr/local |
| fi |
| if test "x$exec_prefix" = "xNONE"; then |
| exec_prefix=$prefix |
| fi |
| |
| SNMPLIBPATH="" |
| tmpset="$libdir/snmp" |
| while test "x$tmpset" != "x$SNMPLIBPATH"; do |
| SNMPLIBPATH="$tmpset" |
| eval tmpset="$tmpset" |
| done |
| AC_DEFINE_UNQUOTED(SNMPLIBPATH,"$SNMPLIBPATH") |
| |
| SNMPSHAREPATH="" |
| tmpset="$datadir/snmp" |
| while test "x$tmpset" != "x$SNMPSHAREPATH"; do |
| SNMPSHAREPATH="$tmpset" |
| eval tmpset="$tmpset" |
| done |
| AC_DEFINE_UNQUOTED(SNMPSHAREPATH,"$SNMPSHAREPATH") |
| |
| if test "x$DEFAULT_MIBDIRS" = "x"; then |
| AC_DEFINE_UNQUOTED(DEFAULT_MIBDIRS,"$SNMPSHAREPATH/mibs") |
| fi |
| |
| SNMPCONFPATH="" |
| tmpset="$datadir/snmp" |
| while test "x$tmpset" != "x$SNMPCONFPATH"; do |
| SNMPCONFPATH="$tmpset" |
| eval tmpset="$tmpset" |
| done |
| AC_DEFINE_UNQUOTED(SNMPCONFPATH,"$SNMPCONFPATH") |
| |
| dnl |
| dnl Figure out appropriate shared libraries extensions if necessary. |
| dnl |
| |
| if test "x$with_shared" = "xyes"; then |
| |
| dnl defaults |
| |
| if test "x$GCC" = "xyes"; then |
| SHLIB_CFLAGS="-fpic -shared" |
| else |
| SHLIB_CFLAGS="-Kpic" |
| fi |
| SHLIB_EXTENSION="so" |
| SHLIB_VERSION= |
| SHLIB_LD_CMD="ld -r -o" |
| SHLIB_LDCONFIG_CMD= |
| CC_RUNTIME_ARG= |
| RANLIB=":" |
| |
| dnl over-rides |
| case $target_os in |
| |
| linux*) |
| SHLIB_LDCONFIG_CMD='PATH="$$PATH:/sbin" ldconfig -n $(libdir)' |
| ;; |
| |
| irix*) |
| SHLIB_LD_CMD="ld -shared -o" |
| CC_RUNTIME_ARG="-Wl,-rpath -Wl,$libdir" |
| ;; |
| |
| netbsd* | openbsd*) |
| SHLIB_LD_CMD="ld -Bshareable -o" |
| CC_RUNTIME_ARG="-R$libdir" |
| SHLIB_LDCONFIG_CMD='PATH="$$PATH:/sbin" ldconfig -m $(libdir)' |
| ;; |
| |
| hpux*) |
| SHLIB_EXTENSION="sl" |
| if test "x$GCC" != "xyes"; then |
| SHLIB_CFLAGS="+Z" |
| fi |
| CC_RUNTIME_ARG="-Wl,+b,$libdir" |
| SHLIB_LD_CMD="ld -b -o" |
| ;; |
| |
| osf*) |
| CC_RUNTIME_ARG="-rpath $libdir" |
| SHLIB_LD_CMD="ld -shared -o" |
| ;; |
| |
| aix*) |
| ;; |
| |
| sysv4*) |
| CC_RUNTIME_ARG="-R$libdir" |
| ;; |
| |
| sunos*) |
| if test "x$GCC" != "xyes"; then |
| SHLIB_CFLAGS="-PIC" |
| fi |
| SHLIB_LDCONFIG_CMD='PATH="$$PATH:/usr/etc" ldconfig $(libdir)' |
| ;; |
| |
| solaris*) |
| SHLIB_LD_CMD="ld -G -o" |
| CC_RUNTIME_ARG="-R$libdir" |
| ;; |
| |
| freebsd*) |
| SHLIB_LD_CMD="ld -Bshareable -o" |
| SHLIB_VERSION=.3.5 |
| ;; |
| |
| *) |
| AC_MSG_ERROR([ |
| *** shared libraries aren't supported for architecture $target_os |
| ]) |
| ;; |
| |
| esac |
| else |
| SHLIB_EXTENSION="a" |
| SHLIB_LD_CMD="ar cr" |
| SHLIB_LDCONFIG_CMD=":" |
| fi |
| |
| dnl |
| dnl Maybe add library extensions for thread mutex locking. |
| dnl |
| |
| if test "x$with_res_locks" = "xyes"; then |
| |
| cat >> confdefs.h <<\EOF |
| #define _REENTRANT 1 |
| EOF |
| |
| case $target_os in |
| |
| aix*) |
| CC_RUNTIME_ARG="$CC_RUNTIME_ARG -lpthreads" |
| ;; |
| |
| *) |
| ;; |
| |
| esac |
| fi |
| AC_SUBST(CC_RUNTIME_ARG) |
| AC_SUBST(SHLIB_CFLAGS) |
| AC_SUBST(SHLIB_EXTENSION) |
| AC_SUBST(SHLIB_VERSION) |
| AC_SUBST(SHLIB_LDCONFIG_CMD) |
| AC_SUBST(SHLIB_LD_CMD) |
| AC_PROG_RANLIB |
| AC_MSG_CHECKING(for how to build the library) |
| AC_MSG_RESULT([EXTENSION=$SHLIB_EXTENSION, VERSION=$SHLIB_VERSION, LD=$SHLIB_LD_CMD, LDCONFIG=$SHLIB_LDCONFIG_CMD, RANLIB=$RANLIB, CCFLAGS=$SHLIB_CFLAGS $CC_RUNTIME_ARG]) |
| |
| dnl |
| dnl Do hairy agent module processing. |
| dnl |
| changequote(, ) |
| AC_MSG_CHECKING(for and configuring mib modules to use) |
| |
| mibdir="agent/mibgroup" |
| module_list="" |
| module_list_code="" |
| new_module_list="mibII ucd_snmp snmpv3mibs $with_mib_modules" |
| |
| dnl Create include file list for snmp_vars.h to use. |
| if test ! -d agent; then |
| mkdir agent |
| fi |
| if test ! -d agent/mibgroup; then |
| mkdir agent/mibgroup |
| fi |
| for i in $mibdir/mib_module_includes.h $mibdir/mib_module_inits.h $mibdir/mib_module_shutdown.h mib_module_config.h $mibdir/mib_module_dot_conf.h; do |
| rm -f $i |
| echo "/* This file is automatically generated by configure. Do not modify by hand. */" > $i |
| done |
| |
| test_modules="$new_module_list" |
| new_module_list="" |
| module_list_h="" |
| default_mibs=IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB |
| |
| for i in $test_modules |
| do |
| if echo " $with_out_mib_modules " | grep " $i " > /dev/null; then |
| : |
| else |
| new_module_list="$new_module_list $i" |
| fi |
| done |
| |
| AC_MSG_RESULT($new_module_list.) |
| |
| AC_MSG_CHECKING(for and configuring mib modules pieces to use) |
| while test "x$new_module_list" != "x"; do |
| for i in $new_module_list |
| do |
| if echo " $with_out_mib_modules " | grep " $i " > /dev/null; then |
| : |
| else |
| if test -f $srcdir/$mibdir/$i.h; then |
| new_list="" |
| new_list_arch=`grep config_arch_require $srcdir/$mibdir/$i.h | sed 's/.*config_arch_require(\(.*\), *\(.*\)).*/\1-xarchx-\2/'` |
| if test "x$new_list_arch" != "x"; then |
| for j in $new_list_arch |
| do |
| archtest=`echo $j | sed 's/-xarchx-.*//'` |
| if test "x$target_os" = "x$archtest" -o "x$PARTIALTARGETOS" = "x$archtest"; then |
| new_list="$new_list `echo $j | sed 's/.*-xarchx-//'`" |
| fi |
| done |
| fi |
| new_list="$new_list `grep config_require $srcdir/$mibdir/$i.h | sed 's/.*config_require(\(.*\)).*/\1/'`" |
| if test "x$new_list" != "x"; then |
| for j in $new_list |
| do |
| if test ! -f $srcdir/$mibdir/$j.h; then |
| AC_MSG_ERROR(mib module "$i" requires module "$j" but $j.h or $j.c could not be found in $srcdir/$mibdir) |
| elif echo " $with_out_mib_modules " | grep " $j " > /dev/null; then |
| AC_MSG_WARN(mib module "$i" requires module "$j" but you told me to compile without it) |
| elif echo " $module_list $new_list_two $new_module_list " | grep " $j " > /dev/null; then |
| : |
| else |
| new_list_two="$new_list_two $j" |
| fi |
| done |
| fi |
| new_mibs=`grep config_add_mib $srcdir/$mibdir/$i.h | sed 's/.*config_add_mib(\(.*\)).*/\1/'` |
| if test "x$new_mibs" != "x"; then |
| for j in $new_mibs |
| do |
| if test "x`echo :$default_mibs: | grep :$j:`" = "x"; then |
| default_mibs="$default_mibs:$j" |
| fi |
| done |
| fi |
| else |
| AC_MSG_ERROR(module files $i.h or $i.c could not be found in $srcdir/$mibdir) |
| fi |
| module_list="$module_list $i" |
| echo '#include "'"mibgroup/$i.h"'"' >> $mibdir/mib_module_includes.h |
| module_list_h="$module_list_h mibgroup/$i.h" |
| if test -f $srcdir/$mibdir/$i.c; then |
| module_list_code="$module_list_code $i" |
| mnm=`echo $i | sed 's/.*\///;s/\.c$//;'` |
| if grep init_$mnm $srcdir/$mibdir/$i.c > /dev/null; then |
| echo " init_$mnm();" >> $mibdir/mib_module_inits.h |
| fi |
| if grep shutdown_`basename $i` $srcdir/$mibdir/$i.c > /dev/null; then |
| echo " shutdown_`basename $i`();" >> $mibdir/mib_module_shutdown.h |
| fi |
| fi |
| if test "x`echo $i | sed 's/\///g;'`" != "x$i"; then |
| mnd=`echo $i | sed 's/\/[^/]*$//;'` |
| if test ! -d ./$mibdir/$mnd; then |
| module_directories="$module_directories ./$mibdir/$mnd" |
| fi |
| fi |
| if grep config_load_mib $srcdir/$mibdir/$i.h > /dev/null 2>&1; then |
| AC_MSG_WARN(mib module "$i" uses the "config_load_mib" directive, which is no longer supported. It probably won't work.) |
| fi |
| 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 |
| sym="`echo ${i} | sed 's/[^a-zA-Z0-9_]/_/g' | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`" |
| echo "/* Define if compiling with the ${i} module files. */" >> mib_module_config.h |
| echo "#define USING_${sym}_MODULE 1" >> mib_module_config.h |
| echo " " >> mib_module_config.h |
| echo $ac_n " $i$ac_c" |
| fi |
| done |
| new_module_list="$new_list_two" |
| new_list_two="" |
| done |
| module_list_o=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.o /g'` |
| module_list_c=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.c /g'` |
| mibgroup_list_o=`echo " $module_list_o " | sed 's@ \([^ ]*\)\.o@ mibgroup/\1.o @g'` |
| changequote([, ]) |
| AC_SUBST(module_list_c) |
| AC_SUBST(module_list_h) |
| AC_SUBST(module_list_o) |
| AC_SUBST(mibgroup_list_o) |
| |
| AC_MSG_RESULT(.) |
| AC_MSG_CHECKING(if directories neeed to be created) |
| for i in $module_directories; do |
| $srcdir/mkinstalldirs $i |
| done |
| AC_MSG_RESULT(.) |
| |
| AC_MSG_CHECKING(default mib files to read) |
| if test "x$DEFAULT_MIBS" = "x"; then |
| DEFAULT_MIBS="$default_mibs" |
| fi |
| AC_DEFINE_UNQUOTED(DEFAULT_MIBS,"$DEFAULT_MIBS") |
| AC_MSG_RESULT($DEFAULT_MIBS) |
| |
| dnl |
| dnl Check for kernel location |
| dnl |
| |
| AC_CACHE_CHECK(for location of system kernel,ac_cv_KERNEL_LOC, |
| [ac_cv_KERNEL_LOC="unknown" |
| dnl First determine if test expects a -f or a -c (character device (SYSV)) |
| |
| if test -c /dev/null; then |
| CFLAG="-c" |
| elif test -f /dev/null; then |
| CFLAG="-f" |
| else |
| dnl fall back |
| CFLAG="-f" |
| fi |
| for i in /vmunix /hp-ux /stand/vmunix /dev/ksyms /kernel/unix /kernel/genunix /netbsd /unix /kernel /bsd |
| do |
| if test -f $i -o $CFLAG $i; then |
| ac_cv_KERNEL_LOC="$i" |
| break; |
| fi |
| done |
| if test $i = "unknown"; then |
| AC_MSG_WARN(Can't find system kernel... Setting to /vmunix) |
| ac_cv_KERNEL_LOC="/vmunix" |
| fi |
| ]) |
| |
| AC_DEFINE_UNQUOTED(KERNEL_LOC,"$ac_cv_KERNEL_LOC") |
| |
| dnl |
| dnl Check for mount table location |
| dnl |
| |
| AC_CACHE_CHECK(for mount table location,ac_cv_ETC_MNTTAB, |
| [ac_cv_ETC_MNTTAB="unknown" |
| for i in /etc/mnttab /etc/mtab |
| do |
| if test -f $i; then |
| ac_cv_ETC_MNTTAB="$i" |
| break; |
| fi |
| done |
| ]) |
| |
| AC_DEFINE_UNQUOTED(ETC_MNTTAB,"$ac_cv_ETC_MNTTAB") |
| |
| dnl Check for /dev/dmem or /dev/drum location |
| AC_CACHE_CHECK(for location of swap device,ac_cv_DMEM_LOC, |
| [ |
| dnl First determine if test expects a -f or a -c (character device (SYSV)) |
| |
| if test -f /dev/kmem; then |
| CTEST="test -f" |
| elif test -c /dev/kmem; then |
| CTEST="test -c" |
| else |
| dnl fall back |
| CTEST="test -f" |
| fi |
| |
| if $CTEST /dev/dmem; then |
| ac_cv_DMEM_LOC="/dev/dmem" |
| elif $CTEST /dev/drum; then |
| ac_cv_DMEM_LOC="/dev/drum" |
| else |
| ac_cv_DMEM_LOC="none" |
| fi |
| ]) |
| |
| if test "x$ac_cv_DMEM_LOC" != "xnone"; then |
| AC_DEFINE_UNQUOTED(DMEM_LOC,"$ac_cv_DMEM_LOC") |
| fi |
| |
| dnl Checks for libraries. |
| dnl AC_CHECK_LIB(des, main) |
| AC_CHECK_LIB(elf, nlist) |
| AC_CHECK_LIB(m, asin) |
| dnl On some platforms (Irix) libnsl and libsocket should not be used. |
| AC_CHECK_FUNCS(gethostbyname getservbyname) |
| if test "x$ac_cv_func_gethostbyname" != "xyes"; then |
| AC_CHECK_LIB(nsl, gethostbyname) |
| if test "x$ac_cv_lib_nsl_gethostbyname" = "xyes"; then |
| AC_DEFINE(HAVE_GETHOSTBYNAME) |
| fi |
| fi |
| if test "x$ac_cv_func_getservbyname" != "xyes"; then |
| AC_CHECK_LIB(socket, getservbyname) |
| if test "x$ac_cv_lib_socket_getservbyname" = "xyes"; then |
| AC_DEFINE(HAVE_GETSERVBYNAME) |
| fi |
| fi |
| dnl AC_CHECK_LIB(ucb, bzero) |
| |
| dnl zlib is required for newer versions of rpm |
| AC_CHECK_LIB(z, zlibVersion) |
| dnl |
| dnl with rpm3 or higher, we need db1 to exist |
| dnl |
| AC_CHECK_LIB(db1, dbopen,[ |
| AC_DEFINE(HAVE_LIBDB) |
| LIBS="-ldb1 $LIBS" |
| ],,-lz) |
| |
| dnl Ok, -ldb1 may not exist, try -ldb |
| if test "x$ac_cv_lib_db1_dbopen" = "xno"; then |
| AC_CHECK_LIB(db, dbopen,[ |
| AC_DEFINE(HAVE_LIBDB) |
| LIBS="-ldb $LIBS" |
| ],,-lz) |
| fi |
| |
| dnl |
| dnl now check for rpm using the appropriate db library |
| dnl |
| AC_CHECK_LIB(rpm, rpmdbOpen,[ |
| AC_DEFINE(HAVE_LIBRPM) |
| LIBS="-lrpm $LIBS" |
| ],,-lz) |
| |
| |
| dnl Replace `main' with a function in -lkstat: |
| AC_CHECK_LIB(kstat, kstat_lookup) |
| dnl Replace `main' with a function in -lkvm: |
| AC_CHECK_LIB(kvm, kvm_read) |
| dnl Check for nlist in mld (irix) |
| AC_CHECK_LIB(mld, nlist) |
| dnl Check for security related functions |
| AC_CHECK_LIB(crypto, SSLeay_version) |
| AC_CHECK_LIB(kmt, kmt_init) |
| |
| dnl Checks for header files. |
| AC_HEADER_STDC |
| AC_HEADER_DIRENT |
| AC_HEADER_SYS_WAIT |
| AC_CHECK_HEADERS(string.h fcntl.h limits.h sys/file.h sys/ioctl.h syslog.h unistd.h netinet/tcpip.h netinet/in.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) |
| dnl FreeBSD required headers |
| 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 sys/disklabel.h machine/types.h sys/socketvar.h) |
| dnl Linux |
| AC_CHECK_HEADERS(sys/conf.h netinet/in_systm.h netinet/tcp.h netinet/udp.h netinet/in_var.h netinet/in_pcb.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) |
| dnl NetBSD required headers |
| AC_CHECK_HEADERS(arpa/inet.h kvm.h sys/pool.h) |
| dnl BSDi2 headers |
| AC_CHECK_HEADERS(sys/mount.h vm/swap_pager.h ufs/ufs/dinode.h) |
| dnl BSDi3 headers |
| AC_CHECK_HEADERS(sys/stat.h sys/vnode.h ufs/ufs/quota.h ufs/ufs/inode.h) |
| dnl irix headers |
| AC_CHECK_HEADERS(sys/hashing.h sys/tcpipstats.h sys/sysmp.h) |
| dnl from smux stuff |
| AC_CHECK_HEADERS(err.h sys/filio.h sgtty.h) |
| dnl AIX needs this for statfs func |
| AC_CHECK_HEADERS(sys/statfs.h) |
| dnl Dynix |
| AC_CHECK_HEADERS(net/route.h) |
| dnl for HostRes (HP-UX at least) |
| AC_CHECK_HEADERS(sys/dkio.h sys/diskio.h sys/pstat.h linux/hdreg.h pkglocs.h) |
| dnl WIN32 |
| AC_CHECK_HEADERS(winsock.h io.h) |
| dnl SCO |
| AC_CHECK_HEADERS(sys/stream.h) |
| |
| dnl KMT |
| AC_CHECK_HEADERS(kmt.h kmt_algs.h) |
| |
| if test "x$ac_cv_lib_kmt_kmt_init" != "xyes"; then |
| dnl if KMT is not found, default to using internal md5 support. |
| AC_DEFINE(USE_INTERNAL_MD5) |
| fi |
| |
| dnl Checks for typedefs, structures, and compiler characteristics. |
| AC_TYPE_OFF_T |
| AC_TYPE_PID_T |
| AC_HEADER_TIME |
| |
| dnl AIX keeps in_addr_t in /usr/include/netinet/in.h |
| AC_MSG_CHECKING(for in_addr_t) |
| AC_CACHE_VAL(ac_cv_type_$1, |
| [AC_EGREP_CPP(dnl |
| changequote(<<,>>)dnl |
| <<in_addr_t[^a-zA-Z_0-9]>>dnl |
| changequote([,]), [#include <sys/types.h> |
| #if STDC_HEADERS |
| #include <stdlib.h> |
| #include <stddef.h> |
| #endif |
| #ifdef HAVE_NETINET_IN_H |
| #include <netinet/in.h> |
| #endif], ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)])dnl |
| |
| AC_MSG_RESULT($ac_cv_type_in_addr_t) |
| if test $ac_cv_type_in_addr_t = no; then |
| AC_DEFINE(in_addr_t, u_int) |
| fi |
| |
| dnl Check ps args |
| AC_CACHE_CHECK(for correct flags to ps, ac_cv_ps_flags, |
| [if test "`($PSPROG -e 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then |
| ac_cv_ps_flags="-e" |
| elif test "`($PSPROG -el 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then |
| ac_cv_ps_flags="-el" |
| elif test "`($PSPROG acx 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then |
| ac_cv_ps_flags="acx" |
| elif test "`($PSPROG -acx 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then |
| ac_cv_ps_flags="-acx" |
| elif test "`($PSPROG -o pid,tt,state,time,ucomm 2>&1) | egrep ' ps *$' | awk '{print $NF}'`" = "ps" ; then |
| ac_cv_ps_flags="-o pid,tt,state,time,ucomm" |
| else |
| AC_MSG_WARN(Unable to determine valid ps flags... defaulting...) |
| ac_cv_ps_flags="-acx" |
| fi |
| ]) |
| |
| AC_DEFINE_UNQUOTED(PSCMD, "$PSPROG $ac_cv_ps_flags") |
| |
| dnl Checks for byte order |
| AC_C_BIGENDIAN |
| |
| dnl Checks for library functions. |
| AC_FUNC_ALLOCA |
| AC_PROG_GCC_TRADITIONAL |
| AC_FUNC_MEMCMP |
| AC_TYPE_SIGNAL |
| AC_FUNC_GETMNTENT |
| AC_CHECK_FUNCS(setmntent gethostname uname gettimeofday select socket strtol) |
| AC_CHECK_FUNCS(strchr strdup memcpy memmove index bcopy) |
| AC_CHECK_FUNCS(signal sigset sigblock sighold strerror setenv vsnprintf) |
| AC_CHECK_FUNCS(random lrand48 rand) |
| AC_CHECK_FUNCS(rpmGetPath) |
| |
| AC_CHECK_FUNCS(getloadavg) |
| AC_CHECK_FUNCS(kvm_openfiles nlist) |
| dnl BSDi2 functions differ |
| AC_CHECK_FUNCS(statvfs statfs) |
| AC_CHECK_FUNCS(getdtablesize) |
| dnl freebsd2 checks |
| AC_CHECK_FUNCS(getfsstat kvm_getprocs) |
| AC_CHECK_FUNCS(usleep) |
| AC_CHECK_FUNCS(setlocale) |
| AC_CHECK_FUNCS(tcgetattr) |
| |
| AC_MSG_CHECKING([for SIOCGIFADDR in sys/ioctl.h]) |
| AC_CACHE_VAL(cv_sys_ioctl_h_has_SIOCGIFADDR, |
| [ AC_EGREP_CPP(xxxyesxxx, |
| [ |
| #ifdef HAVE_SYS_IOCTL_H |
| #include <sys/ioctl.h> |
| #endif |
| #ifdef SIOCGIFADDR |
| xxxyesxxx |
| #endif |
| ], cv_sys_ioctl_h_has_SIOCGIFADDR=yes, cv_sys_ioctl_h_has_SIOCGIFADDR=no)]) |
| AC_MSG_RESULT($cv_sys_ioctl_h_has_SIOCGIFADDR) |
| if test $cv_sys_ioctl_h_has_SIOCGIFADDR = yes; then |
| AC_DEFINE(SYS_IOCTL_H_HAS_SIOCGIFADDR) |
| fi |
| |
| # ultrix |
| AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)]) |
| AC_CACHE_VAL(fu_cv_sys_stat_fs_data, |
| [AC_TRY_RUN([#include <sys/types.h> |
| #ifdef HAVE_SYS_PARAM_H |
| #include <sys/param.h> |
| #endif |
| #ifdef HAVE_SYS_MOUNT_H |
| #include <sys/mount.h> |
| #endif |
| #ifdef HAVE_SYS_FS_TYPES_H |
| #include <sys/fs_types.h> |
| #endif |
| main () |
| { |
| struct fs_data fsd; |
| /* Ultrix's statfs returns 1 for success, |
| 0 for not mounted, -1 for failure. */ |
| exit (statfs (".", &fsd) != 1); |
| }], |
| fu_cv_sys_stat_fs_data=yes, |
| fu_cv_sys_stat_fs_data=no, |
| fu_cv_sys_stat_fs_data=no)]) |
| AC_MSG_RESULT($fu_cv_sys_stat_fs_data) |
| if test $fu_cv_sys_stat_fs_data = yes; then |
| AC_DEFINE(STAT_STATFS_FS_DATA) |
| fi |
| |
| dnl check if compiler pre-processor defines __FUNCTION__ |
| AC_CACHE_CHECK(if __FUNCTION__ is defined,ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED, |
| [ |
| AC_TRY_COMPILE(,[ |
| char *cp = __FUNCTION__; |
| ], ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=yes, ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=no)]) |
| |
| if test "x$ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED" = "xyes"; then |
| AC_DEFINE(HAVE_CPP_UNDERBAR_FUNCTION_DEFINED) |
| fi |
| |
| AC_CHECK_STRUCT_FOR([ |
| #include <sys/types.h> |
| #define KERNEL |
| #define _KERNEL |
| #include <sys/socket.h> |
| #undef KERNEL |
| #undef _KERNEL |
| #include <net/route.h> |
| ], rtentry, rt_dst, no) |
| |
| dnl checking for 4.3 vs 4.4 rtentry. |
| AC_CACHE_CHECK(type of rtentry structure,ac_cv_RTENTRY_TYPE, |
| [ |
| |
| dnl 4.4 compat |
| AC_TRY_COMPILE([ |
| #include <sys/types.h> |
| #define KERNEL |
| #define _KERNEL |
| #include <sys/socket.h> |
| #undef KERNEL |
| #undef _KERNEL |
| #include <net/route.h> |
| ],[ |
| |
| #ifndef STRUCT_RTENTRY_HAS_RT_DST |
| #define rt_dst rt_nodes->rn_key |
| #endif |
| |
| struct rtentry rt; |
| rt.rt_nodes[0].rn_b = 1; |
| rt.rt_dst; |
| ], ac_cv_RTENTRY_TYPE="BSD-4.4") |
| |
| dnl 4.3 compat |
| if test "x$ac_cv_RTENTRY_TYPE" = "x"; then |
| AC_TRY_COMPILE([ |
| #include <sys/types.h> |
| #define KERNEL |
| #define _KERNEL |
| #include <sys/socket.h> |
| #undef KERNEL |
| #undef _KERNEL |
| #include <net/route.h> |
| ],[ |
| struct rtentry rt; |
| rt.rt_hash; |
| ], ac_cv_RTENTRY_TYPE="BSD-4.3") |
| fi |
| |
| dnl else ack. |
| if test "x$ac_cv_RTENTRY_TYPE" = "x"; then |
| AC_MSG_WARN(Unknown) |
| ac_cv_RTENTRY_TYPE="unknown" |
| fi |
| |
| ]) |
| |
| if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.4"; then |
| AC_DEFINE(RTENTRY_4_4) |
| fi |
| |
| dnl checking for alpha's ortentry vs rtentry |
| if test "x$ac_cv_RTENTRY_TYPE" = "xunknown"; then |
| AC_CACHE_CHECK(for struct rtentry, ac_cv_struct_rtentry, |
| [AC_EGREP_CPP(ortentry, [#define KERNEL |
| #include<net/route.h> |
| ], ac_cv_struct_rtentry=ortentry, ac_cv_struct_rtentry=rtentry ) |
| if test "x$ac_cv_struct_rtentry" = "xrtentry" ; then |
| ac_cv_struct_rtentry="rtentry" |
| else |
| ac_cv_struct_rtentry="ortentry" |
| fi |
| ]) |
| else |
| RTENTRY_TYPE="rtentry" |
| ac_cv_struct_rtentry="rtentry" |
| fi |
| |
| if test "x$ac_cv_struct_rtentry" != "x"; then |
| AC_DEFINE_UNQUOTED(RTENTRY,struct ${ac_cv_struct_rtentry}) |
| else |
| AC_DEFINE(RTENTRY,struct rtentry) |
| fi |
| |
| dnl check for 4.3's rtentry->rt_next |
| if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.3"; then |
| AC_CACHE_CHECK(for struct rtentry has a rt_next node, |
| ac_cv_struct_rtentry_rt_next, |
| [ |
| AC_TRY_COMPILE([ |
| #include <sys/types.h> |
| #define KERNEL |
| #define _KERNEL |
| #include <sys/socket.h> |
| #undef KERNEL |
| #undef _KERNEL |
| #include <net/route.h> |
| ],[ |
| struct rtentry rt; |
| rt.rt_next; |
| ], ac_cv_struct_rtentry_rt_next=yes, ac_cv_struct_rtentry_rt_next=no ) |
| ]) |
| |
| if test "x$ac_cv_struct_rtentry_rt_next" = "xyes"; then |
| AC_DEFINE(RTENTRY_RT_NEXT) |
| fi |
| |
| fi |
| |
| dnl Check struct rtentry for various things. |
| AC_CHECK_STRUCT_FOR([ |
| #include <sys/types.h> |
| #define KERNEL |
| #define _KERNEL |
| #include <sys/socket.h> |
| #undef KERNEL |
| #undef _KERNEL |
| #include <net/route.h> |
| ], rtentry, rt_unit) |
| |
| AC_CHECK_STRUCT_FOR([ |
| #include <sys/types.h> |
| #define KERNEL |
| #define _KERNEL |
| #include <sys/socket.h> |
| #undef KERNEL |
| #undef _KERNEL |
| #include <net/route.h> |
| ], rtentry, rt_refcnt) |
| |
| AC_CHECK_STRUCT_FOR([ |
| #include <sys/types.h> |
| #define KERNEL |
| #define _KERNEL |
| #include <sys/socket.h> |
| #undef KERNEL |
| #undef _KERNEL |
| #include <net/route.h> |
| ], rtentry, rt_hash) |
| |
| AC_CHECK_STRUCT_FOR([ |
| #include <sys/types.h> |
| #define KERNEL |
| #define _KERNEL |
| #include <sys/socket.h> |
| #undef KERNEL |
| #undef _KERNEL |
| #include <net/route.h> |
| ], rtentry, rt_use) |
| |
| dnl Check tcpstat for tcpstat.tcp_rcvmemdrop |
| AC_CHECK_STRUCT_FOR([ |
| #include <sys/types.h> |
| #include <netinet/tcp.h> |
| #ifdef HAVE_NETINET_TCP_TIMER_H |
| #include <netinet/tcp_timer.h> |
| #endif |
| |
| #ifdef HAVE_NETINET_TCP_VAR_H |
| #include<netinet/tcp_var.h> |
| #endif |
| ], tcpstat, tcp_rcvmemdrop) |
| |
| dnl irix checks |
| |
| AC_CHECK_STRUCT_FOR([ |
| #include <sys/types.h> |
| #include <sys/socket.h> |
| #include <net/if.h> |
| #ifdef HAVE_NET_IF_VAR_H |
| #include <net/if_var.h> |
| #endif |
| ], ifnet, if_mtu) |
| |
| if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xno"; then |
| AC_CACHE_CHECK(if _KERNEL needs to be defined for if_mtu, ac_cv_IFNET_NEEDS_KERNEL, |
| [ |
| if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xyes"; then |
| ac_cv_IFNET_NEEDS_KERNEL=no |
| else |
| AC_TRY_COMPILE([ |
| #define _KERNEL 1 |
| #include <sys/types.h> |
| #include <sys/socket.h> |
| #ifdef HAVE_SYS_TIME_H |
| #include <sys/time.h> |
| #endif |
| #include <net/if.h> |
| #ifdef HAVE_NET_IF_VAR_H |
| #include <net/if_var.h> |
| #endif |
| ],[ |
| struct ifnet testit; |
| testit.if_mtu = 0; |
| ], ac_cv_IFNET_NEEDS_KERNEL=yes, ac_cv_IFNET_NEEDS_KERNEL=no) |
| fi |
| ]) |
| |
| if test "x$ac_cv_IFNET_NEEDS_KERNEL" = "xyes"; then |
| AC_DEFINE(IFNET_NEEDS_KERNEL) |
| fi |
| fi |
| |
| AC_CHECK_STRUCT_FOR([ |
| #ifdef IFNET_NEEDS_KERNEL |
| #define _KERNEL 1 |
| #endif |
| #include <sys/types.h> |
| #include <sys/socket.h> |
| #ifdef HAVE_SYS_TIME_H |
| #include <sys/time.h> |
| #endif |
| #include <net/if.h> |
| #ifdef HAVE_NET_IF_VAR_H |
| #include <net/if_var.h> |
| #endif |
| ], ifaddr, ifa_next) |
| |
| dnl Check ifnet entries using macro defined in aclocal.m4. |
| dnl |
| dnl XXX Broken on FreeBSD where these are #define'd in <net/if.h> |
| dnl |
| AC_CHECK_IFNET_FOR(if_baudrate) |
| AC_CHECK_IFNET_FOR(if_speed) |
| AC_CHECK_IFNET_FOR(if_type) |
| AC_CHECK_IFNET_FOR(if_imcasts) |
| AC_CHECK_IFNET_FOR(if_iqdrops) |
| AC_CHECK_IFNET_FOR(if_noproto) |
| AC_CHECK_IFNET_FOR(if_omcasts) |
| AC_CHECK_IFNET_FOR(if_xname,no) |
| AC_CHECK_IFNET_FOR(if_lastchange.tv_sec) |
| AC_CHECK_IFNET_FOR(if_obytes) |
| AC_CHECK_IFNET_FOR(if_ibytes) |
| AC_CHECK_IFNET_FOR(if_addrlist) |
| AC_CHECK_IFNET_FOR(if_addrhead.tqh_first) |
| |
| AC_CHECK_STRUCT_FOR([ |
| #if HAVE_NETINET_UDP_VAR_H |
| #include <netinet/udp_var.h> |
| #endif |
| ],udpstat,udps_discard) |
| |
| AC_CHECK_STRUCT_FOR([ |
| #include<sys/types.h> |
| #include<sys/socket.h> |
| #ifdef HAVE_SYS_TIME_H |
| #include <sys/time.h> |
| #endif |
| #include<net/if.h> |
| #if HAVE_NETINET_IN_H |
| #include<netinet/in.h> |
| #endif |
| #if HAVE_NETINET_IF_ETHER_H |
| #include<netinet/if_ether.h> |
| #endif |
| ],arphd,at_next) |
| |
| AC_CHECK_STRUCT_FOR([ |
| #if HAVE_SYS_CONF_H |
| #include <sys/conf.h> |
| #endif |
| ],swdevt,sw_nblksenabled) |
| |
| AC_CHECK_STRUCT_FOR([ |
| #ifdef HAVE_SYS_STAT_H |
| #include <sys/stat.h> |
| #endif |
| #if HAVE_SYS_STATFS_H |
| #include <sys/statfs.h> |
| #endif |
| #if HAVE_SYS_STATVFS_H |
| #include <sys/statvfs.h> |
| #endif |
| ],statvfs,f_frsize) |
| |
| AC_CHECK_STRUCT_FOR([ |
| #if HAVE_NLIST_H |
| #include <nlist.h> |
| #endif |
| ],nlist,n_value) |
| |
| dnl attempt to figure out if sysctl is usable |
| |
| AC_CACHE_CHECK(if sysctl can read kernel information,ac_cv_CAN_USE_SYSCTL, |
| [AC_TRY_RUN([ |
| #if TIME_WITH_SYS_TIME |
| # include <sys/time.h> |
| # include <time.h> |
| #else |
| # if HAVE_SYS_TIME_H |
| # include <sys/time.h> |
| # else |
| # include <time.h> |
| # endif |
| #endif |
| #include <sys/types.h> |
| #if HAVE_SYS_PARAM_H |
| # include <sys/param.h> |
| #endif |
| #if HAVE_SYS_SYSCTL_H |
| # include <sys/sysctl.h> |
| #endif |
| |
| main() { |
| int mib[2]; |
| size_t len; |
| struct timeval boottime; |
| |
| mib[0] = CTL_KERN; |
| mib[1] = KERN_BOOTTIME; |
| |
| len = sizeof(boottime); |
| sysctl(mib, 2, &boottime, &len, NULL, NULL); |
| if (boottime.tv_sec != 0) |
| exit(0); |
| else |
| exit(1); |
| } |
| ], ac_cv_CAN_USE_SYSCTL=yes, ac_cv_CAN_USE_SYSCTL=no)]) |
| |
| if test "x$ac_cv_CAN_USE_SYSCTL" = "xyes"; then |
| AC_DEFINE(CAN_USE_SYSCTL) |
| fi |
| |
| dnl |
| dnl KMT is not very portable and we need to handle problems it creates. |
| dnl |
| AC_CHECK_TYPE(u_int8_t, unsigned char) |
| AC_CHECK_TYPE(u_int16_t, unsigned short) |
| AC_CHECK_TYPE(u_int32_t, unsigned int) |
| |
| dnl |
| dnl Prompt for various bits of user information |
| dnl |
| |
| 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"; then |
| AC_CACHE_CHECK(if you have run configure before, ac_cv_have_warned, |
| [ |
| if test "x$defaults" = "xno"; then |
| cat << EOF |
| |
| ************** Configuration Section ************** |
| |
| You are about to be prompted by a series of questions. Answer |
| them carefully, as they determine how the snmp agent and related |
| applications are to function. |
| |
| After the configure script finishes, you can browse the newly |
| created config.h file for further - less important - parameters to |
| modify. Be careful if you re-run configure though since config.h will |
| be over written. |
| |
| -Press return to continue- |
| EOF |
| |
| read tmpinput |
| ac_cv_have_warned="yes" |
| echo $ac_n "disabling above prompt for future runs... $ac_c" |
| else |
| ac_cv_have_warned="no" |
| fi |
| ]) |
| else |
| ac_cv_have_warned="yes" |
| fi |
| |
| ME=`$WHOAMI` |
| if test -f /etc/resolv.conf; then |
| LOC=`cat /etc/resolv.conf | grep '^domain' | tail -1 | awk '{print $NF}'` |
| else |
| LOC="@no.where" |
| fi |
| |
| AC_PROMPT_USER(SYS_CONTACT,[ |
| |
| *** System Contact Information: |
| |
| Describes who should be contacted about the host the agent is |
| running on. This information is available in the MIB-II tree. This |
| Can Also Be Over-Ridden Using The \"syscontact\" Syntax In The Agent'S |
| Configuration Files. |
| |
| System Contact Information],$ME@$LOC,1) |
| |
| AC_PROMPT_USER(SYS_LOC,[ |
| |
| *** System Location: |
| |
| Describes the location of the system. This information is |
| available in the MIB-II tree. This Can also be over-ridden using the |
| \"syslocation\" syntax in the agent's configuration files. |
| |
| System Location],Unknown,1) |
| |
| if test -d /var/log; then |
| defaultlog="/var/log/snmpd.log" |
| else |
| defaultlog="/usr/adm/snmpd.log" |
| fi |
| |
| AC_PROMPT_USER(LOGFILE,[ |
| |
| *** Logfile location: |
| |
| Enter the default location for the snmpd agent to dump |
| information & errors to. If not defined (enter the keyword \"none\" |
| at the prompt below) the agent will use stdout and stderr instead. |
| (Note: This value can be over-ridden using command line options.) |
| |
| Location to write logfile],$defaultlog,1) |
| |
| if test -d /var; then |
| defaultstore="/var/ucd-snmp" |
| else |
| defaultstore="/etc/ucd-snmp" |
| fi |
| |
| AC_PROMPT_USER(PERSISTENT_DIRECTORY,[ |
| |
| *** snmpd persistent storage location: |
| |
| Enter a directory for the snmp library to store persistent |
| data in the form of a configuration file. |
| |
| Location to write persistent information],$defaultstore,1) |
| |
| PERSISTENT_DIRECTORY=$ac_cv_user_prompt_PERSISTENT_DIRECTORY |
| AC_SUBST(PERSISTENT_DIRECTORY) |
| |
| AC_OUTPUT([ |
| Makefile:Makefile.top:Makefile.in |
| snmplib/Makefile:Makefile.top:snmplib/Makefile.in |
| agent/Makefile:Makefile.top:agent/Makefile.in |
| apps/Makefile:Makefile.top:apps/Makefile.in |
| apps/snmpnetstat/Makefile:Makefile.top:apps/snmpnetstat/Makefile.in |
| agent/mibgroup/Makefile:Makefile.top:agent/mibgroup/Makefile.in |
| agent/dlmods/Makefile:Makefile.top:agent/dlmods/Makefile.in |
| local/Makefile:Makefile.top:local/Makefile.in |
| testing/Makefile:Makefile.top:testing/Makefile.in |
| man/Makefile:Makefile.top:man/Makefile.in |
| ov/Makefile:Makefile.top:ov/Makefile.in |
| mibs/Makefile:Makefile.top:mibs/Makefile.in |
| ], echo timestamp > stamp-h) |
| |
| dnl Local Variables: |
| dnl mode: sh |
| dnl comment-start: "dnl" |
| dnl End: |