1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420
|
# -*- autoconf -*-
#########################################
##
# Miscellaneous Operating-System characteristics
##
#########################################
# Determine how to test for character devices
# [We assume that /dev/null does actually exist!]
#
if test -c /dev/null; then
CDEV_TEST_FLAG="-c"
elif test -f /dev/null; then
CDEV_TEST_FLAG="-f"
else
AC_MSG_WARN([Can't reliably detect character devices])
# Is it actually sensible to fall back on "test -f" ?
CDEV_TEST_FLAG="-f"
fi
# Kernel Location
# used in library/agent
#
AC_CACHE_CHECK([for location of system kernel],
ac_cv_KERNEL_LOC,
[ac_cv_KERNEL_LOC="unknown"
for i in /vmunix /hp-ux /stand/vmunix /dev/ksyms /kernel/unix /kernel/genunix /netbsd /unix /kernel /bsd /mach_kernel /boot/kernel/kernel
do
if test $CDEV_TEST_FLAG $i; then
ac_cv_KERNEL_LOC="$i"
break;
fi
done
#
# In principle, this test is meant to provide a default path to the kernel
# In practice, the test is broken and the kernel path is set to "unknown"
#
# Note that on certain systems (e.g. some Linux distributions),
# it is impossible to predict the name of the kernel,
# particularly if it includes the kernel version, architecture, etc
#
# Since this default will never actually be used, then don't try to set it
#
if test $i = "unknown"; then
AC_MSG_WARN([Can't find system kernel... hopefully this won't be needed!])
fi
])
AC_DEFINE_UNQUOTED(KERNEL_LOC,"$ac_cv_KERNEL_LOC", [location of UNIX kernel])
# Swap device Location
# (/dev/dmem or /dev/drum)
# used in agent only
#
AC_CACHE_CHECK([for location of swap device],
ac_cv_DMEM_LOC,
[if test $CDEV_TEST_FLAG /dev/dmem; then
ac_cv_DMEM_LOC="/dev/dmem"
elif test $CDEV_TEST_FLAG /dev/drum; then
ac_cv_DMEM_LOC="/dev/drum"
else
ac_cv_DMEM_LOC="none"
fi
])
#
# Note that it's OK if this device is not found
#
if test "x$ac_cv_DMEM_LOC" != "xnone"; then
AC_DEFINE_UNQUOTED(DMEM_LOC,"$ac_cv_DMEM_LOC", [location of swap device])
fi
# Mount table Location
# used in agent only
#
AC_CACHE_CHECK([for mount table location],
ac_cv_ETC_MNTTAB,
[ac_cv_ETC_MNTTAB="${with_mnttab:-unknown}"
if test "$ac_cv_ETC_MNTTAB" = "unknown"; then
for i in /etc/mnttab /etc/mtab /etc/filesystems /dev/mnttab
do
if test -f $i -o -c $i; then
ac_cv_ETC_MNTTAB="$i"
break;
fi
done
fi
])
AC_DEFINE_UNQUOTED(ETC_MNTTAB,"$ac_cv_ETC_MNTTAB", [location of mount table list])
# Printing
# used in agent only
#
AC_PATH_PROG([LPSTAT_PATH],lpstat)
if test x$LPSTAT_PATH != x; then
AC_DEFINE_UNQUOTED(LPSTAT_PATH, "$LPSTAT_PATH",
[Path to the lpstat command])
AC_DEFINE(HAVE_LPSTAT, 1, [Set if the lpstat command is available])
fi
if test -r /etc/printcap; then
AC_DEFINE(HAVE_PRINTCAP, 1, [Set if /etc/printcap exists])
fi
# Check ps args
# used in agent only
#
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"
elif test "`($PSPROG ax 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
ac_cv_ps_flags="ax"
elif test "x$PARTIALTARGETOS" = "xcygwin"; then
ac_cv_ps_flags="-e"
elif test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc"; then
ac_cv_ps_flags="-e"
else
AC_MSG_WARN([Unable to determine valid ps flags... defaulting...])
ac_cv_ps_flags="-acx"
fi
])
PSCMD="$PSPROG $ac_cv_ps_flags"
AC_SUBST(PSCMD)
AC_DEFINE_UNQUOTED(PSCMD, "$PSPROG $ac_cv_ps_flags",
[Command to generate ps output, the final column must be the process
name withOUT arguments])
##
# System/Compilation-related
##
# Test for SIGHUP
#
AC_MSG_CHECKING([for SIGHUP])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <signal.h>], [return SIGHUP])],
[netsnmp_have_sighup=yes],
[netsnmp_have_sighup=no]
)
AC_MSG_RESULT([$netsnmp_have_sighup])
if test "x$netsnmp_have_sighup" = xyes; then
AC_DEFINE([HAVE_SIGHUP], [1],
[Define if SIGHUP is defined in <signal.h>.])
fi
# Check whether sysctl() is usable
# used in library/agent
#
if test $cross_compiling = yes; then
AC_MSG_WARN([Can't check sysctl, manually define NETSNMP_CAN_USE_SYSCTL if platform support available])
else
AC_CACHE_CHECK([if sysctl can read kernel information],
ac_cv_NETSNMP_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
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#include <sys/types.h>
#if HAVE_SYS_SYSCTL_H
# include <sys/sysctl.h>
#endif
int main(int argc, char **argv)
{
int mib[2];
size_t len;
struct timeval boottime;
mib[0] = CTL_KERN;
mib[1] = KERN_BOOTTIME;
len = sizeof(boottime);
return 1 - (sysctl(mib, 2, &boottime, &len, NULL, 0) == 0 && boottime.tv_sec);
}
],
ac_cv_NETSNMP_CAN_USE_SYSCTL=yes,
ac_cv_NETSNMP_CAN_USE_SYSCTL=no,
ac_cv_NETSNMP_CAN_USE_SYSCTL=no)])
fi
if test "x$ac_cv_NETSNMP_CAN_USE_SYSCTL" = "xyes"; then
AC_DEFINE(NETSNMP_CAN_USE_SYSCTL, 1, [sysctl works to get boottime, etc...])
fi
# Check whether TCP timer constants are indeed constant
# or depend on the kernel clock tick 'hz'. (FreeBSD 4.x)
#
# If the latter, then we will need to have a local
# variable 'hz' defined and with a suitable value,
# whenever we want to use one one of these 'constants'.
#
# used in agent only
#
AC_CACHE_CHECK([whether TCP timers depend on 'hz'],
ac_cv_TCPTV_NEEDS_HZ,
[AC_EGREP_CPP(hz,
[
#include <netinet/tcp_timer.h>
TCPTV_SRTTDFLT
],
ac_cv_TCPTV_NEEDS_HZ=yes,
ac_cv_TCPTV_NEEDS_HZ=no)])
if test "x$ac_cv_TCPTV_NEEDS_HZ" = "xyes"; then
AC_DEFINE(TCPTV_NEEDS_HZ, 1,
[Define if the TCP timer constants in <netinet/tcp_timer.h>
depend on the integer variable 'hz'. @<:@FreeBSD 4.x@:>@])
fi
# Check whether IP Route table is cached (Solaris)
# used in agent only
#
case $target_os in
solaris*)
# Header checks (Solaris 2.6/7)
#
AC_CHECK_HEADERS(inet/common.h)
AC_CHECK_HEADERS(inet/ip.h,ac_inet_ip_h=yes,ac_inet_ip_h=no,
AC_INCLUDES_DEFAULT([])
[
#if HAVE_SYS_STREAM_H
#include <sys/stream.h>
#endif
#if HAVE_INET_COMMON_H
#include <inet/common.h>
#endif
])
if test $ac_inet_ip_h = yes ; then
AC_CACHE_CHECK([for mib2_ipRouteEntry_t in inet/mib2.h],
ac_cv_mib2_ipRouteEntry_t,
[AC_TRY_COMPILE([
#if HAVE_INET_MIB2_H
#include <inet/mib2.h>
#endif
],[
mib2_ipRouteEntry_t testit;
if(sizeof(testit))
return(0);
],
ac_cv_mib2_ipRouteEntry_t=yes,
ac_cv_mib2_ipRouteEntry_t=no)])
if test "x$ac_cv_mib2_ipRouteEntry_t" = "xyes" ; then
AC_CACHE_CHECK([whether IRE_CACHE is defined in inet/ip.h],
ac_cv_ire_cache,
[AC_TRY_COMPILE([
#if HAVE_INET_IP_H
#include <inet/ip.h>
#endif
],[
int testit=IRE_CACHE;
if(testit)
return(0);
],
ac_cv_ire_cache=yes,
ac_cv_ire_cache=no)])
else
ac_cv_ire_cache=no
fi
if test "x$ac_cv_ire_cache" = "xyes" ; then
AC_DEFINE(HAVE_DEFINED_IRE_CACHE,[],
[define to 1 if you have IRE_CACHE defined in <inet/ip.h> header file.])
else
AC_MSG_WARN([It seems that you have inet/ip.h, but IRE_CACHE is not defined. \
That means that your query to ipRoute MIB could generate over 20k results! \
And this can be very slow.])
fi
fi # "test $ac_inet_ip_h = yes"
;;
esac
# Check whether SO_BINDTODEVICE is available.
#
AC_MSG_CHECKING([for SO_BINDTODEVICE])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <sys/types.h>
#include <sys/socket.h>
], [
return SO_BINDTODEVICE
])],
[AC_DEFINE([HAVE_SO_BINDTODEVICE], [1],
[Define to 1 if SO_BINDTODEVICE is available])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
# Check whether struct in_pktinfo.ipi_spec_dst is available.
#
AC_CHECK_MEMBERS([struct in_pktinfo.ipi_spec_dst], [], [], [
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
])
# Check whether IP_PKTINFO is usable.
#
AC_CACHE_CHECK([for IP_PKTINFO ],
[ac_cv_have_ip_pktinfo],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <stdio.h> /* printf() */
#include <stdlib.h> /* malloc() */
#include <string.h> /* memset() */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
], [
void *buf;
int len;
void *from;
socklen_t *fromlen;
struct iovec iov;
char *cmsg = malloc(CMSG_SPACE(sizeof(struct in_pktinfo)));
struct cmsghdr *cm;
struct msghdr msg;
iov.iov_base = buf;
iov.iov_len = len;
memset(&msg, 0, sizeof msg);
msg.msg_name = from;
msg.msg_namelen = *fromlen;
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_control = &cmsg;
msg.msg_controllen = sizeof(cmsg);
for (cm = CMSG_FIRSTHDR(&msg); cm; cm = CMSG_NXTHDR(&msg, cm)) {
if (cm->cmsg_level == SOL_IP && cm->cmsg_type == IP_PKTINFO) {
struct in_pktinfo* src = (struct in_pktinfo *)CMSG_DATA(cm);
printf("Address: %s; index: %d\n", inet_ntoa(src->ipi_addr),
src->ipi_ifindex);
}
}
])],
[ac_cv_have_ip_pktinfo=yes],
[ac_cv_have_ip_pktinfo=no]
)])
if test x$ac_cv_have_ip_pktinfo = xyes; then
AC_DEFINE(HAVE_IP_PKTINFO, 1, [Set if IP_PKTINFO is usable])
fi
# Check whether IP_RECVDSTADDR is usable.
#
AC_CACHE_CHECK([for IP_RECVDSTADDR ],
[ac_cv_have_ip_recvdstaddr],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <stdio.h> /* printf() */
#include <stdlib.h> /* malloc() */
#include <string.h> /* memset() */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
], [
void *buf;
int len;
void *from;
socklen_t *fromlen;
struct iovec iov;
char *cmsg = malloc(CMSG_SPACE(sizeof(struct in_addr)));
struct cmsghdr *cm;
struct msghdr msg;
iov.iov_base = buf;
iov.iov_len = len;
memset(&msg, 0, sizeof msg);
msg.msg_name = from;
msg.msg_namelen = *fromlen;
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_control = &cmsg;
msg.msg_controllen = sizeof(cmsg);
for (cm = CMSG_FIRSTHDR(&msg); cm; cm = CMSG_NXTHDR(&msg, cm)) {
if (cm->cmsg_level == IPPROTO_IP && cm->cmsg_type == IP_RECVDSTADDR) {
struct in_addr* src = (struct in_addr *)CMSG_DATA(cm);
printf("Address: %s\n", inet_ntoa(src));
}
}
])],
[ac_cv_have_ip_recvdstaddr=yes],
[ac_cv_have_ip_recvdstaddr=no]
)])
if test x$ac_cv_have_ip_recvdstaddr = xyes; then
AC_DEFINE(HAVE_IP_RECVDSTADDR, 1, [Set if IP_RECVDSTADDR is usable])
fi
|