📄 configure.in
字号:
dnl configure.in for ifstatdnl Process this file with autoconf to create configurednl $Id: configure.in,v 1.51 2003/11/22 01:27:51 gael Exp $AC_INIT(ifstat.c)AC_ARG_ENABLE(debug, [ --enable-debug setup flags (gcc) for debugging (default=no)],CFLAGS="$CFLAGS -O2 -Wall -g"CPPFLAGS="$CPPFLAGS -DDEBUG"LDFLAGS="$LDFLAGS",)AC_ARG_ENABLE(optim, [ --enable-optim setup flags (gcc) for optimizations (default=no)],if test "x$enable_debug" != "xyes" ; then CFLAGS="$CFLAGS -O3 -fomit-frame-pointer -g0" LDFLAGS="$LDFLAGS -s"else AC_MSG_WARN([enable-optim and enable-debug are incompatible -- disabling optimizations])fi,)AC_CONFIG_HEADER(config.h)dnl ProgramsAC_PROG_INSTALLAC_PROG_CCAC_PROG_RANLIBAC_HEADER_STDCAC_CHECK_HEADERS(sys/time.h)AC_HEADER_TIMEAC_CHECK_HEADERS(unistd.h ctype.h sys/types.h sys/param.h sys/mbuf.h net/route.h net/if.h net/if_var.h net/if_types.h sys/socket.h sys/ioctl.h sys/sockio.h net/soioctl.h sys/termios.h errno.h signal.h stdarg.h limits.h fcntl.h)AC_TYPE_SIGNALAC_CHECK_FUNCS(sigaction snprintf)# Options for various drivers# auto means try if no other found, no disables, and anything else is try.AC_ARG_WITH(proc, [ --with-proc[=FILE] include /proc/net/dev support (default=auto)], [], [with_proc=auto])AC_ARG_WITH(kstat, [ --with-kstat include kstat(3K) support (default=auto)], [], [with_kstat=auto])AC_ARG_WITH(ifmib, [ --with-ifmib include ifmib(4) support (default=auto)], [], [with_ifmib=auto])AC_ARG_WITH(ifdata, [ --with-ifdata include ifdata ioctl support (default=auto)], [], [with_ifdata=auto])AC_ARG_WITH(route, [ --with-route include route(4) sysctl support (default=auto)], [], [with_route=auto])AC_ARG_WITH(kvm, [ --with-kvm include kvm(3) support (default=auto)], [], [with_kvm=auto])AC_ARG_WITH(dlpi, [ --with-dlpi include HP DLPI support (default=auto)], [], [with_dlpi=auto])AC_ARG_WITH(win32, [ --with-win32 include Win32 support (default=auto)], [], [with_win32=auto])AC_ARG_WITH(snmp, [ --with-snmp[=PREFIX] include UCD-SNMP support (default=yes)], [], [with_snmp=yes])with_ioctl=no # only enabled if needed by other driverslocal=no # yes if one driver is local# checking for proc (Linux)if test "x$with_proc" != "xno"; then case "$with_proc" in /*) file=$with_proc ;; *) file=/proc/net/dev ;; esac AC_MSG_CHECKING([for proc interface in $file]) if grep -q Inter- $file 2>/dev/null; then AC_DEFINE([USE_PROC], 1, [Define if you want to use /proc to get stats]) AC_DEFINE_UNQUOTED([PROC_FILE], ["$file"], [Proc file to poll for stats]) with_proc=yes with_ioctl=yes local=yes else with_proc=no fi AC_MSG_RESULT([$with_proc])fi# checking for kstat (Solaris)test "x$with_kstat" = "xauto" -a "x$local" = "xyes" && with_kstat=noif test "x$with_kstat" != "xno"; then AC_CHECK_FUNC(kstat_open, with_kstat=yes, with_kstat=no) if test "x$with_kstat" != "xyes" ; then case "x$LIBS" in *-lkstat*) ;; *) AC_CHECK_LIB(kstat, kstat_open, [LIBS="$LIBS -lkstat"; with_kstat=yes]) ;; esac fi if test "x$with_kstat" = "xyes" ; then AC_CHECK_HEADERS(kstat.h) AC_DEFINE([USE_KSTAT], 1, [Define if you want to use kstat to get stats]) with_ioctl=yes local=yes fifi# checking for ifmib (FreeBSD)test "x$with_ifmib" = "xauto" -a "x$local" = "xyes" && with_ifmib=noif test "x$with_ifmib" != "xno"; then AC_CHECK_HEADER(net/if_mib.h, [AC_CHECK_FUNC(sysctl, with_ifmib=yes, with_ifmib=no)], with_ifmib=no) if test "x$with_ifmib" = "xyes"; then AC_CHECK_HEADERS(sys/sysctl.h net/if_mib.h) AC_MSG_CHECKING([for working ifmib sysctl]) # try run since interface is available on darwin but doesn't work AC_TRY_RUN([#include <sys/types.h> #include <sys/socket.h> #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #ifdef HAVE_SYS_SYSCTL_H #include <sys/sysctl.h> #endif #ifdef HAVE_NET_IF_H #include <net/if.h> #endif #ifdef HAVE_NET_IF_MIB_H #include <net/if_mib.h> #endif int ifcount[] = {CTL_NET, PF_LINK, NETLINK_GENERIC, IFMIB_SYSTEM, IFMIB_IFCOUNT}; int size; int main() { return sysctl(ifcount, 5, NULL, &size, NULL, NULL); }], [with_ifmib=yes], [with_ifmib=no], [with_ifmib=maybe]) AC_MSG_RESULT([$with_ifmib]) if test "x$with_ifmib" != "xno" ; then AC_DEFINE([USE_IFMIB], 1, [Define if you want to use if_mib to get stats]) local=yes fi fifi# checking for ioctl ifdata (Irix, ...)test "x$with_ifdata" = "xauto" -a "x$local" = "xyes" && with_ifdata=noif test "x$with_ifdata" != "xno"; then AC_MSG_CHECKING([for SIOCGIFDATA and ifdatareq]) AC_TRY_COMPILE([#include <sys/types.h> #include <sys/socket.h> #include <sys/ioctl.h> #ifdef HAVE_SYS_SOCKIO_H #include <sys/sockio.h> #endif #ifdef HAVE_NET_SOIOCTL_H #include <net/soioctl.h> #endif #include <net/if.h>], [struct ifdatareq ifd; ioctl(0, SIOCGIFDATA, (char *) &ifd); ifd.ifd_ifd.ifi_ibytes = ifd.ifd_ifd.ifi_obytes;], with_ifdata=yes, with_ifdata=no) AC_MSG_RESULT([$with_ifdata]) test "x$with_ifdata" = "xno" && with_ifdata=checkifrfiif test "x$with_ifdata" = "xcheckifr"; then AC_MSG_CHECKING([for SIOCGIFDATA and ifreq.ifr_data]) AC_TRY_COMPILE([#include <sys/types.h> #include <sys/socket.h> #include <sys/ioctl.h> #ifdef HAVE_SYS_SOCKIO_H #include <sys/sockio.h> #endif #ifdef HAVE_NET_SOIOCTL_H #include <net/soioctl.h> #endif #include <net/if.h>], [struct ifreq ifr; struct if_data ifd; ifr.ifr_data = &ifd; ioctl(0, SIOCGIFDATA, (char *) &ifr); ifd.ifi_ibytes = ifd.ifi_obytes;], [with_ifdata=yes AC_DEFINE([HAVE_IFREQ_IFR_DATA], 1, [Define if you have a ifr_data member in struct ifreq])], with_ifdata=no) AC_MSG_RESULT([$with_ifdata])fiif test "x$with_ifdata" = "xyes"; then AC_DEFINE([USE_IFDATA], 1, [Define if you want to use ifdata to get stats]) local=yes with_ioctl=yesfi# checking for route sysctl (*BSDs)test "x$with_route" = "xauto" -a "x$local" = "xyes" && with_route=noif test "x$with_route" != "xno"; then AC_CHECK_HEADERS(sys/sysctl.h net/if_dl.h) AC_CHECK_FUNC(sysctl, with_route=yes, with_route=no) if test "x$with_route" = "xyes"; then AC_MSG_CHECKING([for route info sysctl]) AC_TRY_COMPILE([#include <sys/types.h> #include <sys/socket.h> #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #ifdef HAVE_SYS_SYSCTL_H #include <sys/sysctl.h> #endif #ifdef HAVE_NET_IF_H #include <net/if.h> #endif #ifdef HAVE_NET_IF_DL_H #include <net/if_dl.h> #endif], [struct sockaddr_dl dl; struct if_msghdr ifm; int iflist[] = {CTL_NET, PF_ROUTE, 0, AF_LINK, NET_RT_IFLIST}; ifm.ifm_type = dl.sdl_nlen; dl.sdl_data + ifm.ifm_msglen; ifm.ifm_data.ifi_ibytes;], with_route=yes, with_route=no) AC_MSG_RESULT([$with_route]) if test "x$with_route" != "xno"; then AC_DEFINE([USE_ROUTE], 1, [Define this if you want to use roue(4) sysctl to get stats]) local=yes fi fifi# checking for kvm (*BSDs)test "x$with_kvm" = "xauto" -a "x$local" = "xyes" && with_kvm=noif test "x$with_kvm" != "xno"; then AC_CHECK_FUNC(kvm_openfiles, with_kvm=yes, with_kvm=no) if test "x$with_kvm" != "xyes" ; then case "x$LIBS" in *-lkvm*) ;; *) AC_CHECK_LIB(kvm, kvm_openfiles, [LIBS="$LIBS -lkvm"; with_kvm=yes]) ;; esac fi if test "x$with_kvm" != "xyes"; then # see if emulation is possible AC_CHECK_HEADERS(nlist.h, [ AC_CHECK_FUNCS(knlist, [ with_kvm=yes AC_MSG_CHECKING([whether knlist takes 3 arguments]) AC_TRY_COMPILE([#include <nlist.h>],[knlist((struct nlist *) 0, 0, 10);], knlist3=yes, knlist3=no) AC_MSG_RESULT([$knlist3]) if test "x$knlist3" = "xyes"; then AC_DEFINE([HAVE_KNLIST_ARGS3], 1, [Define if knlist needs 3 arguments]) fi ], [AC_CHECK_FUNC(nlist, [with_kvm=yes])]) ]) if test "x$with_kvm" = "xyes"; then AC_CHECK_FUNCS(readx) AC_CHECK_HEADERS(paths.h) fi else AC_CHECK_HEADERS(kvm.h) AC_DEFINE([HAVE_KVM], 1, [Define if you have the kvm(3) interface]) fi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -