Revert 137452.
[official-gcc.git] / gcc / config / i386 / cygwin.h
blobf61cacb3e1ac78a298843bf5021058e69c9946d6
1 /* Operating system specific defines to be used when targeting GCC for
2 hosting on Windows32, using a Unix style C library and tools.
3 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
4 2007 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 3, 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 COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #define TARGET_VERSION fprintf (stderr, " (x86 Cygwin)");
24 #define EXTRA_OS_CPP_BUILTINS() /* Nothing. */
26 #undef CPP_SPEC
27 #define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
28 %{mno-win32:%{mno-cygwin: %emno-cygwin and mno-win32 are not compatible}} \
29 %{mno-cygwin:-D__MSVCRT__ -D__MINGW32__ %{!ansi:%{mthreads:-D_MT}}}\
30 %{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__ -D__unix }\
31 %{mwin32|mno-cygwin:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ %{!ansi:-DWINNT}}\
32 %{!nostdinc:%{!mno-win32|mno-cygwin:-idirafter ../include/w32api%s -idirafter ../../include/w32api%s}}\
35 #undef STARTFILE_SPEC
36 #define STARTFILE_SPEC "\
37 %{shared|mdll: %{mno-cygwin:dllcrt2%O%s}}\
38 %{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:crt2%O%s}\
39 %{pg:gcrt0%O%s}}}\
40 crtbegin.o%s"
42 #undef ENDFILE_SPEC
43 #define ENDFILE_SPEC \
44 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}\
45 crtend.o%s"
47 /* Normally, -lgcc is not needed since everything in it is in the DLL, but we
48 want to allow things to be added to it when installing new versions of
49 GCC without making a new CYGWIN.DLL, so we leave it. Profiling is handled
50 by calling the init function from main. */
52 #undef LIBGCC_SPEC
53 #define LIBGCC_SPEC \
54 "%{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} -lgcc \
55 %{mno-cygwin:-lmoldname -lmingwex -lmsvcrt}"
57 /* We have to dynamic link to get to the system DLLs. All of libc, libm and
58 the Unix stuff is in cygwin.dll. The import library is called
59 'libcygwin.a'. For Windows applications, include more libraries, but
60 always include kernel32. We'd like to specific subsystem windows to
61 ld, but that doesn't work just yet. */
63 #undef LIB_SPEC
64 #define LIB_SPEC "\
65 %{pg:-lgmon} \
66 %{!mno-cygwin:-lcygwin} \
67 %{mno-cygwin:%{mthreads:-lmingwthrd} -lmingw32} \
68 %{mwindows:-lgdi32 -lcomdlg32} \
69 -luser32 -lkernel32 -ladvapi32 -lshell32"
71 #define LINK_SPEC "\
72 %{mwindows:--subsystem windows} \
73 %{mconsole:--subsystem console} \
74 %{shared: %{mdll: %eshared and mdll are not compatible}} \
75 %{shared: --shared} %{mdll:--dll} \
76 %{static:-Bstatic} %{!static:-Bdynamic} \
77 %{shared|mdll: -e \
78 %{mno-cygwin:_DllMainCRTStartup@12} \
79 %{!mno-cygwin:__cygwin_dll_entry@12}}\
80 %{!mno-cygwin:--dll-search-prefix=cyg}"
82 /* Allocate space for all of the machine-spec-specific stuff.
83 Allocate enough space for cygwin -> mingw32 munging plus
84 possible addition of "/mingw". */
86 #ifndef CYGWIN_MINGW_SUBDIR
87 #define CYGWIN_MINGW_SUBDIR "/mingw"
88 #endif
89 #define CYGWIN_MINGW_SUBDIR_LEN (sizeof (CYGWIN_MINGW_SUBDIR) - 1)
91 #ifdef GPLUSPLUS_INCLUDE_DIR
92 char cygwin_gplusplus_include_dir[sizeof (GPLUSPLUS_INCLUDE_DIR) + 1
93 + (CYGWIN_MINGW_SUBDIR_LEN)]
94 = GPLUSPLUS_INCLUDE_DIR;
95 #undef GPLUSPLUS_INCLUDE_DIR
96 #define GPLUSPLUS_INCLUDE_DIR ((const char *) cygwin_gplusplus_include_dir)
97 #ifndef GEN_CVT_ARRAY
98 #define GEN_CVT_ARRAY
99 #endif
100 #endif
102 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
103 char cygwin_gplusplus_tool_include_dir[sizeof (GPLUSPLUS_TOOL_INCLUDE_DIR) + 1
104 + CYGWIN_MINGW_SUBDIR_LEN]
105 = GPLUSPLUS_TOOL_INCLUDE_DIR;
106 #undef GPLUSPLUS_TOOL_INCLUDE_DIR
107 #define GPLUSPLUS_TOOL_INCLUDE_DIR ((const char *) cygwin_gplusplus_tool_include_dir)
108 #ifndef GEN_CVT_ARRAY
109 #define GEN_CVT_ARRAY
110 #endif
111 #endif
113 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
114 char cygwin_gplusplus_backward_include_dir[sizeof (GPLUSPLUS_BACKWARD_INCLUDE_DIR) + 1
115 + CYGWIN_MINGW_SUBDIR_LEN]
116 = GPLUSPLUS_BACKWARD_INCLUDE_DIR;
117 #undef GPLUSPLUS_BACKWARD_INCLUDE_DIR
118 #define GPLUSPLUS_BACKWARD_INCLUDE_DIR ((const char *) cygwin_gplusplus_backward_include_dir)
119 #ifndef GEN_CVT_ARRAY
120 #define GEN_CVT_ARRAY
121 #endif
122 #endif
124 #ifdef LOCAL_INCLUDE_DIR
125 char cygwin_local_include_dir[sizeof (LOCAL_INCLUDE_DIR) + 1
126 + CYGWIN_MINGW_SUBDIR_LEN]
127 = LOCAL_INCLUDE_DIR;
128 #undef LOCAL_INCLUDE_DIR
129 #define LOCAL_INCLUDE_DIR ((const char *) cygwin_local_include_dir)
130 #ifndef GEN_CVT_ARRAY
131 #define GEN_CVT_ARRAY
132 #endif
133 #endif
135 #ifdef CROSS_INCLUDE_DIR
136 char cygwin_cross_include_dir[sizeof (CROSS_INCLUDE_DIR) + 1
137 + CYGWIN_MINGW_SUBDIR_LEN]
138 = CROSS_INCLUDE_DIR;
139 #undef CROSS_INCLUDE_DIR
140 #define CROSS_INCLUDE_DIR ((const char *) cygwin_cross_include_dir)
141 #ifndef GEN_CVT_ARRAY
142 #define GEN_CVT_ARRAY
143 #endif
144 #endif
146 #ifdef TOOL_INCLUDE_DIR
147 char cygwin_tool_include_dir[sizeof (TOOL_INCLUDE_DIR) + 1
148 + CYGWIN_MINGW_SUBDIR_LEN]
149 = TOOL_INCLUDE_DIR;
150 #undef TOOL_INCLUDE_DIR
151 #define TOOL_INCLUDE_DIR ((const char *) cygwin_tool_include_dir)
153 #ifndef CROSS_DIRECTORY_STRUCTURE
154 #undef STANDARD_INCLUDE_DIR
155 #define STANDARD_INCLUDE_DIR "/usr/include"
156 char cygwin_standard_include_dir[sizeof (STANDARD_INCLUDE_DIR) + 1
157 + CYGWIN_MINGW_SUBDIR_LEN]
158 = STANDARD_INCLUDE_DIR;
159 #undef STANDARD_INCLUDE_DIR
160 #define STANDARD_INCLUDE_DIR ((const char *) cygwin_standard_include_dir)
161 #endif
163 #ifndef GEN_CVT_ARRAY
164 #define GEN_CVT_ARRAY
165 #endif
166 #endif
168 #ifndef GEN_CVT_ARRAY
169 extern char *cvt_to_mingw[];
170 #else
171 char *cvt_to_mingw[] =
173 #ifdef GPLUSPLUS_INCLUDE_DIR
174 cygwin_gplusplus_include_dir,
175 #endif
177 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
178 cygwin_gplusplus_tool_include_dir,
179 #endif
181 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
182 cygwin_gplusplus_backward_include_dir,
183 #endif
185 #ifdef LOCAL_INCLUDE_DIR
186 cygwin_local_include_dir,
187 #endif
189 #ifdef CROSS_INCLUDE_DIR
190 cygwin_cross_include_dir,
191 #endif
193 #ifdef TOOL_INCLUDE_DIR
194 cygwin_tool_include_dir,
195 #endif
197 #ifdef STANDARD_INCLUDE_DIR
198 cygwin_standard_include_dir,
199 #endif
201 NULL
203 #undef GEN_CVT_ARRAY
204 #endif /*GEN_CVT_ARRAY*/
206 void mingw_scan (int, const char * const *, const char **);
207 #if 1
208 #define GCC_DRIVER_HOST_INITIALIZATION \
209 do \
211 mingw_scan(argc, (const char * const *) argv, &spec_machine); \
213 while (0)
214 #else
215 #define GCC_DRIVER_HOST_INITIALIZATION \
216 do \
218 char *cprefix = concat (tooldir_base_prefix, spec_machine, \
219 dir_separator_str, NULL); \
220 if (!IS_ABSOLUTE_PATH (cprefix)) \
221 cprefix = concat (standard_exec_prefix, spec_machine, dir_separator_str, \
222 spec_version, dir_separator_str, tooldir_prefix, NULL); \
223 add_prefix (&exec_prefixes,\
224 concat (cprefix, "../../../../", spec_machine, "/bin/", NULL), \
225 "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL); \
226 add_prefix (&exec_prefixes, cprefix, \
227 "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL); \
228 add_prefix (&startfile_prefixes,\
229 concat (standard_startfile_prefix, "w32api", NULL),\
230 "GCC", PREFIX_PRIORITY_LAST, 0, NULL);\
231 mingw_scan(argc, (const char * const *) argv, &spec_machine); \
233 while (0)
234 #endif
236 /* Binutils does not handle weak symbols from dlls correctly. For now,
237 do not use them unnecessarily in gthr-posix.h. */
238 #define GTHREAD_USE_WEAK 0
240 /* Every program on cygwin links against cygwin1.dll which contains
241 the pthread routines. There is no need to explicitly link them
242 and the -pthread flag is not recognized. */
243 #undef GOMP_SELF_SPECS
244 #define GOMP_SELF_SPECS ""