From ab2881a412beaf5693e288117e802ef18d5dc129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Dejean?= Date: Mon, 9 Aug 2004 08:02:54 +0000 Subject: [PATCH] Added HAVE_IFADDRS_H Disable IPv6 support is ifaddrs.h is not available. * configure.in: Added HAVE_IFADDRS_H * sysdeps/linux/netload.c: (glibtop_get_netload_s): Disable IPv6 support is ifaddrs.h is not available. Closes #149376. --- ChangeLog | 8 ++++++++ configure.in | 5 +++++ sysdeps/linux/netload.c | 9 +++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 96405596..b7378c7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-08-09 Benoît Dejean + + * configure.in: Added HAVE_IFADDRS_H + * sysdeps/linux/netload.c: (glibtop_get_netload_s): Disable IPv6 + support is ifaddrs.h is not available. + + Closes #149376. + 2004-08-09 Benoît Dejean * configure.in: Added -gnu89 to CFLAGS. diff --git a/configure.in b/configure.in index 9f0c0e55..e269b676 100644 --- a/configure.in +++ b/configure.in @@ -148,6 +148,11 @@ else AC_MSG_ERROR([libgtop requires the popt development libraries]) fi +AC_CHECK_HEADER(ifaddrs.h, [HAVE_IFADDRS_H=yes], [HAVE_IFADDRS_H=no]) +if test x$HAVE_IFADDRS_H = xyes ; then + AC_DEFINE(HAVE_IFADDRS_H, 1, [defined if you have ifaddrs.h]) +fi + dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE diff --git a/sysdeps/linux/netload.c b/sysdeps/linux/netload.c index 9e19b279..06ec3f2c 100644 --- a/sysdeps/linux/netload.c +++ b/sysdeps/linux/netload.c @@ -47,7 +47,9 @@ #include #endif -/* IPV6 */ + +#ifdef HAVE_IFADDRS_H +/* needed for IPV6 support */ #include @@ -56,7 +58,8 @@ (((((__const uint8_t *) (a))[0] & 0xff) == 0x3f \ || (((__const uint8_t *) (a))[0] & 0xff) == 0x20)) #endif -/* IPV6 */ +#endif /* HAVE_IFADDRS_H */ + #define _GLIBTOP_IP_FW_ACCTIN 0x1000 /* Account incoming packets only. */ #define _GLIBTOP_IP_FW_ACCTOUT 0x2000 /* Account outgoing packets only. */ @@ -374,6 +377,7 @@ glibtop_get_netload_s (glibtop *server, glibtop_netload *buf, fclose (f); +#ifdef HAVE_IFADDRS_H /* IPv6 */ { struct ifaddrs *ifa0, *ifr6; @@ -421,4 +425,5 @@ glibtop_get_netload_s (glibtop *server, glibtop_netload *buf, free_ipv6: freeifaddrs(ifa0); } /* IPV6 */ +#endif /* HAVE_IFADDRS_H */ }