Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / config / i386 / cygwin.h
blob96b4692d8214bfc1a7a9a951367f07b3780a98d7
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 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, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
23 #define TARGET_VERSION fprintf (stderr, " (x86 Cygwin)");
25 #define EXTRA_OS_CPP_BUILTINS() /* Nothing. */
27 #undef CPP_SPEC
28 #define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
29 %{mno-win32:%{mno-cygwin: %emno-cygwin and mno-win32 are not compatible}} \
30 %{mno-cygwin:-D__MSVCRT__ -D__MINGW32__ %{!ansi:%{mthreads:-D_MT}}}\
31 %{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__ -D__unix }\
32 %{mwin32|mno-cygwin:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ %{!ansi:-DWINNT}}\
33 %{!nostdinc:%{!mno-win32|mno-cygwin:-idirafter ../include/w32api%s -idirafter ../../include/w32api%s}}\
36 #undef STARTFILE_SPEC
37 #define STARTFILE_SPEC "\
38 %{shared|mdll: %{mno-cygwin:dllcrt2%O%s}}\
39 %{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:crt2%O%s}\
40 %{pg:gcrt0%O%s}}}\
43 /* Normally, -lgcc is not needed since everything in it is in the DLL, but we
44 want to allow things to be added to it when installing new versions of
45 GCC without making a new CYGWIN.DLL, so we leave it. Profiling is handled
46 by calling the init function from main. */
48 #undef LIBGCC_SPEC
49 #define LIBGCC_SPEC \
50 "%{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} -lgcc \
51 %{mno-cygwin:-lmoldname -lmingwex -lmsvcrt}"
53 /* We have to dynamic link to get to the system DLLs. All of libc, libm and
54 the Unix stuff is in cygwin.dll. The import library is called
55 'libcygwin.a'. For Windows applications, include more libraries, but
56 always include kernel32. We'd like to specific subsystem windows to
57 ld, but that doesn't work just yet. */
59 #undef LIB_SPEC
60 #define LIB_SPEC "\
61 %{pg:-lgmon} \
62 %{!mno-cygwin:-lcygwin} \
63 %{mno-cygwin:%{mthreads:-lmingwthrd} -lmingw32} \
64 %{mwindows:-lgdi32 -lcomdlg32} \
65 -luser32 -lkernel32 -ladvapi32 -lshell32"
67 #define LINK_SPEC "\
68 %{mwindows:--subsystem windows} \
69 %{mconsole:--subsystem console} \
70 %{shared: %{mdll: %eshared and mdll are not compatible}} \
71 %{shared: --shared} %{mdll:--dll} \
72 %{static:-Bstatic} %{!static:-Bdynamic} \
73 %{shared|mdll: -e \
74 %{mno-cygwin:_DllMainCRTStartup@12} \
75 %{!mno-cygwin:__cygwin_dll_entry@12}}\
76 %{!mno-cygwin:--dll-search-prefix=cyg}"
78 /* Allocate space for all of the machine-spec-specific stuff.
79 Allocate enough space for cygwin -> mingw32 munging plus
80 possible addition of "/mingw". */
82 #ifndef CYGWIN_MINGW_SUBDIR
83 #define CYGWIN_MINGW_SUBDIR "/mingw"
84 #endif
85 #define CYGWIN_MINGW_SUBDIR_LEN (sizeof (CYGWIN_MINGW_SUBDIR) - 1)
87 #ifdef GPLUSPLUS_INCLUDE_DIR
88 char cygwin_gplusplus_include_dir[sizeof (GPLUSPLUS_INCLUDE_DIR) + 1
89 + (CYGWIN_MINGW_SUBDIR_LEN)]
90 = GPLUSPLUS_INCLUDE_DIR;
91 #undef GPLUSPLUS_INCLUDE_DIR
92 #define GPLUSPLUS_INCLUDE_DIR ((const char *) cygwin_gplusplus_include_dir)
93 #ifndef GEN_CVT_ARRAY
94 #define GEN_CVT_ARRAY
95 #endif
96 #endif
98 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
99 char cygwin_gplusplus_tool_include_dir[sizeof (GPLUSPLUS_TOOL_INCLUDE_DIR) + 1
100 + CYGWIN_MINGW_SUBDIR_LEN]
101 = GPLUSPLUS_TOOL_INCLUDE_DIR;
102 #undef GPLUSPLUS_TOOL_INCLUDE_DIR
103 #define GPLUSPLUS_TOOL_INCLUDE_DIR ((const char *) cygwin_gplusplus_tool_include_dir)
104 #ifndef GEN_CVT_ARRAY
105 #define GEN_CVT_ARRAY
106 #endif
107 #endif
109 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
110 char cygwin_gplusplus_backward_include_dir[sizeof (GPLUSPLUS_BACKWARD_INCLUDE_DIR) + 1
111 + CYGWIN_MINGW_SUBDIR_LEN]
112 = GPLUSPLUS_BACKWARD_INCLUDE_DIR;
113 #undef GPLUSPLUS_BACKWARD_INCLUDE_DIR
114 #define GPLUSPLUS_BACKWARD_INCLUDE_DIR ((const char *) cygwin_gplusplus_backward_include_dir)
115 #ifndef GEN_CVT_ARRAY
116 #define GEN_CVT_ARRAY
117 #endif
118 #endif
120 #ifdef LOCAL_INCLUDE_DIR
121 char cygwin_local_include_dir[sizeof (LOCAL_INCLUDE_DIR) + 1
122 + CYGWIN_MINGW_SUBDIR_LEN]
123 = LOCAL_INCLUDE_DIR;
124 #undef LOCAL_INCLUDE_DIR
125 #define LOCAL_INCLUDE_DIR ((const char *) cygwin_local_include_dir)
126 #ifndef GEN_CVT_ARRAY
127 #define GEN_CVT_ARRAY
128 #endif
129 #endif
131 #ifdef CROSS_INCLUDE_DIR
132 char cygwin_cross_include_dir[sizeof (CROSS_INCLUDE_DIR) + 1
133 + CYGWIN_MINGW_SUBDIR_LEN]
134 = CROSS_INCLUDE_DIR;
135 #undef CROSS_INCLUDE_DIR
136 #define CROSS_INCLUDE_DIR ((const char *) cygwin_cross_include_dir)
137 #ifndef GEN_CVT_ARRAY
138 #define GEN_CVT_ARRAY
139 #endif
140 #endif
142 #ifdef TOOL_INCLUDE_DIR
143 char cygwin_tool_include_dir[sizeof (TOOL_INCLUDE_DIR) + 1
144 + CYGWIN_MINGW_SUBDIR_LEN]
145 = TOOL_INCLUDE_DIR;
146 #undef TOOL_INCLUDE_DIR
147 #define TOOL_INCLUDE_DIR ((const char *) cygwin_tool_include_dir)
149 #ifndef CROSS_COMPILE
150 #undef STANDARD_INCLUDE_DIR
151 #define STANDARD_INCLUDE_DIR "/usr/include"
152 char cygwin_standard_include_dir[sizeof (STANDARD_INCLUDE_DIR) + 1
153 + CYGWIN_MINGW_SUBDIR_LEN]
154 = STANDARD_INCLUDE_DIR;
155 #undef STANDARD_INCLUDE_DIR
156 #define STANDARD_INCLUDE_DIR ((const char *) cygwin_standard_include_dir)
157 #endif
159 #ifndef GEN_CVT_ARRAY
160 #define GEN_CVT_ARRAY
161 #endif
162 #endif
164 #ifndef GEN_CVT_ARRAY
165 extern char *cvt_to_mingw[];
166 #else
167 char *cvt_to_mingw[] =
169 #ifdef GPLUSPLUS_INCLUDE_DIR
170 cygwin_gplusplus_include_dir,
171 #endif
173 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
174 cygwin_gplusplus_tool_include_dir,
175 #endif
177 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
178 cygwin_gplusplus_backward_include_dir,
179 #endif
181 #ifdef LOCAL_INCLUDE_DIR
182 cygwin_local_include_dir,
183 #endif
185 #ifdef CROSS_INCLUDE_DIR
186 cygwin_cross_include_dir,
187 #endif
189 #ifdef TOOL_INCLUDE_DIR
190 cygwin_tool_include_dir,
191 #endif
193 #ifdef STANDARD_INCLUDE_DIR
194 cygwin_standard_include_dir,
195 #endif
197 NULL
199 #undef GEN_CVT_ARRAY
200 #endif /*GEN_CVT_ARRAY*/
202 void mingw_scan (int, const char * const *, char **);
203 #if 1
204 #define GCC_DRIVER_HOST_INITIALIZATION \
205 do \
207 mingw_scan(argc, argv, (char **) &spec_machine); \
209 while (0)
210 #else
211 #define GCC_DRIVER_HOST_INITIALIZATION \
212 do \
214 char *cprefix = concat (tooldir_base_prefix, spec_machine, \
215 dir_separator_str, NULL); \
216 if (!IS_ABSOLUTE_PATH (cprefix)) \
217 cprefix = concat (standard_exec_prefix, spec_machine, dir_separator_str, \
218 spec_version, dir_separator_str, tooldir_prefix, NULL); \
219 add_prefix (&exec_prefixes,\
220 concat (cprefix, "../../../../", spec_machine, "/bin/", NULL), \
221 "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL); \
222 add_prefix (&exec_prefixes, cprefix, \
223 "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL); \
224 add_prefix (&startfile_prefixes,\
225 concat (standard_startfile_prefix, "w32api", NULL),\
226 "GCC", PREFIX_PRIORITY_LAST, 0, NULL);\
227 mingw_scan(argc, argv, &spec_machine); \
229 while (0)
230 #endif
232 /* Binutils does not handle weak symbols from dlls correctly. For now,
233 do not use them unnecessarily in gthr-posix.h. */
234 #define GTHREAD_USE_WEAK 0