Index: build-tree/flexdll/reloc.ml
===================================================================
--- build-tree.orig/flexdll/reloc.ml	2011-10-09 04:20:38.879364992 +0200
+++ build-tree/flexdll/reloc.ml	2011-10-09 04:24:47.388623738 +0200
@@ -106,7 +106,7 @@
   | `MINGW -> "-mno-cygwin "
   | _ -> ""
   in
-  Filename.dirname (get_output1 (Printf.sprintf "gcc %s-print-libgcc-file-name" extra))
+  Filename.dirname (get_output1 (Printf.sprintf "i686-w64-mingw32-gcc %s-print-libgcc-file-name" extra))
 
 let file_exists fn =
   if Sys.file_exists fn && not (Sys.is_directory fn) then Some fn
@@ -788,7 +788,7 @@
 	  extra_args
     | `MINGW ->
 	Printf.sprintf
-	  "gcc -mno-cygwin %s%s -L. %s %s -o %s %s %s %s %s"
+	  "i686-w64-mingw32-gcc %s%s -L. %s %s -o %s %s %s %s %s"
 	  (if link_exe = `EXE then "" else "-shared ")
 	  (if main_pgm then "" else if !noentry then "-Wl,-e0 " else "-Wl,-e_FlexDLLiniter@12 ")
 	  (mk_dirs_opt "-I")
@@ -860,9 +860,7 @@
   | `MINGW ->
       search_path :=
 	!dirs @
-	  [ "/lib";
-	    "/lib/mingw";
-	    "/lib/w32api";
+	  [ "/usr/i686-w64-mingw32/sys-root/mingw/lib";
 	    gcclib () ];
       default_libs :=
 	["-lmingw32"; "-lgcc"; "-lmoldname"; "-lmingwex"; "-lmsvcrt";
@@ -891,7 +889,7 @@
 	    file
       | `MINGW ->
 	  Printf.sprintf
-	    "gcc -mno-cygwin -c -o %s %s %s"
+	    "i686-w64-mingw32-gcc -c -o %s %s %s"
 	    (Filename.quote tmp_obj)
 	    (mk_dirs_opt "-I")
 	    file
Index: build-tree/flexdll/Makefile
===================================================================
--- build-tree.orig/flexdll/Makefile	2008-11-10 14:26:25.000000000 +0100
+++ build-tree/flexdll/Makefile	2011-10-09 04:20:38.967364993 +0200
@@ -113,7 +113,7 @@
 upload_bin_64:
 	PACKAGE_BIN_SUFFIX=-amd64 $(MAKE) upload_bin
 
-include $(shell cygpath -ad "$(shell ocamlopt -where)/Makefile.config")
+#include $(shell cygpath -ad "$(shell ocamlopt -where)/Makefile.config")
 
 show_toolchain:
 	@echo Toolchain for the visible ocamlopt: $(TOOLCHAIN)
