mingw32.h revision 110611
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 Free Software Foundation, Inc.
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING.  If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA.  */
21
22/* Most of this is the same as for cygwin, except for changing some
23   specs.  */
24
25/* Mingw GCC, unlike Cygwin's, must be relocatable. This macro must
26   be defined before any other files are included.  */
27#ifndef WIN32_NO_ABSOLUTE_INST_DIRS
28#define WIN32_NO_ABSOLUTE_INST_DIRS 1
29#endif
30
31#include "i386/cygwin.h"
32
33#define TARGET_EXECUTABLE_SUFFIX ".exe"
34
35/* Please keep changes to CPP_PREDEFINES in sync with i386/crtdll. The
36   only difference between the two should be __MSVCRT__ needed to
37   distinguish MSVC from CRTDLL runtime in mingw headers.  */
38#undef CPP_PREDEFINES
39#define CPP_PREDEFINES "-D_WIN32 -D__WIN32 -D__WIN32__ -DWIN32 \
40  -D__MINGW32__ -D__MSVCRT__ -DWINNT -D_X86_=1 \
41  -Asystem=winnt"
42
43/* Specific a different directory for the standard include files.  */
44#undef STANDARD_INCLUDE_DIR
45#define STANDARD_INCLUDE_DIR "/usr/local/mingw32/include"
46#undef STANDARD_INCLUDE_COMPONENT
47#define STANDARD_INCLUDE_COMPONENT "MINGW"
48
49#undef CPP_SPEC
50#define CPP_SPEC \
51  "-remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} \
52  -D__stdcall=__attribute__((__stdcall__)) \
53  -D__cdecl=__attribute__((__cdecl__)) \
54  %{!ansi:-D_stdcall=__attribute__((__stdcall__)) \
55    -D_cdecl=__attribute__((__cdecl__))} \
56  -D__declspec(x)=__attribute__((x))"
57
58
59/* For Windows applications, include more libraries, but always include
60   kernel32.  */
61#undef LIB_SPEC
62#define LIB_SPEC "%{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} \
63                  -luser32 -lkernel32 -ladvapi32 -lshell32"
64
65/* Include in the mingw32 libraries with libgcc */
66#undef LINK_SPEC
67#define LINK_SPEC "%{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 _DllMainCRTStartup@12}"
73
74/* Include in the mingw32 libraries with libgcc */
75#undef LIBGCC_SPEC
76#define LIBGCC_SPEC \
77  "%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname -lmsvcrt"
78
79#undef STARTFILE_SPEC
80#define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
81  %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s}"
82
83/* MS runtime does not need a separate math library.  */
84#undef MATH_LIBRARY
85#define MATH_LIBRARY ""
86
87/* Output STRING, a string representing a filename, to FILE.
88   We canonicalize it to be in MS-DOS format.  */
89#undef OUTPUT_QUOTED_STRING
90#define OUTPUT_QUOTED_STRING(FILE, STRING) \
91do {						\
92  char c;					\
93						\
94  putc ('\"', asm_file);			\
95						\
96  while ((c = *string++) != 0)			\
97    {						\
98      if (c == '\\')				\
99	c = '/';				\
100						\
101      if (c == '\"')				\
102	putc ('\\', asm_file);			\
103      putc (c, asm_file);			\
104    }						\
105						\
106  putc ('\"', asm_file);			\
107} while (0)
108
109