mingw32.h revision 117395
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, 2002, 2003 4 Free Software Foundation, Inc. 5 6This file is part of GNU CC. 7 8GNU CC is free software; you can redistribute it and/or modify 9it under the terms of the GNU General Public License as published by 10the Free Software Foundation; either version 2, or (at your option) 11any later version. 12 13GNU CC is distributed in the hope that it will be useful, 14but WITHOUT ANY WARRANTY; without even the implied warranty of 15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16GNU General Public License for more details. 17 18You should have received a copy of the GNU General Public License 19along with GNU CC; see the file COPYING. If not, write to 20the Free Software Foundation, 59 Temple Place - Suite 330, 21Boston, MA 02111-1307, USA. */ 22 23/* Most of this is the same as for cygwin, except for changing some 24 specs. */ 25 26/* Mingw GCC, unlike Cygwin's, must be relocatable. This macro must 27 be defined before any other files are included. */ 28#ifndef WIN32_NO_ABSOLUTE_INST_DIRS 29#define WIN32_NO_ABSOLUTE_INST_DIRS 1 30#endif 31 32#include "i386/cygwin.h" 33 34#define TARGET_EXECUTABLE_SUFFIX ".exe" 35 36/* See i386/crtdll.h for an altervative definition. */ 37#define EXTRA_OS_CPP_BUILTINS() \ 38 do \ 39 { \ 40 builtin_define ("__MSVCRT__"); \ 41 builtin_define ("__MINGW32__"); \ 42 } \ 43 while (0) 44 45#undef TARGET_OS_CPP_BUILTINS /* From cygwin.h. */ 46#define TARGET_OS_CPP_BUILTINS() \ 47 do \ 48 { \ 49 builtin_define ("_WIN32"); \ 50 builtin_define_std ("WIN32"); \ 51 builtin_define_std ("WINNT"); \ 52 builtin_define ("_X86_=1"); \ 53 builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ 54 builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ 55 builtin_define ("__declspec(x)=__attribute__((x))"); \ 56 if (!flag_iso) \ 57 { \ 58 builtin_define ("_stdcall=__attribute__((__stdcall__))"); \ 59 builtin_define ("_cdecl=__attribute__((__cdecl__))"); \ 60 } \ 61 EXTRA_OS_CPP_BUILTINS (); \ 62 builtin_assert ("system=winnt"); \ 63 } \ 64 while (0) 65 66/* Specific a different directory for the standard include files. */ 67#undef STANDARD_INCLUDE_DIR 68#define STANDARD_INCLUDE_DIR "/usr/local/mingw32/include" 69#undef STANDARD_INCLUDE_COMPONENT 70#define STANDARD_INCLUDE_COMPONENT "MINGW" 71 72#undef CPP_SPEC 73#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}" 74 75/* For Windows applications, include more libraries, but always include 76 kernel32. */ 77#undef LIB_SPEC 78#define LIB_SPEC "%{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} \ 79 -luser32 -lkernel32 -ladvapi32 -lshell32" 80 81/* Include in the mingw32 libraries with libgcc */ 82#undef LINK_SPEC 83#define LINK_SPEC "%{mwindows:--subsystem windows} \ 84 %{mconsole:--subsystem console} \ 85 %{shared: %{mdll: %eshared and mdll are not compatible}} \ 86 %{shared: --shared} %{mdll:--dll} \ 87 %{static:-Bstatic} %{!static:-Bdynamic} \ 88 %{shared|mdll: -e _DllMainCRTStartup@12}" 89 90/* Include in the mingw32 libraries with libgcc */ 91#undef LIBGCC_SPEC 92#define LIBGCC_SPEC \ 93 "%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt" 94 95#undef STARTFILE_SPEC 96#define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \ 97 %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s}" 98 99/* MS runtime does not need a separate math library. */ 100#undef MATH_LIBRARY 101#define MATH_LIBRARY "" 102 103/* Output STRING, a string representing a filename, to FILE. 104 We canonicalize it to be in Unix format (backslashe are replaced 105 forward slashes. */ 106#undef OUTPUT_QUOTED_STRING 107#define OUTPUT_QUOTED_STRING(FILE, STRING) \ 108do { \ 109 char c; \ 110 \ 111 putc ('\"', asm_file); \ 112 \ 113 while ((c = *string++) != 0) \ 114 { \ 115 if (c == '\\') \ 116 c = '/'; \ 117 \ 118 if (ISPRINT (c)) \ 119 { \ 120 if (c == '\"') \ 121 putc ('\\', asm_file); \ 122 putc (c, asm_file); \ 123 } \ 124 else \ 125 fprintf (asm_file, "\\%03o", (unsigned char) c); \ 126 } \ 127 \ 128 putc ('\"', asm_file); \ 129} while (0) 130 131/* Define as short unsigned for compatability with MS runtime. */ 132#undef WINT_TYPE 133#define WINT_TYPE "short unsigned int" 134