add autoconf test for new SIOCGIFCONF interface that uses a

ifru_space member to store larger addresses and parse interface list
accordingly.
This commit is contained in:
mlelstv 2011-02-06 14:22:29 +00:00
parent 6257e8a9af
commit 814497ffb6
2 changed files with 83 additions and 2 deletions

View file

@ -1,7 +1,8 @@
# $NetBSD: Makefile,v 1.16 2008/07/14 12:56:10 joerg Exp $
# $NetBSD: Makefile,v 1.17 2011/02/06 14:22:29 mlelstv Exp $
#
DISTNAME= libdnet-1.12
PKGREVISION= 1
CATEGORIES= devel net
MASTER_SITES= http://libdnet.googlecode.com/files/
EXTRACT_SUFX= .tgz
@ -13,11 +14,14 @@ COMMENT= C interface to several low-level networking routines
PKG_DESTDIR_SUPPORT= user-destdir
GNU_CONFIGURE= yes
USE_TOOLS+= gmake
USE_TOOLS+= autoconf gmake
USE_LIBTOOL= yes
BUILD_DEFS+= IPV6_READY
pre-configure:
cd ${WRKSRC} && autoconf -f
PKG_OPTIONS_VAR= PKG_OPTIONS.libdnet
PKG_SUPPORTED_OPTIONS= libdnetcheck
.include "../../mk/bsd.options.mk"

View file

@ -0,0 +1,77 @@
--- configure.in.orig 2011-02-06 14:20:17.000000000 +0100
+++ configure.in 2011-02-06 14:20:51.000000000 +0100
@@ -186,6 +186,9 @@
if test "$ac_cv_header_sys_socket_h" = yes ; then
AC_DNET_SOCKADDR_SA_LEN
fi
+if test "$ac_cv_header_net_if_h" = yes ; then
+ AC_DNET_IFREQ_IFR_SPACE
+fi
if test "$ac_cv_header_net_if_arp_h" = yes ; then
AC_DNET_ARPREQ_ARP_DEV
fi
--- aclocal.m4.orig 2011-02-06 14:02:01.000000000 +0100
+++ aclocal.m4 2011-02-06 14:08:47.000000000 +0100
@@ -6776,6 +6776,30 @@
fi])
dnl
+dnl Check for NetBSD ifreq structure
+dnl
+dnl usage: AC_DNET_IFREQ_IFR_SPACE
+dnl results: HAVE_IFREQ_IFR_SPACE (defined)
+dnl
+AC_DEFUN(AC_DNET_IFREQ_IFR_SPACE,
+ [AC_MSG_CHECKING(for ifr_space in ifreq struct)
+ AC_CACHE_VAL(ac_cv_dnet_ifreq_has_ifr_space,
+ AC_TRY_COMPILE([
+# ifndef _IFREQ_IFR_SPACE
+# define _IFREQ_IFR_SPACE 1
+# endif
+# include <sys/types.h>
+# include <net/if.h>],
+ [u_int i = sizeof(((struct ifreq *)0)->ifr_space)],
+ ac_cv_dnet_ifreq_has_ifr_space=yes,
+ ac_cv_dnet_ifreq_has_ifr_space=no))
+ AC_MSG_RESULT($ac_cv_dnet_ifreq_has_ifr_space)
+ if test $ac_cv_dnet_ifreq_has_ifr_space = yes ; then
+ AC_DEFINE(HAVE_IFREQ_IFR_SPACE, 1,
+ [Define if ifreq struct has ifr_space.])
+ fi])
+
+dnl
dnl Check for sockaddr_in6 struct in <netinet/in.h>
dnl
dnl usage: AC_DNET_SOCKADDR_IN6
--- include/config.h.in.orig 2011-02-06 14:54:20.000000000 +0100
+++ include/config.h.in 2011-02-06 14:55:18.000000000 +0100
@@ -142,6 +142,9 @@
/* Define if sockaddr struct has sa_len. */
#undef HAVE_SOCKADDR_SA_LEN
+/* Define if ifreq struct has ifr_space. */
+#undef HAVE_IFREQ_IFR_SPACE
+
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
--- src/intf.c.orig 2011-02-06 14:08:54.000000000 +0100
+++ src/intf.c 2011-02-06 14:09:57.000000000 +0100
@@ -55,6 +55,9 @@
# define ifr_mtu ifr_metric
#endif
+#ifdef HAVE_IFREQ_IFR_SPACE
+# define NEXTIFR(i) (i + 1)
+#else
#ifdef HAVE_SOCKADDR_SA_LEN
# define NEXTIFR(i) ((struct ifreq *)((u_char *)&i->ifr_addr + \
(i->ifr_addr.sa_len ? i->ifr_addr.sa_len : \
@@ -62,6 +65,7 @@
#else
# define NEXTIFR(i) (i + 1)
#endif
+#endif
/* XXX - superset of ifreq, for portable SIOC{A,D}IFADDR */
struct dnet_ifaliasreq {