1 |
38 |
julius |
/* 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.
|
5 |
|
|
|
6 |
|
|
This file is part of GCC.
|
7 |
|
|
|
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.
|
12 |
|
|
|
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.
|
17 |
|
|
|
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/>. */
|
21 |
|
|
|
22 |
|
|
#define TARGET_VERSION fprintf (stderr, " (x86 Cygwin)");
|
23 |
|
|
|
24 |
|
|
#define EXTRA_OS_CPP_BUILTINS() /* Nothing. */
|
25 |
|
|
|
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}}\
|
33 |
|
|
"
|
34 |
|
|
|
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 |
|
|
"
|
41 |
|
|
|
42 |
|
|
/* Normally, -lgcc is not needed since everything in it is in the DLL, but we
|
43 |
|
|
want to allow things to be added to it when installing new versions of
|
44 |
|
|
GCC without making a new CYGWIN.DLL, so we leave it. Profiling is handled
|
45 |
|
|
by calling the init function from main. */
|
46 |
|
|
|
47 |
|
|
#undef LIBGCC_SPEC
|
48 |
|
|
#define LIBGCC_SPEC \
|
49 |
|
|
"%{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} -lgcc \
|
50 |
|
|
%{mno-cygwin:-lmoldname -lmingwex -lmsvcrt}"
|
51 |
|
|
|
52 |
|
|
/* We have to dynamic link to get to the system DLLs. All of libc, libm and
|
53 |
|
|
the Unix stuff is in cygwin.dll. The import library is called
|
54 |
|
|
'libcygwin.a'. For Windows applications, include more libraries, but
|
55 |
|
|
always include kernel32. We'd like to specific subsystem windows to
|
56 |
|
|
ld, but that doesn't work just yet. */
|
57 |
|
|
|
58 |
|
|
#undef LIB_SPEC
|
59 |
|
|
#define LIB_SPEC "\
|
60 |
|
|
%{pg:-lgmon} \
|
61 |
|
|
%{!mno-cygwin:-lcygwin} \
|
62 |
|
|
%{mno-cygwin:%{mthreads:-lmingwthrd} -lmingw32} \
|
63 |
|
|
%{mwindows:-lgdi32 -lcomdlg32} \
|
64 |
|
|
-luser32 -lkernel32 -ladvapi32 -lshell32"
|
65 |
|
|
|
66 |
|
|
#define LINK_SPEC "\
|
67 |
|
|
%{mwindows:--subsystem windows} \
|
68 |
|
|
%{mconsole:--subsystem console} \
|
69 |
|
|
%{shared: %{mdll: %eshared and mdll are not compatible}} \
|
70 |
|
|
%{shared: --shared} %{mdll:--dll} \
|
71 |
|
|
%{static:-Bstatic} %{!static:-Bdynamic} \
|
72 |
|
|
%{shared|mdll: -e \
|
73 |
|
|
%{mno-cygwin:_DllMainCRTStartup@12} \
|
74 |
|
|
%{!mno-cygwin:__cygwin_dll_entry@12}}\
|
75 |
|
|
%{!mno-cygwin:--dll-search-prefix=cyg}"
|
76 |
|
|
|
77 |
|
|
/* Allocate space for all of the machine-spec-specific stuff.
|
78 |
|
|
Allocate enough space for cygwin -> mingw32 munging plus
|
79 |
|
|
possible addition of "/mingw". */
|
80 |
|
|
|
81 |
|
|
#ifndef CYGWIN_MINGW_SUBDIR
|
82 |
|
|
#define CYGWIN_MINGW_SUBDIR "/mingw"
|
83 |
|
|
#endif
|
84 |
|
|
#define CYGWIN_MINGW_SUBDIR_LEN (sizeof (CYGWIN_MINGW_SUBDIR) - 1)
|
85 |
|
|
|
86 |
|
|
#ifdef GPLUSPLUS_INCLUDE_DIR
|
87 |
|
|
char cygwin_gplusplus_include_dir[sizeof (GPLUSPLUS_INCLUDE_DIR) + 1
|
88 |
|
|
+ (CYGWIN_MINGW_SUBDIR_LEN)]
|
89 |
|
|
= GPLUSPLUS_INCLUDE_DIR;
|
90 |
|
|
#undef GPLUSPLUS_INCLUDE_DIR
|
91 |
|
|
#define GPLUSPLUS_INCLUDE_DIR ((const char *) cygwin_gplusplus_include_dir)
|
92 |
|
|
#ifndef GEN_CVT_ARRAY
|
93 |
|
|
#define GEN_CVT_ARRAY
|
94 |
|
|
#endif
|
95 |
|
|
#endif
|
96 |
|
|
|
97 |
|
|
#ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
|
98 |
|
|
char cygwin_gplusplus_tool_include_dir[sizeof (GPLUSPLUS_TOOL_INCLUDE_DIR) + 1
|
99 |
|
|
+ CYGWIN_MINGW_SUBDIR_LEN]
|
100 |
|
|
= GPLUSPLUS_TOOL_INCLUDE_DIR;
|
101 |
|
|
#undef GPLUSPLUS_TOOL_INCLUDE_DIR
|
102 |
|
|
#define GPLUSPLUS_TOOL_INCLUDE_DIR ((const char *) cygwin_gplusplus_tool_include_dir)
|
103 |
|
|
#ifndef GEN_CVT_ARRAY
|
104 |
|
|
#define GEN_CVT_ARRAY
|
105 |
|
|
#endif
|
106 |
|
|
#endif
|
107 |
|
|
|
108 |
|
|
#ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
|
109 |
|
|
char cygwin_gplusplus_backward_include_dir[sizeof (GPLUSPLUS_BACKWARD_INCLUDE_DIR) + 1
|
110 |
|
|
+ CYGWIN_MINGW_SUBDIR_LEN]
|
111 |
|
|
= GPLUSPLUS_BACKWARD_INCLUDE_DIR;
|
112 |
|
|
#undef GPLUSPLUS_BACKWARD_INCLUDE_DIR
|
113 |
|
|
#define GPLUSPLUS_BACKWARD_INCLUDE_DIR ((const char *) cygwin_gplusplus_backward_include_dir)
|
114 |
|
|
#ifndef GEN_CVT_ARRAY
|
115 |
|
|
#define GEN_CVT_ARRAY
|
116 |
|
|
#endif
|
117 |
|
|
#endif
|
118 |
|
|
|
119 |
|
|
#ifdef LOCAL_INCLUDE_DIR
|
120 |
|
|
char cygwin_local_include_dir[sizeof (LOCAL_INCLUDE_DIR) + 1
|
121 |
|
|
+ CYGWIN_MINGW_SUBDIR_LEN]
|
122 |
|
|
= LOCAL_INCLUDE_DIR;
|
123 |
|
|
#undef LOCAL_INCLUDE_DIR
|
124 |
|
|
#define LOCAL_INCLUDE_DIR ((const char *) cygwin_local_include_dir)
|
125 |
|
|
#ifndef GEN_CVT_ARRAY
|
126 |
|
|
#define GEN_CVT_ARRAY
|
127 |
|
|
#endif
|
128 |
|
|
#endif
|
129 |
|
|
|
130 |
|
|
#ifdef CROSS_INCLUDE_DIR
|
131 |
|
|
char cygwin_cross_include_dir[sizeof (CROSS_INCLUDE_DIR) + 1
|
132 |
|
|
+ CYGWIN_MINGW_SUBDIR_LEN]
|
133 |
|
|
= CROSS_INCLUDE_DIR;
|
134 |
|
|
#undef CROSS_INCLUDE_DIR
|
135 |
|
|
#define CROSS_INCLUDE_DIR ((const char *) cygwin_cross_include_dir)
|
136 |
|
|
#ifndef GEN_CVT_ARRAY
|
137 |
|
|
#define GEN_CVT_ARRAY
|
138 |
|
|
#endif
|
139 |
|
|
#endif
|
140 |
|
|
|
141 |
|
|
#ifdef TOOL_INCLUDE_DIR
|
142 |
|
|
char cygwin_tool_include_dir[sizeof (TOOL_INCLUDE_DIR) + 1
|
143 |
|
|
+ CYGWIN_MINGW_SUBDIR_LEN]
|
144 |
|
|
= TOOL_INCLUDE_DIR;
|
145 |
|
|
#undef TOOL_INCLUDE_DIR
|
146 |
|
|
#define TOOL_INCLUDE_DIR ((const char *) cygwin_tool_include_dir)
|
147 |
|
|
|
148 |
|
|
#ifndef CROSS_COMPILE
|
149 |
|
|
#undef STANDARD_INCLUDE_DIR
|
150 |
|
|
#define STANDARD_INCLUDE_DIR "/usr/include"
|
151 |
|
|
char cygwin_standard_include_dir[sizeof (STANDARD_INCLUDE_DIR) + 1
|
152 |
|
|
+ CYGWIN_MINGW_SUBDIR_LEN]
|
153 |
|
|
= STANDARD_INCLUDE_DIR;
|
154 |
|
|
#undef STANDARD_INCLUDE_DIR
|
155 |
|
|
#define STANDARD_INCLUDE_DIR ((const char *) cygwin_standard_include_dir)
|
156 |
|
|
#endif
|
157 |
|
|
|
158 |
|
|
#ifndef GEN_CVT_ARRAY
|
159 |
|
|
#define GEN_CVT_ARRAY
|
160 |
|
|
#endif
|
161 |
|
|
#endif
|
162 |
|
|
|
163 |
|
|
#ifndef GEN_CVT_ARRAY
|
164 |
|
|
extern char *cvt_to_mingw[];
|
165 |
|
|
#else
|
166 |
|
|
char *cvt_to_mingw[] =
|
167 |
|
|
{
|
168 |
|
|
#ifdef GPLUSPLUS_INCLUDE_DIR
|
169 |
|
|
cygwin_gplusplus_include_dir,
|
170 |
|
|
#endif
|
171 |
|
|
|
172 |
|
|
#ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
|
173 |
|
|
cygwin_gplusplus_tool_include_dir,
|
174 |
|
|
#endif
|
175 |
|
|
|
176 |
|
|
#ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
|
177 |
|
|
cygwin_gplusplus_backward_include_dir,
|
178 |
|
|
#endif
|
179 |
|
|
|
180 |
|
|
#ifdef LOCAL_INCLUDE_DIR
|
181 |
|
|
cygwin_local_include_dir,
|
182 |
|
|
#endif
|
183 |
|
|
|
184 |
|
|
#ifdef CROSS_INCLUDE_DIR
|
185 |
|
|
cygwin_cross_include_dir,
|
186 |
|
|
#endif
|
187 |
|
|
|
188 |
|
|
#ifdef TOOL_INCLUDE_DIR
|
189 |
|
|
cygwin_tool_include_dir,
|
190 |
|
|
#endif
|
191 |
|
|
|
192 |
|
|
#ifdef STANDARD_INCLUDE_DIR
|
193 |
|
|
cygwin_standard_include_dir,
|
194 |
|
|
#endif
|
195 |
|
|
|
196 |
|
|
NULL
|
197 |
|
|
};
|
198 |
|
|
#undef GEN_CVT_ARRAY
|
199 |
|
|
#endif /*GEN_CVT_ARRAY*/
|
200 |
|
|
|
201 |
|
|
void mingw_scan (int, const char * const *, char **);
|
202 |
|
|
#if 1
|
203 |
|
|
#define GCC_DRIVER_HOST_INITIALIZATION \
|
204 |
|
|
do \
|
205 |
|
|
{ \
|
206 |
|
|
mingw_scan(argc, (const char * const *) argv, (char **) &spec_machine); \
|
207 |
|
|
} \
|
208 |
|
|
while (0)
|
209 |
|
|
#else
|
210 |
|
|
#define GCC_DRIVER_HOST_INITIALIZATION \
|
211 |
|
|
do \
|
212 |
|
|
{ \
|
213 |
|
|
char *cprefix = concat (tooldir_base_prefix, spec_machine, \
|
214 |
|
|
dir_separator_str, NULL); \
|
215 |
|
|
if (!IS_ABSOLUTE_PATH (cprefix)) \
|
216 |
|
|
cprefix = concat (standard_exec_prefix, spec_machine, dir_separator_str, \
|
217 |
|
|
spec_version, dir_separator_str, tooldir_prefix, NULL); \
|
218 |
|
|
add_prefix (&exec_prefixes,\
|
219 |
|
|
concat (cprefix, "../../../../", spec_machine, "/bin/", NULL), \
|
220 |
|
|
"BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL); \
|
221 |
|
|
add_prefix (&exec_prefixes, cprefix, \
|
222 |
|
|
"BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL); \
|
223 |
|
|
add_prefix (&startfile_prefixes,\
|
224 |
|
|
concat (standard_startfile_prefix, "w32api", NULL),\
|
225 |
|
|
"GCC", PREFIX_PRIORITY_LAST, 0, NULL);\
|
226 |
|
|
mingw_scan(argc, (const char * const *) argv, &spec_machine); \
|
227 |
|
|
} \
|
228 |
|
|
while (0)
|
229 |
|
|
#endif
|
230 |
|
|
|
231 |
|
|
/* Binutils does not handle weak symbols from dlls correctly. For now,
|
232 |
|
|
do not use them unnecessarily in gthr-posix.h. */
|
233 |
|
|
#define GTHREAD_USE_WEAK 0
|
234 |
|
|
|
235 |
|
|
/* Every program on cygwin links against cygwin1.dll which contains
|
236 |
|
|
the pthread routines. There is no need to explicitly link them
|
237 |
|
|
and the -pthread flag is not recognized. */
|
238 |
|
|
#undef GOMP_SELF_SPECS
|
239 |
|
|
#define GOMP_SELF_SPECS ""
|