blob: 788462bd6f09675a0dffdec62deefafad7320729 [file] [log] [blame]
dnl Process this file with autoconf to produce a configure script.
AC_INIT(agent/extensible/extensible.c)
AC_CONFIG_HEADER(config.h)
AC_ARG_ENABLE(debugging,[ --enable-debugging Outputs extra debugging information.],AC_DEFINE(DODEBUG))
AC_ARG_WITH(defaults,[ --with-defaults Use defaults for prompted values.],defaults="yes",defaults="no")
AC_ARG_WITH(root-access,[ --without-root-access The agent does not exit if it can not open /dev/kmem.])
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 Checks for programs.
AC_CHECK_PROGS(CC,cc gcc c89 shlicc2,cc)
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PATH_PROG(PSPROG,ps)
AC_PATH_PROG(UNAMEPROG,uname)
AC_DEFINE_UNQUOTED(UNAMEPROG,"$UNAMEPROG")
AC_CHECK_PROGS(SED,sed gsed)
AC_AIX
dnl system check
AC_CANONICAL_SYSTEM
changequote(, )
CFLAGS="$CFLAGS -D`echo $target_os | sed 's/[-._].*//'`"
changequote([, ])
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,$EXTRACPPFLAGS)
AC_MSG_RESULT($EXTRACPPFLAGS)
dnl Set SNMPLIBPATH
if test "x$prefix" = "xNONE"; then
AC_DEFINE_UNQUOTED(SNMPLIBPATH,"$ac_default_prefix/lib/snmp")
else
AC_DEFINE_UNQUOTED(SNMPLIBPATH,"$prefix/lib/snmp")
fi
dnl
dnl Check for kernel location
dnl
AC_CACHE_CHECK(for location of sytem kernel,ac_cv_KERNEL_LOC,
[ac_cv_KERNEL_LOC="unknown"
for i in /vmunix /hp-ux /stand/vmunix /kernel/unix /dev/ksyms /kernel/genunix /netbsd /unix /kernel /bsd
do
if test -f $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)
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(socket, getservbyname)
dnl AC_CHECK_LIB(ucb, bzero)
dnl Replace `main' with a function in -ltcl:
dnl AC_CHECK_LIB(tcl, main)
dnl Replace `main' with a function in -ltk:
dnl AC_CHECK_LIB(tk, main)
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 Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(strings.h fcntl.h limits.h sys/file.h sys/ioctl.h syslog.h unistd.h netinet/tcpip.h netinet/in.h sys/dmap.h machine/pte.h xti.h sys/sockio.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)
dnl FreeBSD required headers
AC_CHECK_HEADERS(malloc.h sys/param.h net/if_dl.h sys/sysctl.h stdlib.h net/if_types.h)
dnl Linux (lame) doesn't have these
AC_CHECK_HEADERS(sys/conf.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)
dnl NetBSD required headers
AC_CHECK_HEADERS(arpa/inet.h kvm.h)
dnl BSDi2 headers
AC_CHECK_HEADERS(sys/mount.h vm/swap_pager.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_HEADER_TIME
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"
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 gettimeofday select socket strtol)
AC_CHECK_FUNCS(strchr memcpy memmove index bcopy signal sigset sigblock sighold)
AC_CHECK_FUNCS(random lrand48 rand)
AC_CHECK_FUNCS(getloadavg)
AC_CHECK_FUNCS(kvm_openfiles)
dnl BSDi2 functions differ
AC_CHECK_FUNCS(statvfs statfs)
dnl check if compiler accepts void pointers
AC_CACHE_CHECK(if $CC allows pointers to void,ac_cv_PTR_TO_VOID,
[
AC_TRY_COMPILE([
void generic_function(a)
void *a;
{
}
],[
char *cp;
generic_function((void *) cp);
], ac_cv_PTR_TO_VOID=yes, ac_cv_PTR_TO_VOID=no)])
if test "x$ac_cv_PTR_TO_VOID" = "xno"; then
AC_DEFINE(void,char)
fi
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>
],[
struct rtentry rt;
rt.rt_nodes[0].rn_b = 1;
], 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_DEFINE(RTENTRY,struct rtentry)
else
AC_DEFINE(RTENTRY,struct ortentry)
fi
])
else
RTENTRY_TYPE="rtentry"
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 tcpstat for tcpstat.tcp_rcvmemdrop
AC_CHECK_STRUCT_FOR([
#ifdef HAVE_NETINET_TCP_VAR_H
#include<netinet/tcp_var.h>
#endif
], tcpstat, tcp_rcvmemdrop)
dnl Check ifnet entries using macro defined in aclocal.m4.
AC_CHECK_IFNET_FOR(if_baudrate)
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_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>
#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_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
])
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 the command line options.)
Location to write logfile],$defaultlog,1)
AC_PROMPT_USER(GLOBALSECURITY,[
*** SNMP Security/Authentication:
You may pick one of two types of SNMP authentication to use
for this agent. Only the extensible section is affected by the
following choices. This will be handled better in version 3.2 and
above. Note that to use anything other than SNMPV1 the configuration
files must be set up properly for SNMPV2 usage.
(Encryption is not supported because of U.S. cryptography laws)
SNMPV1 Any type of snmp transmission can access the extensible tree.
SNMPV2ANY Any type of snmpV2 transmissions can access the extensible tree.
SNMPV2AUTH Only authenticated V2 transmissions can access the extensible tree.
If you don't understand any of the above sentences: pick SNMPV1.
What type of security to use],SNMPV1)
AC_OUTPUT(Makefile snmplib/Makefile snmptcl/Makefile agent/Makefile apps/Makefile apps/snmpnetstat/Makefile agent/extensible/Makefile local/Makefile man/Makefile ov/Makefile, echo timestamp > stamp-h)
dnl Local Variables:
dnl mode: sh
dnl End: