1 /* Support for various Windows compilation environments.
2 Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation,
5 This file is part of GNU Wget.
7 GNU Wget is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 GNU Wget is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Wget. If not, see <http://www.gnu.org/licenses/>.
20 Additional permission under GNU GPL version 3 section 7
22 If you modify this program, or any covered work, by linking or
23 combining it with the OpenSSL project's OpenSSL library (or a
24 modified version of that library), containing parts covered by the
25 terms of the OpenSSL or SSLeay licenses, the Free Software Foundation
26 grants you additional permission to convey the resulting work.
27 Corresponding Source for a non-source form of such a combination
28 shall include the source code for the parts of OpenSSL used as well
29 as that of the covered work. */
32 /* This file contains information about various compilers used to
33 build Wget on the Windows platform using its "native" API,
34 sometimes referred to as "Win32". (This excludes Cygwin, which
35 defines a Unix-compatible layer and is handled with configure.)
37 The above "information about compilers" includes both actual
38 differences in compilers (such as how to construct 64-bit constants
39 or whether C99 `bool' is available) and the properties of the
40 compilation environment and run-time library shipped with the
41 compiler (such as whether stat handles large files or whether
44 The file is divided into sections for each compiler/environment.
45 Being based on free software, MinGW's section comes first and
46 contains most of the explanatory comments. Things that apply to
47 *all* compilers, as well as things that are specific to Wget,
48 belong in src/mswindows.h. */
50 /* -------------------- */
51 /* MinGW (GCC) section. */
52 /* -------------------- */
53 #if defined __MINGW32__
55 #define OS_TYPE "Windows-MinGW"
59 /* Transparently support statting large files, like POSIX's LFS API
60 does, by aliasing stat and fstat to their equivalents that do LFS.
61 Most Windows compilers we support use _stati64 (but have different
62 names for 2nd argument type, see below), so we use that. */
63 #define stat_alias _stati64
64 #define fstat_alias _fstati64
66 /* On Windows the 64-bit stat requires an explicitly different type
67 for the 2nd argument, so we define a struct_stat macro that expands
68 to the appropriate type on Windows, and to the regular struct stat
71 Note that Borland C 5.5 has 64-bit stat (_stati64), but not a
72 64-bit fstat! Because of that we also need a struct_fstat that
73 points to struct_stat on Unix and on Windows, except under Borland,
74 where it points to the 32-bit struct stat. */
76 #define struct_stat struct _stati64
77 #define struct_fstat struct _stati64
79 /* MinGW 3.7 (or older) prototypes gai_strerror(), but is missing
80 from all import libraries. */
82 # define NEED_GAI_STRERROR
85 /* MinGW and GCC support some POSIX and C99 features. */
86 #define HAVE_INTTYPES_H 1
87 #define HAVE_STDINT_H 1
90 #undef SIZEOF_LONG_LONG /* avoid redefinition warning */
91 #define SIZEOF_LONG_LONG 8
92 #define HAVE_INTPTR_T 1
93 #define HAVE_UINTPTR_T 1
94 #define HAVE_STRTOLL 1
96 /* MingW needs _WIN32_WINNT==0x0501 defined to pull in getaddrinfo()
97 * and freeaddrinfo() etc.
99 #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0501)
101 #define _WIN32_WINNT 0x0501
105 /* -------------------- */
106 /* MS Visual C section. */
107 /* -------------------- */
108 #elif defined _MSC_VER
110 #define OS_TYPE "Windows-MSVC"
114 #define stat_alias _stati64
115 #define fstat_alias _fstati64
116 #define struct_stat struct _stati64
117 #define struct_fstat struct _stati64
119 #define isatty _isatty
122 # define HAVE__STRTOI64 1
126 #define HAVE_INTPTR_T 1
127 #define HAVE_UINTPTR_T 1
131 #pragma warning ( disable : 4996 )
132 #define _CRT_SECURE_NO_DEPRECATE
133 #define _CRT_SECURE_NO_WARNINGS
137 #undef HAVE_UTIME_H /* no <utime.h> */
140 /* ------------------ */
141 /* Borland C section. */
142 /* ------------------ */
143 #elif defined __BORLANDC__
145 #define OS_TYPE "Windows-Borland"
149 #define stat_alias _stati64
151 #define struct_stat struct stati64
154 /* ------------------------------ */
155 /* Digital Mars Compiler section. */
156 /* ------------------------------ */
157 #elif defined __DMC__
159 #define OS_TYPE "Windows-DMC"
163 /* DMC supports 64-bit types, including long long, but not statting
167 /* If left undefined, sysdep.h will define these to struct stat. */
171 /* DMC's runtime supports some POSIX and C99 headers, types, and
172 functions that we use. */
174 #define HAVE_STDINT_H 1
175 #define HAVE_INTTYPES_H 1
176 #define HAVE_STDBOOL_H 1
178 #define HAVE_UINT32_T 1
179 #define HAVE_UINTPTR_T 1
180 #define HAVE_INTPTR_T 1
182 #undef SIZEOF_LONG_LONG
183 #define SIZEOF_LONG_LONG 8
186 #define HAVE_USLEEP 1
187 #define HAVE_STRTOLL 1
188 #undef HAVE_UTIME_H /* no <utime.h> */
191 /* -------------------- */
192 /* OpenWatcom section. */
193 /* -------------------- */
194 #elif defined __WATCOMC__
196 #define OS_TYPE "Windows-Watcom"
200 #define stat_alias _stati64
201 #define fstat_alias _fstati64
202 #define struct_stat struct _stati64
203 #define struct_fstat struct _stati64
206 # define NEED_GAI_STRERROR
209 #define HAVE_STDINT_H 1
210 #define HAVE_INTTYPES_H 1
212 /* OpenWatcom 1.6 do have <stdbool.h>, but definition of '_Bool' is missing! */
213 /* This was fixed in OpenWatcom 1.7 */
214 #if __WATCOMC__ >= 1270
215 #define HAVE_STDBOOL_H 1
219 #define HAVE_STRTOLL 1
220 #define HAVE_UINT32_T 1
222 #undef socklen_t /* avoid clash with <ws2tcpip.h> */
224 #undef SIZEOF_LONG_LONG
225 #define SIZEOF_LONG_LONG 8
227 /* OpenWatcom needs _WIN32_WINNT==0x0501 defined to pull in getaddrinfo()
228 * and freeaddrinfo() etc.
230 #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0501)
232 #define _WIN32_WINNT 0x0501
237 # error Your compiler is not supported.