diff --git a/files/smb.c b/files/smb.c
index 2264d35d6f06c0e943d3209108f53d47bf6fc70a..6047210558ad1ccba87b07f9c8584edd8513e0da 100644
--- a/files/smb.c
+++ b/files/smb.c
@@ -53,8 +53,18 @@
 #include <utime.h>
 #include <sys/socket.h>
 #include <sys/types.h>
+#ifdef HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_NETINET_IP_H
 #include <netinet/ip.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
+#endif
 
 #include "winerror.h"
 #include "windef.h"