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)
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 #define TARGET_VERSION fprintf (stderr, " (x86 Cygwin)");
25 #define EXTRA_OS_CPP_BUILTINS() /* Nothing. */
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}}\
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}\
44 #define ENDFILE_SPEC \
45 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}\
48 /* Normally, -lgcc is not needed since everything in it is in the DLL, but we
49 want to allow things to be added to it when installing new versions of
50 GCC without making a new CYGWIN.DLL, so we leave it. Profiling is handled
51 by calling the init function from main. */
55 "%{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} -lgcc \
56 %{mno-cygwin:-lmoldname -lmingwex -lmsvcrt}"
58 /* We have to dynamic link to get to the system DLLs. All of libc, libm and
59 the Unix stuff is in cygwin.dll. The import library is called
60 'libcygwin.a'. For Windows applications, include more libraries, but
61 always include kernel32. We'd like to specific subsystem windows to
62 ld, but that doesn't work just yet. */
67 %{!mno-cygwin:-lcygwin} \
68 %{mno-cygwin:%{mthreads:-lmingwthrd} -lmingw32} \
69 %{mwindows:-lgdi32 -lcomdlg32} \
70 -luser32 -lkernel32 -ladvapi32 -lshell32"
73 %{mwindows:--subsystem windows} \
74 %{mconsole:--subsystem console} \
75 %{shared: %{mdll: %eshared and mdll are not compatible}} \
76 %{shared: --shared} %{mdll:--dll} \
77 %{static:-Bstatic} %{!static:-Bdynamic} \
79 %{mno-cygwin:_DllMainCRTStartup@12} \
80 %{!mno-cygwin:__cygwin_dll_entry@12}}\
81 %{!mno-cygwin:--dll-search-prefix=cyg}"
83 /* Allocate space for all of the machine-spec-specific stuff.
84 Allocate enough space for cygwin -> mingw32 munging plus
85 possible addition of "/mingw". */
87 #ifndef CYGWIN_MINGW_SUBDIR
88 #define CYGWIN_MINGW_SUBDIR "/mingw"
90 #define CYGWIN_MINGW_SUBDIR_LEN (sizeof (CYGWIN_MINGW_SUBDIR) - 1)
92 #ifdef GPLUSPLUS_INCLUDE_DIR
93 char cygwin_gplusplus_include_dir[sizeof (GPLUSPLUS_INCLUDE_DIR) + 1
94 + (CYGWIN_MINGW_SUBDIR_LEN)]
95 = GPLUSPLUS_INCLUDE_DIR;
96 #undef GPLUSPLUS_INCLUDE_DIR
97 #define GPLUSPLUS_INCLUDE_DIR ((const char *) cygwin_gplusplus_include_dir)
103 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
104 char cygwin_gplusplus_tool_include_dir[sizeof (GPLUSPLUS_TOOL_INCLUDE_DIR) + 1
105 + CYGWIN_MINGW_SUBDIR_LEN]
106 = GPLUSPLUS_TOOL_INCLUDE_DIR;
107 #undef GPLUSPLUS_TOOL_INCLUDE_DIR
108 #define GPLUSPLUS_TOOL_INCLUDE_DIR ((const char *) cygwin_gplusplus_tool_include_dir)
109 #ifndef GEN_CVT_ARRAY
110 #define GEN_CVT_ARRAY
114 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
115 char cygwin_gplusplus_backward_include_dir[sizeof (GPLUSPLUS_BACKWARD_INCLUDE_DIR) + 1
116 + CYGWIN_MINGW_SUBDIR_LEN]
117 = GPLUSPLUS_BACKWARD_INCLUDE_DIR;
118 #undef GPLUSPLUS_BACKWARD_INCLUDE_DIR
119 #define GPLUSPLUS_BACKWARD_INCLUDE_DIR ((const char *) cygwin_gplusplus_backward_include_dir)
120 #ifndef GEN_CVT_ARRAY
121 #define GEN_CVT_ARRAY
125 #ifdef LOCAL_INCLUDE_DIR
126 char cygwin_local_include_dir[sizeof (LOCAL_INCLUDE_DIR) + 1
127 + CYGWIN_MINGW_SUBDIR_LEN]
129 #undef LOCAL_INCLUDE_DIR
130 #define LOCAL_INCLUDE_DIR ((const char *) cygwin_local_include_dir)
131 #ifndef GEN_CVT_ARRAY
132 #define GEN_CVT_ARRAY
136 #ifdef CROSS_INCLUDE_DIR
137 char cygwin_cross_include_dir[sizeof (CROSS_INCLUDE_DIR) + 1
138 + CYGWIN_MINGW_SUBDIR_LEN]
140 #undef CROSS_INCLUDE_DIR
141 #define CROSS_INCLUDE_DIR ((const char *) cygwin_cross_include_dir)
142 #ifndef GEN_CVT_ARRAY
143 #define GEN_CVT_ARRAY
147 #ifdef TOOL_INCLUDE_DIR
148 char cygwin_tool_include_dir[sizeof (TOOL_INCLUDE_DIR) + 1
149 + CYGWIN_MINGW_SUBDIR_LEN]
151 #undef TOOL_INCLUDE_DIR
152 #define TOOL_INCLUDE_DIR ((const char *) cygwin_tool_include_dir)
154 #ifndef CROSS_DIRECTORY_STRUCTURE
155 #undef STANDARD_INCLUDE_DIR
156 #define STANDARD_INCLUDE_DIR "/usr/include"
157 char cygwin_standard_include_dir[sizeof (STANDARD_INCLUDE_DIR) + 1
158 + CYGWIN_MINGW_SUBDIR_LEN]
159 = STANDARD_INCLUDE_DIR;
160 #undef STANDARD_INCLUDE_DIR
161 #define STANDARD_INCLUDE_DIR ((const char *) cygwin_standard_include_dir)
164 #ifndef GEN_CVT_ARRAY
165 #define GEN_CVT_ARRAY
169 #ifndef GEN_CVT_ARRAY
170 extern char *cvt_to_mingw[];
172 char *cvt_to_mingw[] =
174 #ifdef GPLUSPLUS_INCLUDE_DIR
175 cygwin_gplusplus_include_dir,
178 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
179 cygwin_gplusplus_tool_include_dir,
182 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
183 cygwin_gplusplus_backward_include_dir,
186 #ifdef LOCAL_INCLUDE_DIR
187 cygwin_local_include_dir,
190 #ifdef CROSS_INCLUDE_DIR
191 cygwin_cross_include_dir,
194 #ifdef TOOL_INCLUDE_DIR
195 cygwin_tool_include_dir,
198 #ifdef STANDARD_INCLUDE_DIR
199 cygwin_standard_include_dir,
205 #endif /*GEN_CVT_ARRAY*/
207 void mingw_scan (int, const char * const *, char **);
209 #define GCC_DRIVER_HOST_INITIALIZATION \
212 mingw_scan(argc, (const char * const *) argv, (char **) &spec_machine); \
216 #define GCC_DRIVER_HOST_INITIALIZATION \
219 char *cprefix = concat (tooldir_base_prefix, spec_machine, \
220 dir_separator_str, NULL); \
221 if (!IS_ABSOLUTE_PATH (cprefix)) \
222 cprefix = concat (standard_exec_prefix, spec_machine, dir_separator_str, \
223 spec_version, dir_separator_str, tooldir_prefix, NULL); \
224 add_prefix (&exec_prefixes,\
225 concat (cprefix, "../../../../", spec_machine, "/bin/", NULL), \
226 "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL); \
227 add_prefix (&exec_prefixes, cprefix, \
228 "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL); \
229 add_prefix (&startfile_prefixes,\
230 concat (standard_startfile_prefix, "w32api", NULL),\
231 "GCC", PREFIX_PRIORITY_LAST, 0, NULL);\
232 mingw_scan(argc, (const char * const *) argv, &spec_machine); \
237 /* Binutils does not handle weak symbols from dlls correctly. For now,
238 do not use them unnecessarily in gthr-posix.h. */
239 #define GTHREAD_USE_WEAK 0
241 /* Every program on cygwin links against cygwin1.dll which contains
242 the pthread routines. There is no need to explicitly link them
243 and the -pthread flag is not recognized. */
244 #undef GOMP_SELF_SPECS
245 #define GOMP_SELF_SPECS ""