]> sjero.net Git - wget/blob - windows/config-compiler.h
[svn] Merge of fix for bugs 20341 and 20410.
[wget] / windows / config-compiler.h
1 /* Support for various Windows compilation environments.
2    Copyright (C) 2005 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 >= 1400
123 #pragma warning ( disable : 4996 )
124 #define _CRT_SECURE_NO_DEPRECATE
125 #endif
126 \f
127 #undef HAVE_UTIME_H         /* no <utime.h> */
128
129 \f
130 /* ------------------ */
131 /* Borland C section. */
132 /* ------------------ */
133 #elif defined __BORLANDC__
134
135 #define OS_TYPE "Windows-Borland"
136
137 #define LL(n) n##I64
138
139 #define stat_alias _stati64
140 #undef fstat_alias
141 #define struct_stat struct stati64
142 #undef struct_fstat
143 \f
144 /* ------------------------------ */
145 /* Digital Mars Compiler section. */
146 /* ------------------------------ */
147 #elif defined __DMC__
148
149 #define OS_TYPE "Windows-DMC"
150
151 #define LL(n) n##LL
152
153 /* DMC supports 64-bit types, including long long, but not statting
154    large files.  */
155 #undef stat_alias
156 #undef fstat_alias
157 /* If left undefined, sysdep.h will define these to struct stat. */
158 #undef struct_stat
159 #undef struct_fstat
160
161 /* DMC's runtime supports some POSIX and C99 headers, types, and
162    functions that we use.  */
163
164 #define HAVE_STDINT_H 1
165 #define HAVE_INTTYPES_H 1
166 #define HAVE_STDBOOL_H 1
167
168 #define HAVE_UINT32_T 1
169 #define HAVE_UINTPTR_T 1
170 #define HAVE_INTPTR_T 1
171
172 #undef SIZEOF_LONG_LONG
173 #define SIZEOF_LONG_LONG 8
174 #define HAVE__BOOL 1
175
176 #define HAVE_USLEEP 1
177 #define HAVE_STRTOLL 1
178 #undef HAVE_UTIME_H         /* no <utime.h> */
179
180 \f
181 /* -------------------- */
182 /* OpenWatcom section.  */
183 /* -------------------- */
184 #elif defined __WATCOMC__
185
186 #define OS_TYPE "Windows-Watcom"
187
188 #define LL(n) n##LL
189
190 #define stat_alias _stati64
191 #define fstat_alias _fstati64
192 #define struct_stat struct _stati64
193 #define struct_fstat struct _stati64
194
195 #ifdef ENABLE_IPV6
196 # define NEED_GAI_STRERROR
197 #endif
198
199 #define HAVE_STDINT_H 1
200 #define HAVE_INTTYPES_H 1
201
202 /* Watcom 1.6 do have <stdbool.h>, but definition of '_Bool' is missing! */
203 /* #define HAVE_STDBOOL_H 1 */
204 #define HAVE_STRTOLL 1
205 #define HAVE_UINT32_T 1
206 #undef HAVE_UTIME_H
207 #undef socklen_t                /* avoid clash with <ws2tcpip.h> */
208
209 #undef SIZEOF_LONG_LONG
210 #define SIZEOF_LONG_LONG 8
211
212 /* OpenWatcom needs _WIN32_WINNT==0x0501 defined to pull in getaddrinfo()
213  * and freeaddrinfo() etc.
214  */
215 #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0501)
216 #undef _WIN32_WINNT
217 #define _WIN32_WINNT 0x0501
218 #endif
219
220 \f
221 #else
222 # error Your compiler is not supported.
223 #endif