]> sjero.net Git - wget/blob - windows/config-compiler.h
Merged with eleven for Gisle's mswindows.c patch.
[wget] / windows / config-compiler.h
1 /* Support for various Windows compilation environments.
2    Copyright (C) 2005, 2007 Free Software Foundation, Inc.
3
4 This file is part of GNU Wget.
5
6 GNU Wget is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 GNU Wget is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Wget.  If not, see <http://www.gnu.org/licenses/>.
18
19 In addition, as a special exception, the Free Software Foundation
20 gives permission to link the code of its release of Wget with the
21 OpenSSL project's "OpenSSL" library (or with modified versions of it
22 that use the same license as the "OpenSSL" library), and distribute
23 the linked executables.  You must obey the GNU General Public License
24 in all respects for all of the code used other than "OpenSSL".  If you
25 modify this file, you may extend this exception to your version of the
26 file, but you are not obligated to do so.  If you do not wish to do
27 so, delete this exception statement from your version.  */
28
29
30 /* This file contains information about various compilers used to
31    build Wget on the Windows platform using its "native" API,
32    sometimes referred to as "Win32".  (This excludes Cygwin, which
33    defines a Unix-compatible layer and is handled with configure.)
34
35    The above "information about compilers" includes both actual
36    differences in compilers (such as how to construct 64-bit constants
37    or whether C99 `bool' is available) and the properties of the
38    compilation environment and run-time library shipped with the
39    compiler (such as whether stat handles large files or whether
40    strtoll is present).
41
42    The file is divided into sections for each compiler/environment.
43    Being based on free software, MinGW's section comes first and
44    contains most of the explanatory comments.  Things that apply to
45    *all* compilers, as well as things that are specific to Wget,
46    belong in src/mswindows.h.  */
47 \f
48 /* -------------------- */
49 /* MinGW (GCC) section. */
50 /* -------------------- */
51 #if defined __MINGW32__
52
53 #define OS_TYPE "Windows-MinGW"
54
55 #define LL(n) n##LL
56
57 /* Transparently support statting large files, like POSIX's LFS API
58    does, by aliasing stat and fstat to their equivalents that do LFS.
59    Most Windows compilers we support use _stati64 (but have different
60    names for 2nd argument type, see below), so we use that.  */
61 #define stat_alias _stati64
62 #define fstat_alias _fstati64
63
64 /* On Windows the 64-bit stat requires an explicitly different type
65    for the 2nd argument, so we define a struct_stat macro that expands
66    to the appropriate type on Windows, and to the regular struct stat
67    on Unix.
68
69    Note that Borland C 5.5 has 64-bit stat (_stati64), but not a
70    64-bit fstat!  Because of that we also need a struct_fstat that
71    points to struct_stat on Unix and on Windows, except under Borland,
72    where it points to the 32-bit struct stat.  */
73
74 #define struct_stat struct _stati64
75 #define struct_fstat struct _stati64
76
77 /* MinGW 3.7 (or older) prototypes gai_strerror(), but is missing
78    from all import libraries. */
79 #ifdef ENABLE_IPV6
80 # define NEED_GAI_STRERROR
81 #endif
82
83 /* MinGW and GCC support some POSIX and C99 features.  */
84 #define HAVE_INTTYPES_H 1
85
86 #define HAVE__BOOL 1
87 #undef SIZEOF_LONG_LONG         /* avoid redefinition warning */
88 #define SIZEOF_LONG_LONG 8
89 #define HAVE_INTPTR_T 1
90 #define HAVE_UINTPTR_T 1
91 #define HAVE_STRTOLL 1
92 \f
93 /* MingW needs _WIN32_WINNT==0x0501 defined to pull in getaddrinfo()
94  * and freeaddrinfo() etc.
95  */
96 #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0501)
97 #undef _WIN32_WINNT
98 #define _WIN32_WINNT 0x0501
99 #endif
100
101 \f
102 /* -------------------- */
103 /* MS Visual C section. */
104 /* -------------------- */
105 #elif defined _MSC_VER
106
107 #define OS_TYPE "Windows-MSVC"
108
109 #define LL(n) n##I64
110
111 #define stat_alias _stati64
112 #define fstat_alias _fstati64
113 #define struct_stat struct _stati64
114 #define struct_fstat struct _stati64
115
116 #define isatty _isatty
117
118 #if _MSC_VER >= 1300
119 # define HAVE__STRTOI64 1
120 #endif
121
122 #if _MSC_VER >= 1310
123 #define HAVE_INTPTR_T 1
124 #define HAVE_UINTPTR_T 1
125 #endif
126
127 #if _MSC_VER >= 1400
128 #pragma warning ( disable : 4996 )
129 #define _CRT_SECURE_NO_DEPRECATE
130 #endif
131
132 \f
133 #undef HAVE_UTIME_H         /* no <utime.h> */
134
135 \f
136 /* ------------------ */
137 /* Borland C section. */
138 /* ------------------ */
139 #elif defined __BORLANDC__
140
141 #define OS_TYPE "Windows-Borland"
142
143 #define LL(n) n##I64
144
145 #define stat_alias _stati64
146 #undef fstat_alias
147 #define struct_stat struct stati64
148 #undef struct_fstat
149 \f
150 /* ------------------------------ */
151 /* Digital Mars Compiler section. */
152 /* ------------------------------ */
153 #elif defined __DMC__
154
155 #define OS_TYPE "Windows-DMC"
156
157 #define LL(n) n##LL
158
159 /* DMC supports 64-bit types, including long long, but not statting
160    large files.  */
161 #undef stat_alias
162 #undef fstat_alias
163 /* If left undefined, sysdep.h will define these to struct stat. */
164 #undef struct_stat
165 #undef struct_fstat
166
167 /* DMC's runtime supports some POSIX and C99 headers, types, and
168    functions that we use.  */
169
170 #define HAVE_STDINT_H 1
171 #define HAVE_INTTYPES_H 1
172 #define HAVE_STDBOOL_H 1
173
174 #define HAVE_UINT32_T 1
175 #define HAVE_UINTPTR_T 1
176 #define HAVE_INTPTR_T 1
177
178 #undef SIZEOF_LONG_LONG
179 #define SIZEOF_LONG_LONG 8
180 #define HAVE__BOOL 1
181
182 #define HAVE_USLEEP 1
183 #define HAVE_STRTOLL 1
184 #undef HAVE_UTIME_H         /* no <utime.h> */
185
186 \f
187 /* -------------------- */
188 /* OpenWatcom section.  */
189 /* -------------------- */
190 #elif defined __WATCOMC__
191
192 #define OS_TYPE "Windows-Watcom"
193
194 #define LL(n) n##LL
195
196 #define stat_alias _stati64
197 #define fstat_alias _fstati64
198 #define struct_stat struct _stati64
199 #define struct_fstat struct _stati64
200
201 #ifdef ENABLE_IPV6
202 # define NEED_GAI_STRERROR
203 #endif
204
205 #define HAVE_STDINT_H 1
206 #define HAVE_INTTYPES_H 1
207
208 /* Watcom 1.6 do have <stdbool.h>, but definition of '_Bool' is missing! */
209 /* #define HAVE_STDBOOL_H 1 */
210 #define HAVE_STRTOLL 1
211 #define HAVE_UINT32_T 1
212 #undef HAVE_UTIME_H
213 #undef socklen_t                /* avoid clash with <ws2tcpip.h> */
214
215 #undef SIZEOF_LONG_LONG
216 #define SIZEOF_LONG_LONG 8
217
218 /* OpenWatcom needs _WIN32_WINNT==0x0501 defined to pull in getaddrinfo()
219  * and freeaddrinfo() etc.
220  */
221 #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0501)
222 #undef _WIN32_WINNT
223 #define _WIN32_WINNT 0x0501
224 #endif
225
226 \f
227 #else
228 # error Your compiler is not supported.
229 #endif