iphlpapi: fix compile on DragonFlyBSD

Austin English austinenglish at gmail.com
Fri Jul 1 15:49:39 CDT 2011


Partially fixes http://bugs.winehq.org/show_bug.cgi?id=18160 (fixes compile
on DragonFlyBSD 2.10-RELEASE, and still works on FreeBSD 8.2-RELEASE).

NetBSD is currently more broken by
http://bugs.winehq.org/show_bug.cgi?id=20907 though.

-- 
-Austin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20110701/10d902e7/attachment.htm>
-------------- next part --------------
diff --git a/configure.ac b/configure.ac
index b50d5ed..2abf2a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2312,6 +2312,204 @@ AC_CHECK_MEMBERS([struct ifreq.ifr_hwaddr],,,
 # include <net/if.h>
 #endif])
 
+dnl Check for struct ip_stats.ips_delivered
+AC_CHECK_MEMBERS([struct ip_stats.ips_delivered],,,
+[#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_ALIAS_H
+#include <alias.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SYS_SOCKETVAR_H
+#include <sys/socketvar.h>
+#endif
+#ifdef HAVE_SYS_TIMEOUT_H
+#include <sys/timeout.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#ifdef HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#ifdef HAVE_NETINET_IP_VAR_H
+# include <netinet/ip_var.h>
+#endif])
+
+dnl Check for struct ipstat.ips_delivered
+AC_CHECK_MEMBERS([struct ipstat.ips_delivered],,,
+[#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_ALIAS_H
+#include <alias.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SYS_SOCKETVAR_H
+#include <sys/socketvar.h>
+#endif
+#ifdef HAVE_SYS_TIMEOUT_H
+#include <sys/timeout.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#ifdef HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#ifdef HAVE_NETINET_IP_VAR_H
+# include <netinet/ip_var.h>
+#endif])
+
+dnl Check for struct tcp_stats.tcps_connattempt
+AC_CHECK_MEMBERS([struct tcp_stats.tcps_connattempt],,,
+[#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_ALIAS_H
+#include <alias.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SYS_SOCKETVAR_H
+#include <sys/socketvar.h>
+#endif
+#ifdef HAVE_SYS_TIMEOUT_H
+#include <sys/timeout.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#ifdef HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#ifdef HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+#ifdef HAVE_NETINET_TCP_VAR_H
+# include <netinet/tcp_var.h>
+#endif])
+
+dnl Check for struct tcpstat.tcps_connattempt
+AC_CHECK_MEMBERS([struct tcpstat.tcps_connattempt],,,
+[#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_ALIAS_H
+#include <alias.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SYS_SOCKETVAR_H
+#include <sys/socketvar.h>
+#endif
+#ifdef HAVE_SYS_TIMEOUT_H
+#include <sys/timeout.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#ifdef HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#ifdef HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+#ifdef HAVE_NETINET_TCP_VAR_H
+# include <netinet/tcp_var.h>
+#endif])
+
+dnl Check for struct udp_stats.udps_ipackets
+AC_CHECK_MEMBERS([struct udp_stats.udps_ipackets],,,
+[#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_ALIAS_H
+#include <alias.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SYS_SOCKETVAR_H
+#include <sys/socketvar.h>
+#endif
+#ifdef HAVE_SYS_TIMEOUT_H
+#include <sys/timeout.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#ifdef HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#ifdef HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+#ifdef HAVE_NETINET_UDP_H
+# include <netinet/udp.h>
+#endif
+#ifdef HAVE_NETINET_UDP_VAR_H
+# include <netinet/udp_var.h>
+#endif])
+
+dnl Check for struct udpstat.udps_ipackets
+AC_CHECK_MEMBERS([struct udpstat.udps_ipackets],,,
+[#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_ALIAS_H
+#include <alias.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SYS_SOCKETVAR_H
+#include <sys/socketvar.h>
+#endif
+#ifdef HAVE_SYS_TIMEOUT_H
+#include <sys/timeout.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#ifdef HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#ifdef HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+#ifdef HAVE_NETINET_UDP_H
+# include <netinet/udp.h>
+#endif
+#ifdef HAVE_NETINET_UDP_VAR_H
+# include <netinet/udp_var.h>
+#endif])
+
 dnl Check for the external timezone variables timezone and daylight
 AC_CACHE_CHECK([for timezone variable], ac_cv_have_timezone,
                AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[timezone = 1]])],[ac_cv_have_timezone="yes"],[ac_cv_have_timezone="no"]))
diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c
index 8847e09..204966c 100644
--- a/dlls/iphlpapi/ipstats.c
+++ b/dlls/iphlpapi/ipstats.c
@@ -660,7 +660,13 @@ DWORD WINAPI GetIpStatistics(PMIB_IPSTATS stats)
         int mib[] = {CTL_NET, PF_INET, IPPROTO_IP, IPCTL_STATS};
 #define MIB_LEN (sizeof(mib) / sizeof(mib[0]))
         int ip_ttl, ip_forwarding;
+#if defined(HAVE_STRUCT_IPSTAT_IPS_DELIVERED)
         struct ipstat ip_stat;
+#elif defined(HAVE_STRUCT_IP_STATS_IPS_DELIVERED)
+        struct ip_stats ip_stat;
+#else
+#error "ip_stat structure isn't defined!"
+#endif
         size_t needed;
 
         needed = sizeof(ip_stat);
@@ -813,7 +819,14 @@ DWORD WINAPI GetTcpStatistics(PMIB_TCPSTATS stats)
         int mib[] = {CTL_NET, PF_INET, IPPROTO_TCP, TCPCTL_STATS};
 #define MIB_LEN (sizeof(mib) / sizeof(mib[0]))
 #define hz 1000
+
+#if defined(HAVE_STRUCT_TCPSTAT_TCPS_CONNATTEMPT)
         struct tcpstat tcp_stat;
+#elif defined(HAVE_STRUCT_TCP_STATS_TCPS_CONNATTEMPT)
+        struct tcp_stats tcp_stat;
+#else
+#error "tcp_stat structure isn't defined!"
+#endif
         size_t needed = sizeof(tcp_stat);
 
         if(sysctl(mib, MIB_LEN, &tcp_stat, &needed, NULL, 0) != -1)
@@ -919,7 +932,14 @@ DWORD WINAPI GetUdpStatistics(PMIB_UDPSTATS stats)
     {
         int mib[] = {CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_STATS};
 #define MIB_LEN (sizeof(mib) / sizeof(mib[0]))
+
+#if defined(HAVE_STRUCT_UDPSTAT_UDPS_IPACKETS)
         struct udpstat udp_stat;
+#elif defined(HAVE_STRUCT_UDP_STATS_UDPS_IPACKETS)
+        struct udp_stats udp_stat;
+#else
+#error "udp_stat structure isn't defined!"
+#endif
         MIB_UDPTABLE *udp_table;
         size_t needed = sizeof(udp_stat);
 


More information about the wine-patches mailing list