OSDN Git Service

* i386.h (MIN_UNITS_PER_WORD): Define to 8 for x86-64 libgcc.
[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 ("__cdecl=__attribute__((__cdecl__))");          \
54         builtin_define ("__declspec(x)=__attribute__((x))");            \
55         if (!flag_iso)                                                  \
56           {                                                             \
57             builtin_define ("_stdcall=__attribute__((__stdcall__))");   \
58             builtin_define ("_cdecl=__attribute__((__cdecl__))");       \
59           }                                                             \
60         EXTRA_OS_CPP_BUILTINS ();                                       \
61         builtin_assert ("system=winnt");                                \
62     }                                                                   \
63   while (0)
64
65 /* Specific a different directory for the standard include files.  */
66 #undef STANDARD_INCLUDE_DIR
67 #define STANDARD_INCLUDE_DIR "/usr/local/mingw32/include"
68 #undef STANDARD_INCLUDE_COMPONENT
69 #define STANDARD_INCLUDE_COMPONENT "MINGW"
70
71 #undef CPP_SPEC
72 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}"
73
74 /* For Windows applications, include more libraries, but always include
75    kernel32.  */
76 #undef LIB_SPEC
77 #define LIB_SPEC "%{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} \
78                   -luser32 -lkernel32 -ladvapi32 -lshell32"
79
80 /* Include in the mingw32 libraries with libgcc */
81 #undef LINK_SPEC
82 #define LINK_SPEC "%{mwindows:--subsystem windows} \
83   %{mconsole:--subsystem console} \
84   %{shared: %{mdll: %eshared and mdll are not compatible}} \
85   %{shared: --shared} %{mdll:--dll} \
86   %{static:-Bstatic} %{!static:-Bdynamic} \
87   %{shared|mdll: -e _DllMainCRTStartup@12}"
88
89 /* Include in the mingw32 libraries with libgcc */
90 #undef LIBGCC_SPEC
91 #define LIBGCC_SPEC \
92   "%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname -lmsvcrt"
93
94 #undef STARTFILE_SPEC
95 #define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
96   %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s}"
97
98 /* MS runtime does not need a separate math library.  */
99 #undef MATH_LIBRARY
100 #define MATH_LIBRARY ""
101
102 /* Output STRING, a string representing a filename, to FILE.
103    We canonicalize it to be in Unix format (backslashe are replaced
104    forward slashes.  */
105 #undef OUTPUT_QUOTED_STRING
106 #define OUTPUT_QUOTED_STRING(FILE, STRING)               \
107 do {                                                     \
108   char c;                                                \
109                                                          \
110   putc ('\"', asm_file);                                 \
111                                                          \
112   while ((c = *string++) != 0)                           \
113     {                                                    \
114       if (c == '\\')                                     \
115         c = '/';                                         \
116                                                          \
117       if (ISPRINT (c))                                   \
118         {                                                \
119           if (c == '\"')                                 \
120             putc ('\\', asm_file);                       \
121           putc (c, asm_file);                            \
122         }                                                \
123       else                                               \
124         fprintf (asm_file, "\\%03o", (unsigned char) c); \
125     }                                                    \
126                                                          \
127   putc ('\"', asm_file);                                 \
128 } while (0)
129
130 /* Override Cygwin's definition. This is necessary now due to the way
131    Cygwin profiling code is written. Once "fixed", we can remove this.  */
132 #undef SUBTARGET_PROLOGUE
133
134 /* Define as short unsigned for compatability with MS runtime.  */
135 #undef WINT_TYPE
136 #define WINT_TYPE "short unsigned int"