gcc/
[official-gcc.git] / gcc / config / i386 / mingw32.h
blobc608826be11a48eb804c1757ad071eaf88fd6fad
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, 2002, 2003, 2004
4 Free Software Foundation, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING. If not, write to
20 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 #undef TARGET_VERSION
24 #if TARGET_64BIT_DEFAULT
25 #define TARGET_VERSION fprintf (stderr,"(x86_64 MinGW");
26 #else
27 #define TARGET_VERSION fprintf (stderr," (x86 MinGW)");
28 #endif
30 /* See i386/crtdll.h for an alternative definition. */
31 #define EXTRA_OS_CPP_BUILTINS() \
32 do \
33 { \
34 builtin_define ("__MSVCRT__"); \
35 builtin_define ("__MINGW32__"); \
36 builtin_define ("_WIN32"); \
37 builtin_define_std ("WIN32"); \
38 builtin_define_std ("WINNT"); \
39 if (TARGET_64BIT_MS_ABI) \
40 { \
41 builtin_define ("__MINGW64__"); \
42 builtin_define_with_value("_INTEGRAL_MAX_BITS","64",0); \
43 builtin_define_std ("WIN64"); \
44 builtin_define_std ("_WIN64"); \
45 } \
46 else \
47 { \
48 builtin_define_with_value("_INTEGRAL_MAX_BITS","32",0); \
49 } \
50 } \
51 while (0)
53 /* Override the standard choice of /usr/include as the default prefix
54 to try when searching for header files. */
55 #undef STANDARD_INCLUDE_DIR
56 #if TARGET_64BIT_DEFAULT
57 #define STANDARD_INCLUDE_DIR "/mingw/include64"
58 #else
59 #define STANDARD_INCLUDE_DIR "/mingw/include"
60 #endif
61 #undef STANDARD_INCLUDE_COMPONENT
62 #define STANDARD_INCLUDE_COMPONENT "MINGW"
64 #undef CPP_SPEC
65 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}"
67 /* For Windows applications, include more libraries, but always include
68 kernel32. */
69 #undef LIB_SPEC
70 #define LIB_SPEC "%{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} \
71 -luser32 -lkernel32 -ladvapi32 -lshell32"
73 /* Include in the mingw32 libraries with libgcc */
74 #undef LINK_SPEC
75 #define LINK_SPEC "%{mwindows:--subsystem windows} \
76 %{mconsole:--subsystem console} \
77 %{shared: %{mdll: %eshared and mdll are not compatible}} \
78 %{shared: --shared} %{mdll:--dll} \
79 %{static:-Bstatic} %{!static:-Bdynamic} \
80 %{shared|mdll: -e _DllMainCRTStartup@12}"
82 /* Include in the mingw32 libraries with libgcc */
83 #undef LIBGCC_SPEC
84 #define LIBGCC_SPEC \
85 "%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt"
87 #undef STARTFILE_SPEC
88 #define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
89 %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s}"
91 /* Override startfile prefix defaults. */
92 #ifndef STANDARD_STARTFILE_PREFIX_1
93 #if TARGET_64BIT_DEFAULT
94 #define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib64/"
95 #else
96 #define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib/"
97 #endif
98 #endif
99 #ifndef STANDARD_STARTFILE_PREFIX_2
100 #define STANDARD_STARTFILE_PREFIX_2 ""
101 #endif
103 /* Output STRING, a string representing a filename, to FILE.
104 We canonicalize it to be in Unix format (backslashes are replaced
105 forward slashes. */
106 #undef OUTPUT_QUOTED_STRING
107 #define OUTPUT_QUOTED_STRING(FILE, STRING) \
108 do { \
109 char c; \
111 putc ('\"', asm_file); \
113 while ((c = *string++) != 0) \
115 if (c == '\\') \
116 c = '/'; \
118 if (ISPRINT (c)) \
120 if (c == '\"') \
121 putc ('\\', asm_file); \
122 putc (c, asm_file); \
124 else \
125 fprintf (asm_file, "\\%03o", (unsigned char) c); \
128 putc ('\"', asm_file); \
129 } while (0)
131 /* Define as short unsigned for compatibility with MS runtime. */
132 #undef WINT_TYPE
133 #define WINT_TYPE "short unsigned int"
135 /* mingw32 uses the -mthreads option to enable thread support. */
136 #undef GOMP_SELF_SPECS
137 #define GOMP_SELF_SPECS "%{fopenmp: -mthreads}"
139 /* mingw32 atexit function is safe to use in shared libraries. Use it
140 to register C++ static destructors. */
141 #define TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT hook_bool_void_true