OSDN Git Service

* config/i386/i386.c (ix86_handle_cdecl_attribute): Check for
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / mingw32.h
1 /* Operating system specific defines to be used when targeting GCC for
2    hosting on Windows32, using GNU tools and the Windows32 API Library.
3    Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21
22 /* Most of this is the same as for cygwin, except for changing some
23    specs.  */
24
25 /* Mingw GCC, unlike Cygwin's, must be relocatable. This macro must 
26    be defined before any other files are included.  */
27 #ifndef WIN32_NO_ABSOLUTE_INST_DIRS
28 #define WIN32_NO_ABSOLUTE_INST_DIRS 1
29 #endif
30
31 #include "i386/cygwin.h"
32
33 #define TARGET_EXECUTABLE_SUFFIX ".exe"
34
35 /* See i386/crtdll.h for an altervative definition.  */
36 #define EXTRA_OS_CPP_BUILTINS()                                 \
37   do                                                            \
38     {                                                           \
39       builtin_define ("__MSVCRT__");                            \
40       builtin_define ("__MINGW32__");                           \
41     }                                                           \
42   while (0)
43
44 #undef TARGET_OS_CPP_BUILTINS   /* From cygwin.h.  */
45 #define TARGET_OS_CPP_BUILTINS()                                        \
46   do                                                                    \
47     {                                                                   \
48         builtin_define ("_WIN32");                                      \
49         builtin_define_std ("WIN32");                                   \
50         builtin_define_std ("WINNT");                                   \
51         builtin_define ("_X86_=1");                                     \
52         builtin_define ("__stdcall=__attribute__((__stdcall__))");      \
53         builtin_define ("__fastcall=__attribute__((__fastcall__))");    \
54         builtin_define ("__cdecl=__attribute__((__cdecl__))");          \
55         builtin_define ("__declspec(x)=__attribute__((x))");            \
56         if (!flag_iso)                                                  \
57           {                                                             \
58             builtin_define ("_stdcall=__attribute__((__stdcall__))");   \
59             builtin_define ("_fastcall=__attribute__((__fastcall__))"); \
60             builtin_define ("_cdecl=__attribute__((__cdecl__))");       \
61           }                                                             \
62         EXTRA_OS_CPP_BUILTINS ();                                       \
63         builtin_assert ("system=winnt");                                \
64     }                                                                   \
65   while (0)
66
67 /* Specific a different directory for the standard include files.  */
68 #undef STANDARD_INCLUDE_DIR
69 #define STANDARD_INCLUDE_DIR "/usr/local/mingw32/include"
70 #undef STANDARD_INCLUDE_COMPONENT
71 #define STANDARD_INCLUDE_COMPONENT "MINGW"
72
73 #undef CPP_SPEC
74 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}"
75
76 /* For Windows applications, include more libraries, but always include
77    kernel32.  */
78 #undef LIB_SPEC
79 #define LIB_SPEC "%{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} \
80                   -luser32 -lkernel32 -ladvapi32 -lshell32"
81
82 /* Include in the mingw32 libraries with libgcc */
83 #undef LINK_SPEC
84 #define LINK_SPEC "%{mwindows:--subsystem windows} \
85   %{mconsole:--subsystem console} \
86   %{shared: %{mdll: %eshared and mdll are not compatible}} \
87   %{shared: --shared} %{mdll:--dll} \
88   %{static:-Bstatic} %{!static:-Bdynamic} \
89   %{shared|mdll: -e _DllMainCRTStartup@12}"
90
91 /* Include in the mingw32 libraries with libgcc */
92 #undef LIBGCC_SPEC
93 #define LIBGCC_SPEC \
94   "%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname -lmsvcrt"
95
96 #undef STARTFILE_SPEC
97 #define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
98   %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s}"
99
100 /* MS runtime does not need a separate math library.  */
101 #undef MATH_LIBRARY
102 #define MATH_LIBRARY ""
103
104 /* Output STRING, a string representing a filename, to FILE.
105    We canonicalize it to be in Unix format (backslashe are replaced
106    forward slashes.  */
107 #undef OUTPUT_QUOTED_STRING
108 #define OUTPUT_QUOTED_STRING(FILE, STRING)               \
109 do {                                                     \
110   char c;                                                \
111                                                          \
112   putc ('\"', asm_file);                                 \
113                                                          \
114   while ((c = *string++) != 0)                           \
115     {                                                    \
116       if (c == '\\')                                     \
117         c = '/';                                         \
118                                                          \
119       if (ISPRINT (c))                                   \
120         {                                                \
121           if (c == '\"')                                 \
122             putc ('\\', asm_file);                       \
123           putc (c, asm_file);                            \
124         }                                                \
125       else                                               \
126         fprintf (asm_file, "\\%03o", (unsigned char) c); \
127     }                                                    \
128                                                          \
129   putc ('\"', asm_file);                                 \
130 } while (0)
131
132 /* Define as short unsigned for compatability with MS runtime.  */
133 #undef WINT_TYPE
134 #define WINT_TYPE "short unsigned int"