From a20693b4c5274fa40af7378c67c279fc316804c1 Mon Sep 17 00:00:00 2001
From: fbrosson <fbrosson@localhost>
Date: Fri, 25 Mar 2016 10:03:51 +0000
Subject: Search for gethostbyname in libnetwork.


diff --git a/configure.ac b/configure.ac
index 28d098c..969fed2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,9 +34,33 @@ AC_CHECK_FUNC(vasprintf, AC_DEFINE(HAVE_VASPRINTF))
 AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF))
 AC_CHECK_FUNC(vsprintf, AC_DEFINE(HAVE_VSPRINTF))
 
-AC_CHECK_FUNC(gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME),
-	AC_CHECK_LIB(nsl, gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME)
-	LIBS="${LIBS} -lsocket -lnsl"))
+dnl gethostbyname without lib or in the nsl lib?
+AC_CHECK_FUNC(gethostbyname,
+              [HAVE_GETHOSTBYNAME="1"
+              ],
+              [ AC_CHECK_LIB(nsl, gethostbyname,
+                             [HAVE_GETHOSTBYNAME="1"
+                             LIBS="-lnsl $LIBS"
+                             ])
+              ])
+
+if test "$HAVE_GETHOSTBYNAME" != "1"
+then
+  dnl gethostbyname in the socket lib?
+  AC_CHECK_LIB(socket, gethostbyname,
+               [HAVE_GETHOSTBYNAME="1"
+               LIBS="-lsocket $LIBS"
+               ])
+fi
+
+if test "$HAVE_GETHOSTBYNAME" != "1"
+then
+  dnl gethostbyname in the network lib - for Haiku OS
+  AC_CHECK_LIB(network, gethostbyname,
+               [HAVE_GETHOSTBYNAME="1"
+               LIBS="-lnetwork $LIBS"
+               ])
+fi
 
 AC_CHECK_FUNC(gethostbyname_r, [
 	AC_DEFINE(HAVE_GETHOSTBYNAME_R)
-- 
2.16.1


From 14a2b588782d2883883a448c83d377c2d35f3ee0 Mon Sep 17 00:00:00 2001
From: fbrosson <fbrosson@localhost>
Date: Fri, 21 Oct 2016 23:48:53 +0000
Subject: tiny gcc2 patch for test/test-geoip-invalid-file.c


diff --git a/test/test-geoip-invalid-file.c b/test/test-geoip-invalid-file.c
index 10fe246..6d351eb 100644
--- a/test/test-geoip-invalid-file.c
+++ b/test/test-geoip-invalid-file.c
@@ -9,6 +9,7 @@ int main(void) {
         return 1;
     }
 
+  {
     const char *country = GeoIP_country_code_by_addr(gi, "24.24.24.24");
     if (country != NULL) {
         fprintf(stderr,
@@ -24,6 +25,7 @@ int main(void) {
                 "GeoIP_country_code_by_addr_v6\n");
         return 1;
     }
+  }
 
     return 0;
 }
-- 
2.16.1

