150397Sobrien/* Operating system specific defines to be used when targeting GCC for 290075Sobrien hosting on Windows32, using GNU tools and the Windows32 API Library. 3169689Skan Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 4117395Skan Free Software Foundation, Inc. 550397Sobrien 6132718SkanThis file is part of GCC. 750397Sobrien 8132718SkanGCC is free software; you can redistribute it and/or modify 950397Sobrienit under the terms of the GNU General Public License as published by 1050397Sobrienthe Free Software Foundation; either version 2, or (at your option) 1150397Sobrienany later version. 1250397Sobrien 13132718SkanGCC is distributed in the hope that it will be useful, 1450397Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 1550397SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1650397SobrienGNU General Public License for more details. 1750397Sobrien 1850397SobrienYou should have received a copy of the GNU General Public License 19132718Skanalong with GCC; see the file COPYING. If not, write to 20169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 21169689SkanBoston, MA 02110-1301, USA. */ 2250397Sobrien 23132718Skan#undef TARGET_VERSION 24132718Skan#define TARGET_VERSION fprintf (stderr, " (x86 MinGW)"); 2550397Sobrien 26132718Skan/* See i386/crtdll.h for an alternative definition. */ 27117395Skan#define EXTRA_OS_CPP_BUILTINS() \ 28117395Skan do \ 29117395Skan { \ 30117395Skan builtin_define ("__MSVCRT__"); \ 31117395Skan builtin_define ("__MINGW32__"); \ 32132718Skan builtin_define ("_WIN32"); \ 33132718Skan builtin_define_std ("WIN32"); \ 34132718Skan builtin_define_std ("WINNT"); \ 35117395Skan } \ 36117395Skan while (0) 3750397Sobrien 38132718Skan/* Override the standard choice of /usr/include as the default prefix 39132718Skan to try when searching for header files. */ 4050397Sobrien#undef STANDARD_INCLUDE_DIR 41132718Skan#define STANDARD_INCLUDE_DIR "/mingw/include" 4290075Sobrien#undef STANDARD_INCLUDE_COMPONENT 4390075Sobrien#define STANDARD_INCLUDE_COMPONENT "MINGW" 4450397Sobrien 4552284Sobrien#undef CPP_SPEC 46117395Skan#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}" 4752284Sobrien 4850397Sobrien/* For Windows applications, include more libraries, but always include 4950397Sobrien kernel32. */ 5050397Sobrien#undef LIB_SPEC 5190075Sobrien#define LIB_SPEC "%{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} \ 5252284Sobrien -luser32 -lkernel32 -ladvapi32 -lshell32" 5350397Sobrien 5450397Sobrien/* Include in the mingw32 libraries with libgcc */ 5590075Sobrien#undef LINK_SPEC 5690075Sobrien#define LINK_SPEC "%{mwindows:--subsystem windows} \ 5790075Sobrien %{mconsole:--subsystem console} \ 5890075Sobrien %{shared: %{mdll: %eshared and mdll are not compatible}} \ 5990075Sobrien %{shared: --shared} %{mdll:--dll} \ 6090075Sobrien %{static:-Bstatic} %{!static:-Bdynamic} \ 6190075Sobrien %{shared|mdll: -e _DllMainCRTStartup@12}" 6290075Sobrien 6390075Sobrien/* Include in the mingw32 libraries with libgcc */ 6450397Sobrien#undef LIBGCC_SPEC 6590075Sobrien#define LIBGCC_SPEC \ 66117395Skan "%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt" 6750397Sobrien 6850397Sobrien#undef STARTFILE_SPEC 6990075Sobrien#define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \ 7090075Sobrien %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s}" 7150397Sobrien 72169689Skan/* Override startfile prefix defaults. */ 73169689Skan#ifndef STANDARD_STARTFILE_PREFIX_1 74169689Skan#define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib/" 75169689Skan#endif 76169689Skan#ifndef STANDARD_STARTFILE_PREFIX_2 77169689Skan#define STANDARD_STARTFILE_PREFIX_2 "" 78169689Skan#endif 7950397Sobrien 8090075Sobrien/* Output STRING, a string representing a filename, to FILE. 81132718Skan We canonicalize it to be in Unix format (backslashes are replaced 82117395Skan forward slashes. */ 8390075Sobrien#undef OUTPUT_QUOTED_STRING 84117395Skan#define OUTPUT_QUOTED_STRING(FILE, STRING) \ 85117395Skando { \ 86117395Skan char c; \ 87117395Skan \ 88117395Skan putc ('\"', asm_file); \ 89117395Skan \ 90117395Skan while ((c = *string++) != 0) \ 91117395Skan { \ 92117395Skan if (c == '\\') \ 93117395Skan c = '/'; \ 94117395Skan \ 95117395Skan if (ISPRINT (c)) \ 96117395Skan { \ 97117395Skan if (c == '\"') \ 98117395Skan putc ('\\', asm_file); \ 99117395Skan putc (c, asm_file); \ 100117395Skan } \ 101117395Skan else \ 102117395Skan fprintf (asm_file, "\\%03o", (unsigned char) c); \ 103117395Skan } \ 104117395Skan \ 105117395Skan putc ('\"', asm_file); \ 10650397Sobrien} while (0) 10750397Sobrien 108132718Skan/* Define as short unsigned for compatibility with MS runtime. */ 109117395Skan#undef WINT_TYPE 110117395Skan#define WINT_TYPE "short unsigned int" 111169689Skan 112169689Skan/* mingw32 uses the -mthreads option to enable thread support. */ 113169689Skan#undef GOMP_SELF_SPECS 114169689Skan#define GOMP_SELF_SPECS "%{fopenmp: -mthreads}" 115