uwin.h revision 117395
1259262Stijl/* Operating system specific defines to be used when targeting GCC for
295060Sjmallett   hosting on U/WIN (Windows32), using GNU tools and the Windows32 API
395060Sjmallett   Library, as distinct from winnt.h, which is used to build GCC for use
41590Srgrimes   with a windows style library and tool set and uses the Microsoft tools.
51590Srgrimes   Copyright (C) 1999, 2002 Free Software Foundation, Inc.
61590Srgrimes   Contributed by Mumit Khan  <khan@xraylith.wisc.edu>.
71590Srgrimes
81590SrgrimesThis file is part of GNU CC.
91590Srgrimes
101590SrgrimesGNU CC is free software; you can redistribute it and/or modify
111590Srgrimesit under the terms of the GNU General Public License as published by
121590Srgrimesthe Free Software Foundation; either version 2, or (at your option)
131590Srgrimesany later version.
141590Srgrimes
151590SrgrimesGNU CC is distributed in the hope that it will be useful,
161590Srgrimesbut WITHOUT ANY WARRANTY; without even the implied warranty of
171590SrgrimesMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
181590SrgrimesGNU General Public License for more details.
19259262Stijl
201590SrgrimesYou should have received a copy of the GNU General Public License
211590Srgrimesalong with GNU CC; see the file COPYING.  If not, write to
221590Srgrimesthe Free Software Foundation, 59 Temple Place - Suite 330,
231590SrgrimesBoston, MA 02111-1307, USA.  */
241590Srgrimes
251590Srgrimes/* Most of this is the same as for Cygwin32, except for changing some
261590Srgrimes   specs.  */
271590Srgrimes
281590Srgrimes#define STANDARD_INCLUDE_COMPONENT "UWIN"
291590Srgrimes#define SYSTEM_INCLUDE_DIR "/usr/gnu/include"
301590Srgrimes#undef MD_STARTFILE_PREFIX
311590Srgrimes#define MD_STARTFILE_PREFIX "/usr/gnu/lib/"
321590Srgrimes
331590Srgrimes#undef MAYBE_UWIN_CPP_BUILTINS
341590Srgrimes#define MAYBE_UWIN_CPP_BUILTINS()			\
351590Srgrimes  do							\
3695060Sjmallett    {							\
371590Srgrimes	builtin_define_std ("WINNT");			\
381590Srgrimes	builtin_define ("_WIN32");			\
391590Srgrimes	builtin_define ("__WIN32__");			\
401590Srgrimes	builtin_define ("_UWIN");			\
411590Srgrimes	builtin_define ("__UWIN__");			\
421590Srgrimes	builtin_define ("__MSVCRT__");			\
431590Srgrimes	builtin_define ("_STD_INCLUDE_DIR=mingw32");	\
441590Srgrimes    }							\
451590Srgrimes  while (0)
461590Srgrimes
471590Srgrimes#undef CPP_SPEC
48100014Sjmallett#define CPP_SPEC "-remap %{posix:-D_POSIX_SOURCE} \
49100014Sjmallett  -include /usr/include/astwin32.h \
50100014Sjmallett  -idirafter /usr/gnu/include/mingw32"
511590Srgrimes
521590Srgrimes/* For Windows applications, include more libraries, but always include
531590Srgrimes   kernel32.  */
541590Srgrimes#undef LIB_SPEC
551590Srgrimes#define LIB_SPEC \
561590Srgrimes  "%{pg:-lgmon} %{mwindows:-luser32 -lgdi32 -lcomdlg32} -lkernel32 -ladvapi32"
57
58/* This is needed in g77spec.c for now. Will be removed in the future.  */
59#define WIN32_UWIN_TARGET 1
60
61/* Include in the mingw32 libraries with libgcc */
62#undef LIBGCC_SPEC
63#define LIBGCC_SPEC "-lgnuwin -lposix -lgcc -last -lmoldname -lmsvcrt"
64
65/* Specify a different entry point when linking a DLL */
66#undef LINK_SPEC
67#define LINK_SPEC \
68  "%{mwindows:--subsystem windows} %{mdll:--dll -e _DllMainCRTStartup@12} \
69  %{!mdll:-u _main}"
70
71#undef STARTFILE_SPEC
72#define STARTFILE_SPEC "%{mdll:dllcrt2%O%s} %{!mdll:crt2%O%s} %{pg:gcrt2%O%s}"
73
74/* These are PE BFD bug workarounds. Should go away eventually.  */
75
76/* Write the extra assembler code needed to declare a function
77   properly.  If we are generating SDB debugging information, this
78   will happen automatically, so we only need to handle other cases.  */
79#undef ASM_DECLARE_FUNCTION_NAME
80#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)			\
81  do									\
82    {									\
83      if (i386_pe_dllexport_name_p (NAME))				\
84	i386_pe_record_exported_symbol (NAME, 0);			\
85      /* UWIN binutils bug workaround.  */				\
86      if (0 && write_symbols != SDB_DEBUG)				\
87	i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL));	\
88      ASM_OUTPUT_LABEL (FILE, NAME);					\
89    }									\
90  while (0)
91
92#undef ASM_OUTPUT_EXTERNAL
93#undef ASM_OUTPUT_EXTERNAL_LIBCALL
94
95/* Override Cygwin's definition. This is necessary now due to the way
96   Cygwin profiling code is written. Once "fixed", we can remove this.  */
97#undef SUBTARGET_PROLOGUE
98
99