Fix error reporting in wavemap.c:wodOpen(); this solves the
[wine] / tools / mingwrap.c
1 /*
2  * MinGW wrapper: makes gcc behave like MinGW.
3  *
4  * Copyright 2002 Dimitrie O. Paun
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include "config.h"
22 #include "wine/port.h"
23
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #ifdef HAVE_UNISTD_H
28 # include <unistd.h>
29 #endif
30
31 #ifndef GCC_BIN
32 #define GCC_BIN "gcc"
33 #endif
34
35 #ifndef INCLUDEDIR
36 #define INCLUDEDIR "/usr/local/include/wine"
37 #endif
38
39 int main(int argc, char **argv)
40 {
41     char **gcc_argv;
42     int i, j;
43
44     gcc_argv = malloc(sizeof(char*) * (argc + 20));
45
46     i = 0;
47     gcc_argv[i++] = GCC_BIN;
48
49     gcc_argv[i++] = "-fshort-wchar";
50     gcc_argv[i++] = "-fPIC";
51     gcc_argv[i++] = "-I" INCLUDEDIR "/msvcrt";
52     gcc_argv[i++] = "-I" INCLUDEDIR "/windows";
53     gcc_argv[i++] = "-DWINE_DEFINE_WCHAR_T";
54     gcc_argv[i++] = "-D__int8=char";
55     gcc_argv[i++] = "-D__int16=short";
56     gcc_argv[i++] = "-D__int32=int";
57     gcc_argv[i++] = "-D__int64=long long";
58
59     for ( j = 1 ; j < argc ; j++ ) {
60         if (strcmp("-mno-cygwin", argv[j]) == 0) {
61             /* ignore this option */
62         } else {
63             gcc_argv[i++] = argv[j];
64         }
65     }
66     gcc_argv[i] = NULL;
67
68     return execvp(GCC_BIN, gcc_argv);
69 }