diff --git a/configure b/configure
index 87e53becbca9252898aeccc23d99353273b71cac..b96b12e6ba8bc96e389d64f2b4c4dffc5e6b65c1 100755
--- a/configure
+++ b/configure
@@ -11634,7 +11634,10 @@ else
   cat >conftest.$ac_ext <<_ACEOF
 #line $LINENO "configure"
 #include "confdefs.h"
-#if HAVE_SYS_SOCKET_H
+#if HAVE_SYS_TYPES_H
+     # include <sys/types.h>
+     #endif
+     #if HAVE_SYS_SOCKET_H
      # include <sys/socket.h>
      #endif
 
diff --git a/configure.ac b/configure.ac
index 91d35057cdedede425a748b2a44b8715760fb7a2..8c2a857bf1f6a51f74bb98a625407d7f72d941c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -974,7 +974,10 @@ AC_HEADER_STAT()
 
 dnl *** Check for net/if.h
 AC_CHECK_HEADERS(net/if.h,,,
-    [#if HAVE_SYS_SOCKET_H
+    [#if HAVE_SYS_TYPES_H
+     # include <sys/types.h>
+     #endif
+     #if HAVE_SYS_SOCKET_H
      # include <sys/socket.h>
      #endif])