📄 configure.in
字号:
if test "x$with_kvm" = "xyes"; then AC_MSG_CHECKING([whether struct ifnet has needed interface data]) AC_TRY_COMPILE([#include <sys/types.h> #include <sys/socket.h> #include <net/if.h> #ifdef HAVE_NET_IF_VAR_H #include <net/if_var.h> #endif],[struct ifnet in; in.if_ibytes = in.if_obytes; in.if_type = in.if_flags], with_kvm=yes, with_kvm=no) AC_MSG_RESULT([$with_kvm]) fi if test "x$with_kvm" = "xyes"; then AC_MSG_CHECKING([for struct ifnet if_xname member]) AC_TRY_COMPILE([#include <sys/types.h> #include <sys/socket.h> #include <net/if.h> #ifdef HAVE_NET_IF_VAR_H #include <net/if_var.h> #endif],[struct ifnet in; in.if_xname[0] = 'a';], ifxname=yes, ifxname=no) test "x$ifxname" = "xyes" && AC_DEFINE([HAVE_IFNET_IF_XNAME], 1, [Define if you have a if_xname member in struct ifnet]) AC_MSG_RESULT([$ifxname]) AC_MSG_CHECKING([for struct ifnet if_next member]) AC_TRY_COMPILE([#include <sys/types.h> #include <sys/socket.h> #include <net/if.h> #ifdef HAVE_NET_IF_VAR_H #include <net/if_var.h> #endif],[struct ifnet in; in.if_next;], ifnext=yes, ifnext=no) AC_MSG_RESULT([$ifnext]) if test "x$ifnext" = "xyes"; then AC_DEFINE([HAVE_IFNET_IF_NEXT], 1, [Define if you have a if_next member in struct ifnet]) else AC_MSG_CHECKING([for struct ifnet if_link member]) AC_TRY_COMPILE([#include <sys/types.h> #include <sys/socket.h> #include <net/if.h> #ifdef HAVE_NET_IF_VAR_H #include <net/if_var.h> #endif],[struct ifnet in; in.if_link;], iflink=yes, iflink=no) test "x$iflink" = "xyes" && AC_DEFINE([HAVE_IFNET_IF_LINK], 1, [Define if you have a if_link member in struct ifnet]) AC_MSG_RESULT([$iflink]) fi AC_DEFINE([USE_KVM], 1, [Define if you want to use kvm to get stats]) AC_MSG_WARN([you might need to make ifstat SGID kmem to run as simple user]) local=yes fifi# checking for hp dlpi interfacetest "x$with_dlpi" = "xauto" -a "x$local" = "xyes" && with_dlpi=noif test "x$with_dlpi" != "xno"; then AC_CHECK_HEADERS(sys/dlpi.h sys/dlpi_ext.h stropts.h sys/mib.h) AC_MSG_CHECKING([for dlpi streams interface]) AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H #include <unistd.h> #endif #ifdef HAVE_SYS_DLPI_H #include <sys/dlpi.h> #endif #ifdef HAVE_SYS_DLPI_EXT_H #include <sys/dlpi_ext.h> #endif #ifdef HAVE_STROPTS_H #include <sys/stropts.h> #endif #ifdef HAVE_SYS_MIB_H #include <sys/mib.h> #endif], [mib_ifEntry mib; dl_hp_ppa_req_t req; struct strbuf ctlptr; putmsg(0, &ctlptr, NULL, 0);], with_dlpi=yes, with_dlpi=no) AC_MSG_RESULT([$with_dlpi]) if test "x$with_dlpi" = "xyes"; then AC_DEFINE([USE_DLPI], 1, [Define if you want to use dlpi to get stats]) local=yes fifitest "x$with_win32" = "xauto" -a "x$local" = "xyes" && with_win32=noif test "x$with_win32" != "xno"; then AC_MSG_CHECKING([for win32 GetIfTable interface]) OLIBS="$LIBS" LIBS="$LIBS -liphlpapi" AC_TRY_LINK([#include <windows.h> #include <iphlpapi.h>], [GetIfTable(NULL, NULL, 0);], [with_win32=yes], [with_win32=no; LIBS="$OLIBS"]) AC_MSG_RESULT([$with_win32]) if test "x$with_win32" = "xyes"; then AC_DEFINE([USE_WIN32], 1, [Define if you want to use win32 to get stats]) local=yes fifi # checking for ioctl (siocgifconf) to get interfacestest "x$with_ioctl" = "xauto" -a "x$local" = "xyes" && with_ioctl=noif test "x$with_ioctl" != "xno"; then AC_DEFINE([USE_IOCTL], 1, [Define if you want to use ioctls to get if list]) AC_CHECK_FUNC(socket, checksocket=no, checksocket=yes) if test "x$checksocket" = "xyes"; then case "x$LIBS" in *-lsocket*);; *) AC_CHECK_LIB(socket, socket) ;; esac fi AC_CHECK_FUNC(if_nameindex, ifnameindex=yes, ifnameindex=no) if test "x$ifnameindex" != "xyes"; then case "x$LIBS" in *-lnsl*);; *) AC_CHECK_LIB(nsl, if_nameindex, [ifnameindex=yes; LIBS="$LIBS -lnsl"]) ;; esac fi if test "x$ifnameindex" != "xyes"; then AC_MSG_CHECKING([for sockaddr sa_len member]) AC_TRY_COMPILE([ #include <sys/types.h> #include <sys/socket.h>],[struct sockaddr sa; sa.sa_len = 1;], salen=yes, salen=no) test "x$salen" = "xyes" && AC_DEFINE([HAVE_SOCKADDR_SA_LEN], 1, [Define if you have a sa_len member in struct sockaddr]) AC_MSG_RESULT([$salen]) else AC_DEFINE([USE_IFNAMEINDEX], 1, [Define if you want ot use if_nameindex to find interfaces]) fifi# checking for snmp (NET-SNMP/UCD-SNMP)if test "x$with_snmp" != "xno" ; then OCPPFLAGS="$CPPFLAGS" OLDFLAGS="$LDFLAGS" snmp_ok=no AC_PATH_PROG(netsnmpconfig, [net-snmp-config], [no], $PATH:$with_snmp) if test "x$netsnmpconfig" != "xno"; then CPPFLAGS="$CPPFLAGS `$netsnmpconfig --base-cflags 2>/dev/null`" LDFLAGS="$LDFLAGS `$netsnmpconfig --libs 2>/dev/null`" AC_MSG_CHECKING([whether net-snmp-config hints compiles and links fine]) AC_TRY_LINK([#include<net-snmp/net-snmp-config.h>], [snmp_sess_init((void *) 0);], [snmp_ok=yes], [snmp_ok=no]) AC_MSG_RESULT([$snmp_ok]) if test "x$snmp_ok" = "xyes"; then with_snmp=yes snmp_type=net else CPPFLAGS="$OCPPFLAGS" LDFLAGS="$OLDFLAGS" fi fi if test "x$snmp_ok" != "xyes"; then if test "x$with_snmp" != "xyes" ; then CPPFLAGS="$CPPFLAGS -I$with_snmp/include" LDFLAGS="$LDFLAGS -L$with_snmp/lib" fi AC_CHECK_HEADER(net-snmp/net-snmp-config.h, snmp_type=net, [AC_CHECK_HEADER(ucd-snmp/ucd-snmp-config.h, snmp_type=ucd, with_snmp=no)]) if test "x$with_snmp" != "xno"; then if test "x$snmp_type" = "xnet"; then libsnmp="-lnetsnmp" else libsnmp="-lsnmp" fi with_snmp=no SNMPLIBALONE="$libsnmp" # Setting to be able to force linking with -lcrypto.... # This is needed on OpenBSD (at least) where the snmplib port links without -lcrypto, # but fails to run. AC_ARG_WITH(libcrypto, [ --with-libcrypto force link with -lcrypto for UCD-SNMP (default=no)], [], [with_libcrypto=no]) if test "x$with_libcrypto" = "xyes" ; then SNMPLIBALONE="" fi for lib in $SNMPLIBALONE "$libsnmp -lcrypto" ; do if test "x$with_snmp" != "xyes" ; then AC_MSG_CHECKING([for snmp support in $lib]) OLIBS="$LIBS" LIBS="$LIBS $lib" AC_TRY_LINK([], [snmp_sess_init();], [with_snmp=yes], [LIBS="$OLIBS"]) AC_MSG_RESULT([$with_snmp]) fi done fi fi if test "x$with_snmp" = "xyes" ; then AC_DEFINE([USE_SNMP], 1, [Define if you have SNMP support]) if test "x$snmp_type" = "xnet"; then AC_DEFINE([HAVE_NET_SNMP], 1, [Define if your SNMP implementation is net-snmp v5.0 or greater]) fi SNMPSRC=snmp.c AC_SUBST(SNMPSRC) # hint users about the possible needed option case `uname -s` in *OpenBSD*) case "$LIBS" in *-lcrypto*) ;; *) AC_MSG_WARN([SNMP test linked fine, but you might need to use --with-libcrypto for SNMP to work on this OS.]);; esac ;; esac else CPPFLAGS="$OCPPFLAGS" LDFLAGS="$OLDFLAGS" fifi# checking that we do have at least one driverif test "x$local" != "xyes"; then if test "x$with_snmp" = "xyes"; then AC_MSG_WARN([no native stats gathering mechanism found; will use SNMP.]) else AC_MSG_ERROR([no statistics gathering methods found, porting needed.]) fifi# check for libraryAC_ARG_ENABLE(library, [ --enable-library enable build and installation of libifstat (default=no)], LIBTARGET=libifstat.a, )dnl VersionVERSION="`cat VERSION`"test -z $VERSION && VERSION="0.0"# perl -MPOSIX -e 'print strftime("%Y%m%d", localtime((stat("CVS"))[9]));'test -d CVS && VERSION="$VERSION-cvs"`date +%Y%m%d`AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version])dnl OutputAC_SUBST(VERSION)AC_SUBST(CFLAGS)AC_SUBST(CPPFLAGS)AC_SUBST(LDFLAGS)AC_SUBST(LIBTARGET)AC_OUTPUT(Makefile)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -