1 /* Support for various Windows compilation environments.
2 Copyright (C) 2005, 2007 Free Software Foundation, Inc.
4 This file is part of GNU Wget.
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.
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.
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/>.
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. */
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.)
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
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. */
48 /* -------------------- */
49 /* MinGW (GCC) section. */
50 /* -------------------- */
51 #if defined __MINGW32__
53 #define OS_TYPE "Windows-MinGW"
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
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
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. */
74 #define struct_stat struct _stati64
75 #define struct_fstat struct _stati64
77 /* MinGW 3.7 (or older) prototypes gai_strerror(), but is missing
78 from all import libraries. */
80 # define NEED_GAI_STRERROR
83 /* MinGW and GCC support some POSIX and C99 features. */
84 #define HAVE_INTTYPES_H 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
93 /* MingW needs _WIN32_WINNT==0x0501 defined to pull in getaddrinfo()
94 * and freeaddrinfo() etc.
96 #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0501)
98 #define _WIN32_WINNT 0x0501
102 /* -------------------- */
103 /* MS Visual C section. */
104 /* -------------------- */
105 #elif defined _MSC_VER
107 #define OS_TYPE "Windows-MSVC"
111 #define stat_alias _stati64
112 #define fstat_alias _fstati64
113 #define struct_stat struct _stati64
114 #define struct_fstat struct _stati64
116 #define isatty _isatty
119 # define HAVE__STRTOI64 1
123 #define HAVE_INTPTR_T 1
124 #define HAVE_UINTPTR_T 1
128 #pragma warning ( disable : 4996 )
129 #define _CRT_SECURE_NO_DEPRECATE
133 #undef HAVE_UTIME_H /* no <utime.h> */
136 /* ------------------ */
137 /* Borland C section. */
138 /* ------------------ */
139 #elif defined __BORLANDC__
141 #define OS_TYPE "Windows-Borland"
145 #define stat_alias _stati64
147 #define struct_stat struct stati64
150 /* ------------------------------ */
151 /* Digital Mars Compiler section. */
152 /* ------------------------------ */
153 #elif defined __DMC__
155 #define OS_TYPE "Windows-DMC"
159 /* DMC supports 64-bit types, including long long, but not statting
163 /* If left undefined, sysdep.h will define these to struct stat. */
167 /* DMC's runtime supports some POSIX and C99 headers, types, and
168 functions that we use. */
170 #define HAVE_STDINT_H 1
171 #define HAVE_INTTYPES_H 1
172 #define HAVE_STDBOOL_H 1
174 #define HAVE_UINT32_T 1
175 #define HAVE_UINTPTR_T 1
176 #define HAVE_INTPTR_T 1
178 #undef SIZEOF_LONG_LONG
179 #define SIZEOF_LONG_LONG 8
182 #define HAVE_USLEEP 1
183 #define HAVE_STRTOLL 1
184 #undef HAVE_UTIME_H /* no <utime.h> */
187 /* -------------------- */
188 /* OpenWatcom section. */
189 /* -------------------- */
190 #elif defined __WATCOMC__
192 #define OS_TYPE "Windows-Watcom"
196 #define stat_alias _stati64
197 #define fstat_alias _fstati64
198 #define struct_stat struct _stati64
199 #define struct_fstat struct _stati64
202 # define NEED_GAI_STRERROR
205 #define HAVE_STDINT_H 1
206 #define HAVE_INTTYPES_H 1
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
213 #undef socklen_t /* avoid clash with <ws2tcpip.h> */
215 #undef SIZEOF_LONG_LONG
216 #define SIZEOF_LONG_LONG 8
218 /* OpenWatcom needs _WIN32_WINNT==0x0501 defined to pull in getaddrinfo()
219 * and freeaddrinfo() etc.
221 #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0501)
223 #define _WIN32_WINNT 0x0501
228 # error Your compiler is not supported.