Try linking hstrerror and inet_aton tests. Look for these functions in -lresolv.
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 705976d..a5adca1 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -252,6 +252,9 @@
 /* Define to 1 if you have the <libintl.h> header file. */
 #undef HAVE_LIBINTL_H
 
+/* Define to 1 if you have the `resolv' library (-lresolv). */
+#undef HAVE_LIBRESOLV
+
 /* Define to 1 if you have the <libutil.h> header file. */
 #undef HAVE_LIBUTIL_H