Fix the #include order for config.h.
Add #include "config.h" directives where needed.

diff --git a/dlls/ddraw/mesa.c b/dlls/ddraw/mesa.c
index c8be600..e18430d 100644
--- a/dlls/ddraw/mesa.c
+++ b/dlls/ddraw/mesa.c
@@ -3,6 +3,8 @@
    
    This file contains all MESA common code */
 
+#include "config.h"
+
 #include "windef.h"
 #include "wine/obj_base.h"
 #include "ddraw.h"
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c
index 7bf6582..f155013 100644
--- a/dlls/dplayx/dplay.c
+++ b/dlls/dplayx/dplay.c
@@ -6,6 +6,7 @@
  *
  */
 
+#include "config.h"
 #include "wine/port.h"
 
 #include <string.h>
diff --git a/dlls/kernel/comm.c b/dlls/kernel/comm.c
index 3eab1fd..4823cd3 100644
--- a/dlls/kernel/comm.c
+++ b/dlls/kernel/comm.c
@@ -32,6 +32,7 @@
  * 
  */
 
+#include "config.h"
 #include "wine/port.h"
 
 #include <stdlib.h>
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h
index 70ff5f5..3115597 100644
--- a/dlls/msvcrt/msvcrt.h
+++ b/dlls/msvcrt/msvcrt.h
@@ -1,15 +1,15 @@
 #ifndef __WINE_MSVCRT_H
 #define __WINE_MSVCRT_H
 
-#include "config.h"
+#include <stdarg.h>
+#include <ctype.h>
+#include <string.h>
+
 #include "windef.h"
 #include "debugtools.h"
 #include "winbase.h"
 #include "winerror.h"
 #include "winnls.h"
-#include <stdarg.h>
-#include <ctype.h>
-#include <string.h>
 
 /* TLS data */
 extern DWORD MSVCRT_tls_index;
diff --git a/dlls/ntdll/misc.c b/dlls/ntdll/misc.c
index 3610ed9..9154fd5 100644
--- a/dlls/ntdll/misc.c
+++ b/dlls/ntdll/misc.c
@@ -1,11 +1,12 @@
 /*
  * Helper functions for ntdll
  */
-#include <time.h>
-#include <math.h>
 
 #include "config.h"
 
+#include <time.h>
+#include <math.h>
+
 #include "debugtools.h"
 #include "ntdll_misc.h"
 
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 83a8287..93166d6 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -9,6 +9,7 @@
  *
  */
 
+#include "config.h"
 #include "wine/port.h"
 
 #include <stdio.h>
diff --git a/dlls/ttydrv/bitmap.c b/dlls/ttydrv/bitmap.c
index e3ece64..9a09d5f 100644
--- a/dlls/ttydrv/bitmap.c
+++ b/dlls/ttydrv/bitmap.c
@@ -4,7 +4,10 @@
  * Copyright 1999 Patrik Stridvall
  */
 
+#include "config.h"
+
 #include <string.h>
+
 #include "bitmap.h"
 #include "gdi.h"
 #include "ttydrv.h"
diff --git a/dlls/ttydrv/objects.c b/dlls/ttydrv/objects.c
index 1c27ae6..0165b54 100644
--- a/dlls/ttydrv/objects.c
+++ b/dlls/ttydrv/objects.c
@@ -4,6 +4,8 @@
  * Copyright 1999 Patrik Stridvall
  */
 
+#include "config.h"
+
 #include "bitmap.h"
 #include "gdi.h"
 #include "ttydrv.h"
diff --git a/dlls/ttydrv/palette.c b/dlls/ttydrv/palette.c
index 0ec9006..c727eb8 100644
--- a/dlls/ttydrv/palette.c
+++ b/dlls/ttydrv/palette.c
@@ -4,6 +4,8 @@
  * Copyright 1999 Patrik Stridvall
  */
 
+#include "config.h"
+
 #include <stdlib.h>
 
 #include "color.h"
diff --git a/dlls/ttydrv/ttydrv.h b/dlls/ttydrv/ttydrv.h
index 6d0cae7..7190142 100644
--- a/dlls/ttydrv/ttydrv.h
+++ b/dlls/ttydrv/ttydrv.h
@@ -5,7 +5,9 @@
 #ifndef __WINE_TTYDRV_H
 #define __WINE_TTYDRV_H
 
-#include "config.h"
+#ifndef __WINE_CONFIG_H 
+# error You must include config.h to use this header 
+#endif 
 
 #undef ERR
 #ifdef HAVE_NCURSES_H
diff --git a/dlls/ttydrv/user.c b/dlls/ttydrv/user.c
index 0aeaf7b..38f2f76 100644
--- a/dlls/ttydrv/user.c
+++ b/dlls/ttydrv/user.c
@@ -4,6 +4,8 @@
  * Copyright 1998 Patrik Stridvall
  */
 
+#include "config.h"
+
 #include "dinput.h"
 #include "gdi.h"
 #include "ttydrv.h"
diff --git a/dlls/winmm/wineoss/oss.h b/dlls/winmm/wineoss/oss.h
index a8aab79..f890fc8 100644
--- a/dlls/winmm/wineoss/oss.h
+++ b/dlls/winmm/wineoss/oss.h
@@ -1,6 +1,8 @@
 /* Definition for OSS drivers : wine multimedia system */
 
-#include "config.h"
+#ifndef __WINE_CONFIG_H 
+# error You must include config.h to use this header 
+#endif 
 
 #if defined(HAVE_SYS_SOUNDCARD_H)
 # include <sys/soundcard.h>
diff --git a/dlls/winsock/async.c b/dlls/winsock/async.c
index 75dea38..48b748e 100644
--- a/dlls/winsock/async.c
+++ b/dlls/winsock/async.c
@@ -19,6 +19,7 @@
  *	  whole stuff did not work anyway to other changes).
  */
  
+#include "config.h"
 #include "wine/port.h"
 
 #include <string.h>
diff --git a/dlls/winsock/socket.c b/dlls/winsock/socket.c
index 1c4730a..8547df0 100644
--- a/dlls/winsock/socket.c
+++ b/dlls/winsock/socket.c
@@ -15,6 +15,7 @@
  * ws_XXXXent32 (winsock2.h) and 1-byte forced ws_XXXXent16 (winsock16.h).
  */
  
+#include "config.h"
 #include "wine/port.h"
 
 #include <stdio.h>
diff --git a/dlls/x11drv/dga2.h b/dlls/x11drv/dga2.h
index 5ee1844..226234f 100644
--- a/dlls/x11drv/dga2.h
+++ b/dlls/x11drv/dga2.h
@@ -5,7 +5,11 @@
  */
 #ifndef __WINE_DGA2_H
 #define __WINE_DGA2_H
-#include "config.h"
+
+#ifndef __WINE_CONFIG_H 
+# error You must include config.h to use this header 
+#endif 
+
 #ifdef HAVE_LIBXXF86DGA2
 #include "ddrawi.h"
 
diff --git a/dlls/x11drv/x11ddraw.h b/dlls/x11drv/x11ddraw.h
index 9faf11d..0836f64 100644
--- a/dlls/x11drv/x11ddraw.h
+++ b/dlls/x11drv/x11ddraw.h
@@ -5,7 +5,11 @@
  */
 #ifndef __WINE_X11DDRAW_H
 #define __WINE_X11DDRAW_H
-#include "config.h"
+
+#ifndef __WINE_CONFIG_H 
+# error You must include config.h to use this header 
+#endif 
+
 #include "ddrawi.h"
 
 extern LPDDRAWI_DDRAWSURFACE_LCL X11DRV_DD_Primary;
diff --git a/dlls/x11drv/xvidmode.h b/dlls/x11drv/xvidmode.h
index 992cf3e..5bc8d51 100644
--- a/dlls/x11drv/xvidmode.h
+++ b/dlls/x11drv/xvidmode.h
@@ -5,7 +5,11 @@
  */
 #ifndef __WINE_XVIDMODE_H
 #define __WINE_XVIDMODE_H
-#include "config.h"
+
+#ifndef __WINE_CONFIG_H 
+# error You must include config.h to use this header 
+#endif 
+
 #ifdef HAVE_LIBXXF86VM
 #include "ddrawi.h"