New MinGW wrapper that makes gcc on Linux behave like MinGW on
Windows, using the Wine headers.

diff --git a/tools/.cvsignore b/tools/.cvsignore
index 3d055f7..a39647e 100644
--- a/tools/.cvsignore
+++ b/tools/.cvsignore
@@ -2,3 +2,4 @@
 bin2res
 fnt2bdf
 makedep
+mingwrap
diff --git a/tools/Makefile.in b/tools/Makefile.in
index dbf1b17..8779186 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -3,11 +3,19 @@
 TOPOBJDIR = ..
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
-
-PROGRAMS = makedep fnt2bdf bin2res
 MODULE   = none
 
-C_SRCS = makedep.c fnt2bdf.c bin2res.c
+PROGRAMS = \
+	bin2res \
+	fnt2bdf \
+	makedep \
+	mingwrap
+
+C_SRCS = \
+	bin2res.c \
+	fnt2bdf.c \
+	makedep.c \
+	mingwrap.c
 
 SUBDIRS = \
 	widl \
@@ -38,12 +46,16 @@
 bin2res: bin2res.o
 	$(CC) $(CFLAGS) -o bin2res bin2res.o
 
+mingwrap: mingwrap.o
+	$(CC) $(CFLAGS) -DINCLUDEDIR="$(includedir)" -o mingwrap mingwrap.o
+
 install::
 	$(MKINSTALLDIRS) $(bindir) $(mandir)/man$(prog_manext)
 	$(INSTALL_SCRIPT) $(SRCDIR)/winemaker $(bindir)/winemaker
+	$(INSTALL_SCRIPT) $(SRCDIR)/mingwrap $(bindir)/mingwrap
 	$(INSTALL_DATA) $(SRCDIR)/winemaker.man $(mandir)/man$(prog_manext)/winemaker.$(prog_manext)
 
 uninstall::
-	$(RM) $(bindir)/winemaker $(mandir)/man$(prog_manext)/winemaker.$(prog_manext)
+	$(RM) $(bindir)/winemaker $(bindir)/mingwrap $(mandir)/man$(prog_manext)/winemaker.$(prog_manext)
 
 ### Dependencies:
diff --git a/tools/mingwrap.c b/tools/mingwrap.c
new file mode 100644
index 0000000..a7fee85
--- /dev/null
+++ b/tools/mingwrap.c
@@ -0,0 +1,69 @@
+/*
+ * MinGW wrapper: makes gcc behave like MinGW.
+ *
+ * Copyright 2002 Dimitrie O. Paun
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#include <stdio.h>
+#include <string.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifndef GCC_BIN
+#define GCC_BIN "gcc"
+#endif
+
+#ifndef INCLUDEDIR
+#define INCLUDEDIR "/usr/local/include/wine"
+#endif
+
+int main(int argc, char **argv)
+{
+    char **gcc_argv;
+    int i, j;
+
+    gcc_argv = malloc(sizeof(char*) * (argc + 20));
+
+    i = 0;
+    gcc_argv[i++] = GCC_BIN;
+
+    gcc_argv[i++] = "-fshort-wchar";
+    gcc_argv[i++] = "-fPIC";
+    gcc_argv[i++] = "-I" INCLUDEDIR;
+    gcc_argv[i++] = "-I" INCLUDEDIR "/msvcrt";
+    gcc_argv[i++] = "-I" INCLUDEDIR "/windows";
+    gcc_argv[i++] = "-DWINE_DEFINE_WCHAR_T";
+    gcc_argv[i++] = "-D__int8=char";
+    gcc_argv[i++] = "-D__int16=short";
+    gcc_argv[i++] = "-D__int32=int";
+    gcc_argv[i++] = "-D__int64=long long";
+
+    for ( j = 1 ; j < argc ; j++ ) {
+	if (strcmp("-mno-cygwin", argv[j]) == 0) {
+	    /* ignore this option */
+        } else {
+            gcc_argv[i++] = argv[j];
+        }
+    }
+    gcc_argv[i] = NULL;
+
+    return execvp(GCC_BIN, gcc_argv);
+}