diff --git a/gio/ginetaddress.c b/gio/ginetaddress.c
index d33382a..8473fed 100644
--- a/gio/ginetaddress.c
+++ b/gio/ginetaddress.c
@@ -22,6 +22,7 @@
  */
 
 #include <config.h>
+#include <string.h>
 #include <glib.h>
 
 #include "ginetaddress.h"
@@ -530,7 +531,7 @@ g_inet_address_get_is_any (GInetAddress *address)
       return addr4 == INADDR_ANY;
     }
   else
-    return IN6_IS_ADDR_UNSPECIFIED (&address->priv->addr.ipv6.s6_addr);
+    return IN6_IS_ADDR_UNSPECIFIED ((struct in6_addr *)&address->priv->addr.ipv6.s6_addr);
 }
 
 /**
@@ -556,7 +557,7 @@ g_inet_address_get_is_loopback (GInetAddress *address)
       return ((addr4 & 0xff000000) == 0x7f000000);
     }
   else
-    return IN6_IS_ADDR_LOOPBACK (&address->priv->addr.ipv6.s6_addr);
+    return IN6_IS_ADDR_LOOPBACK ((struct in6_addr *)&address->priv->addr.ipv6.s6_addr);
 }
 
 /**
@@ -584,7 +585,7 @@ g_inet_address_get_is_link_local (GInetAddress *address)
       return ((addr4 & 0xffff0000) == 0xa9fe0000);
     }
   else
-    return IN6_IS_ADDR_LINKLOCAL (&address->priv->addr.ipv6.s6_addr);
+    return IN6_IS_ADDR_LINKLOCAL ((struct in6_addr *)&address->priv->addr.ipv6.s6_addr);
 }
 
 /**
@@ -615,7 +616,7 @@ g_inet_address_get_is_site_local (GInetAddress *address)
 	      (addr4 & 0xffff0000) == 0xc0a80000);
     }
   else
-    return IN6_IS_ADDR_SITELOCAL (&address->priv->addr.ipv6.s6_addr);
+    return IN6_IS_ADDR_SITELOCAL ((struct in6_addr *)&address->priv->addr.ipv6.s6_addr);
 }
 
 /**
@@ -640,7 +641,7 @@ g_inet_address_get_is_multicast (GInetAddress *address)
       return IN_MULTICAST (addr4);
     }
   else
-    return IN6_IS_ADDR_MULTICAST (&address->priv->addr.ipv6.s6_addr);
+    return IN6_IS_ADDR_MULTICAST ((struct in6_addr *)&address->priv->addr.ipv6.s6_addr);
 }
 
 /**
@@ -661,7 +662,7 @@ g_inet_address_get_is_mc_global (GInetAddress *address)
   if (address->priv->family == AF_INET)
     return FALSE;
   else
-    return IN6_IS_ADDR_MC_GLOBAL (&address->priv->addr.ipv6.s6_addr);
+    return IN6_IS_ADDR_MC_GLOBAL ((struct in6_addr *)&address->priv->addr.ipv6.s6_addr);
 }
 
 /**
@@ -682,7 +683,7 @@ g_inet_address_get_is_mc_link_local (GInetAddress *address)
   if (address->priv->family == AF_INET)
     return FALSE;
   else
-    return IN6_IS_ADDR_MC_LINKLOCAL (&address->priv->addr.ipv6.s6_addr);
+    return IN6_IS_ADDR_MC_LINKLOCAL ((struct in6_addr *)&address->priv->addr.ipv6.s6_addr);
 }
 
 /**
@@ -703,7 +704,7 @@ g_inet_address_get_is_mc_node_local (GInetAddress *address)
   if (address->priv->family == AF_INET)
     return FALSE;
   else
-    return IN6_IS_ADDR_MC_NODELOCAL (&address->priv->addr.ipv6.s6_addr);
+    return IN6_IS_ADDR_MC_NODELOCAL ((struct in6_addr *)&address->priv->addr.ipv6.s6_addr);
 }
 
 /**
@@ -724,7 +725,7 @@ g_inet_address_get_is_mc_org_local  (GInetAddress *address)
   if (address->priv->family == AF_INET)
     return FALSE;
   else
-    return IN6_IS_ADDR_MC_ORGLOCAL (&address->priv->addr.ipv6.s6_addr);
+    return IN6_IS_ADDR_MC_ORGLOCAL ((struct in6_addr *)&address->priv->addr.ipv6.s6_addr);
 }
 
 /**
@@ -745,7 +746,7 @@ g_inet_address_get_is_mc_site_local (GInetAddress *address)
   if (address->priv->family == AF_INET)
     return FALSE;
   else
-    return IN6_IS_ADDR_MC_SITELOCAL (&address->priv->addr.ipv6.s6_addr);
+    return IN6_IS_ADDR_MC_SITELOCAL ((struct in6_addr *)&address->priv->addr.ipv6.s6_addr);
 }
 
 #define __G_INET_ADDRESS_C__
diff --git a/gio/gnetworkingprivate.h b/gio/gnetworkingprivate.h
index c41f598..ee4349b 100644
--- a/gio/gnetworkingprivate.h
+++ b/gio/gnetworkingprivate.h
@@ -48,6 +48,10 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 
+#ifndef T_SRV
+#define T_SRV	33
+#endif
+
 #endif
 
 G_BEGIN_DECLS
diff --git a/gio/gunixresolver.c b/gio/gunixresolver.c
index 36bb046..fd4bc02 100644
--- a/gio/gunixresolver.c
+++ b/gio/gunixresolver.c
@@ -24,6 +24,8 @@
 #include <glib.h>
 #include "glibintl.h"
 
+#include <netinet/in.h>
+#include <arpa/nameser.h>
 #include <resolv.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/gio/libasyncns/asyncns.c b/gio/libasyncns/asyncns.c
index 3c4db73..2d93b8c 100644
--- a/gio/libasyncns/asyncns.c
+++ b/gio/libasyncns/asyncns.c
@@ -22,7 +22,7 @@
 #include "g-asyncns.h"
 #endif
 
-/* #undef HAVE_PTHREAD */
+#define HAVE_PTHREAD
 
 #include <assert.h>
 #include <fcntl.h>
@@ -41,18 +41,16 @@
 #include <resolv.h>
 #include <dirent.h>
 
-#if HAVE_ARPA_NAMESER_COMPAT_H
-#include <arpa/nameser_compat.h>
-#endif
-
 #ifdef HAVE_SYS_PRCTL_H
 #include <sys/prctl.h>
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 #include <pthread.h>
 #endif
 
+#include <sys/time.h>
+
 #include "asyncns.h"
 
 #ifndef MSG_NOSIGNAL
