diff --git a/configure b/configure
index d5b42345377b5d7ac86224da441c8e5e93488f74..2a6cf3a59066cfd8a47251ee48c6f1e6c1cfe353 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 77875 .
+# From configure.ac Revision: 77878 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61.
 #
@@ -15111,7 +15111,8 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <netdb.h>
+#include <stdlib.h>
+                         #include <netdb.h>
 int
 main ()
 {
@@ -15165,7 +15166,8 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <netdb.h>
+#include <stdlib.h>
+	                 #include <netdb.h>
 int
 main ()
 {
diff --git a/configure.ac b/configure.ac
index cb6bc26b6235e2cd4323447bc7bb2d7640f6d7ec..c4093ff565a0a94df0acf4cb30b1bdf047c6d1c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -288,7 +288,8 @@ AC_SEARCH_LIBS(gethostbyname_r, [socket nsl])
 
 AC_MSG_CHECKING(for gethostbyname_r with 6 arguments)
 AC_LINK_IFELSE(
-        AC_LANG_PROGRAM([#include <netdb.h>],
+        AC_LANG_PROGRAM([#include <stdlib.h>
+                         #include <netdb.h>],
                         [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL);]),
         AC_MSG_RESULT(yes)
         AC_DEFINE([HAVE_GETHOSTBYNAME_R_6], 1, [Define to 1 if your system has gethostbyname_r with 6 arguments.]),
@@ -297,7 +298,8 @@ AC_LINK_IFELSE(
 
 AC_MSG_CHECKING(for gethostbyname_r with 5 arguments)
 AC_LINK_IFELSE(
-        AC_LANG_PROGRAM([#include <netdb.h>],
+        AC_LANG_PROGRAM([#include <stdlib.h>
+	                 #include <netdb.h>],
                         [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL);]),
         AC_MSG_RESULT(yes)
         AC_DEFINE([HAVE_GETHOSTBYNAME_R_5], 1, [Define to 1 if your system has gethostbyname_r with 5 arguments.]),