Added missing configuration #if:s and #includes:s.

diff --git a/dlls/winmm/joystick.c b/dlls/winmm/joystick.c
index e9df190..e863412 100644
--- a/dlls/winmm/joystick.c
+++ b/dlls/winmm/joystick.c
@@ -13,6 +13,8 @@
  * routines for backward compatibility.
  */
 
+#include "config.h"
+
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/dlls/winmm/wineoss/audio.c b/dlls/winmm/wineoss/audio.c
index 1e87b16..9746cd5 100644
--- a/dlls/winmm/wineoss/audio.c
+++ b/dlls/winmm/wineoss/audio.c
@@ -13,6 +13,8 @@
 
 /*#define EMULATE_SB16*/
 
+#include "config.h"
+
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
diff --git a/dlls/winmm/wineoss/midi.c b/dlls/winmm/wineoss/midi.c
index dd8275b..0782252 100644
--- a/dlls/winmm/wineoss/midi.c
+++ b/dlls/winmm/wineoss/midi.c
@@ -12,6 +12,8 @@
  * 		98/11 	splitted in midi.c and mcimidi.c
  */
 
+#include "config.h"
+
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
diff --git a/dlls/winmm/wineoss/mixer.c b/dlls/winmm/wineoss/mixer.c
index efeea66..64083b8 100644
--- a/dlls/winmm/wineoss/mixer.c
+++ b/dlls/winmm/wineoss/mixer.c
@@ -7,6 +7,8 @@
  * 		1999 Eric Pouech
  */
 
+#include "config.h"
+
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
diff --git a/dlls/winmm/wineoss/mmaux.c b/dlls/winmm/wineoss/mmaux.c
index abe7bd5..718c4c5 100644
--- a/dlls/winmm/wineoss/mmaux.c
+++ b/dlls/winmm/wineoss/mmaux.c
@@ -7,6 +7,8 @@
 
 #define EMULATE_SB16
 
+#include "config.h"
+
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
diff --git a/misc/port.c b/misc/port.c
index fb07e0e..934d0f8 100644
--- a/misc/port.c
+++ b/misc/port.c
@@ -74,7 +74,9 @@
 #if !defined(HAVE_CLONE) && defined(__linux__)
 #include <assert.h>
 #include <errno.h>
-#include <syscall.h>
+#ifdef HAVE_SYSCALL_H
+# include <syscall.h>
+#endif
 int clone( int (*fn)(void *), void *stack, int flags, void *arg )
 {
 #ifdef __i386__
diff --git a/misc/winsock.c b/misc/winsock.c
index 8818940..8d7d881 100644
--- a/misc/winsock.c
+++ b/misc/winsock.c
@@ -14,14 +14,18 @@
 
 #include <string.h>
 #include <sys/types.h>
-#include <sys/ipc.h>
+#ifdef HAVE_SYS_IPC_H
+# include <sys/ipc.h>
+#endif
 #include <sys/ioctl.h>
 #ifdef HAVE_SYS_FILIO_H
 # include <sys/filio.h>
 #endif
 #if defined(__svr4__) || defined(__sun)
 #include <sys/ioccom.h>
-#include <sys/sockio.h>
+#ifdef HAVE_SYS_SOCKIO_H
+# include <sys/sockio.h>
+#endif
 #endif
 
 #if defined(__EMX__)
@@ -32,12 +36,24 @@
 # include <sys/param.h>
 #endif
 
-#include <sys/msg.h>
-#include <sys/wait.h>
+#ifdef HAVE_SYS_MSG_H
+# include <sys/msg.h>
+#endif
+#ifdef HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <arpa/inet.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+#ifdef HAVE_NETINET_TCP_H
+# include <netinet/tcp.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+#endif
 #include <ctype.h>
 #include <fcntl.h>
 #include <errno.h>
diff --git a/misc/winsock_async.c b/misc/winsock_async.c
index f18e21b..17852ae 100644
--- a/misc/winsock_async.c
+++ b/misc/winsock_async.c
@@ -23,14 +23,18 @@
 
 #include <string.h>
 #include <sys/types.h>
-#include <sys/ipc.h>
+#ifdef HAVE_SYS_IPC_H
+# include <sys/ipc.h>
+#endif
 #include <sys/ioctl.h>
 #ifdef HAVE_SYS_FILIO_H
 # include <sys/filio.h>
 #endif
 #if defined(__svr4__)
 #include <sys/ioccom.h>
-#include <sys/sockio.h>
+#ifdef HAVE_SYS_SOCKIO_H
+# include <sys/sockio.h>
+#endif
 #endif
 
 #if defined(__EMX__)
@@ -41,15 +45,27 @@
 # include <sys/param.h>
 #endif
 
-#include <sys/msg.h>
+#ifdef HAVE_SYS_MSG_H
+# include <sys/msg.h>
+#endif
+#ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+#endif
 #include <ctype.h>
 #include <fcntl.h>
 #include <errno.h>
+#ifdef HAVE_SYS_ERRNO_H
 #include <sys/errno.h>
+#endif
 #include <netdb.h>
 #include <unistd.h>
 #include <stdlib.h>