]> sjero.net Git - wget/blob - windows/config-compiler.h
Fix IPv6 detection under Windows.
[wget] / windows / config-compiler.h
1 /* Support for various Windows compilation environments.
2    Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation,
3    Inc.
4
5 This file is part of GNU Wget.
6
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.
11
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.
16
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/>.
19
20 Additional permission under GNU GPL version 3 section 7
21
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.  */
30
31
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.)
36
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
42    strtoll is present).
43
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.  */
49 \f
50 /* -------------------- */
51 /* MinGW (GCC) section. */
52 /* -------------------- */
53 #if defined __MINGW32__
54
55 #define OS_TYPE "Windows-MinGW"
56
57 #define LL(n) n##LL
58
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
65
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
69    on Unix.
70
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.  */
75
76 #define struct_stat struct _stati64
77 #define struct_fstat struct _stati64
78
79 /* MinGW 3.7 (or older) prototypes gai_strerror(), but is missing
80    from all import libraries. */
81 #ifdef ENABLE_IPV6
82 # define NEED_GAI_STRERROR
83 #endif
84
85 /* MinGW and GCC support some POSIX and C99 features.  */
86 #define HAVE_INTTYPES_H 1
87 #define HAVE_STDINT_H 1
88
89 #define HAVE__BOOL 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
95 \f
96 /* MingW needs _WIN32_WINNT==0x0501 defined to pull in getaddrinfo()
97  * and freeaddrinfo() etc.
98  */
99 #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0501)
100 #undef _WIN32_WINNT
101 #define _WIN32_WINNT 0x0501
102 #endif
103
104 \f
105 /* -------------------- */
106 /* MS Visual C section. */
107 /* -------------------- */
108 #elif defined _MSC_VER
109
110 #define OS_TYPE "Windows-MSVC"
111
112 #define LL(n) n##I64
113
114 #define stat_alias _stati64
115 #define fstat_alias _fstati64
116 #define struct_stat struct _stati64
117 #define struct_fstat struct _stati64
118
119 #define isatty _isatty
120
121 #if _MSC_VER >= 1300
122 # define HAVE__STRTOI64 1
123 #endif
124
125 #if _MSC_VER >= 1310
126 #define HAVE_INTPTR_T 1
127 #define HAVE_UINTPTR_T 1
128 #endif
129
130 #if _MSC_VER >= 1400
131 #pragma warning ( disable : 4996 )
132 #define _CRT_SECURE_NO_DEPRECATE
133 #define _CRT_SECURE_NO_WARNINGS
134 #endif
135
136 \f
137 #undef HAVE_UTIME_H         /* no <utime.h> */
138
139 \f
140 /* ------------------ */
141 /* Borland C section. */
142 /* ------------------ */
143 #elif defined __BORLANDC__
144
145 #define OS_TYPE "Windows-Borland"
146
147 #define LL(n) n##I64
148
149 #define stat_alias _stati64
150 #undef fstat_alias
151 #define struct_stat struct stati64
152 #undef struct_fstat
153 \f
154 /* ------------------------------ */
155 /* Digital Mars Compiler section. */
156 /* ------------------------------ */
157 #elif defined __DMC__
158
159 #define OS_TYPE "Windows-DMC"
160
161 #define LL(n) n##LL
162
163 /* DMC supports 64-bit types, including long long, but not statting
164    large files.  */
165 #undef stat_alias
166 #undef fstat_alias
167 /* If left undefined, sysdep.h will define these to struct stat. */
168 #undef struct_stat
169 #undef struct_fstat
170
171 /* DMC's runtime supports some POSIX and C99 headers, types, and
172    functions that we use.  */
173
174 #define HAVE_STDINT_H 1
175 #define HAVE_INTTYPES_H 1
176 #define HAVE_STDBOOL_H 1
177
178 #define HAVE_UINT32_T 1
179 #define HAVE_UINTPTR_T 1
180 #define HAVE_INTPTR_T 1
181
182 #undef SIZEOF_LONG_LONG
183 #define SIZEOF_LONG_LONG 8
184 #define HAVE__BOOL 1
185
186 #define HAVE_USLEEP 1
187 #define HAVE_STRTOLL 1
188 #undef HAVE_UTIME_H         /* no <utime.h> */
189
190 \f
191 /* -------------------- */
192 /* OpenWatcom section.  */
193 /* -------------------- */
194 #elif defined __WATCOMC__
195
196 #define OS_TYPE "Windows-Watcom"
197
198 #define LL(n) n##LL
199
200 #define stat_alias _stati64
201 #define fstat_alias _fstati64
202 #define struct_stat struct _stati64
203 #define struct_fstat struct _stati64
204
205 #ifdef ENABLE_IPV6
206 # define NEED_GAI_STRERROR
207 #endif
208
209 #define HAVE_STDINT_H 1
210 #define HAVE_INTTYPES_H 1
211
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
216 #define HAVE__BOOL 1
217 #endif
218
219 #define HAVE_STRTOLL 1
220 #define HAVE_UINT32_T 1
221 #undef HAVE_UTIME_H
222 #undef socklen_t                /* avoid clash with <ws2tcpip.h> */
223
224 #undef SIZEOF_LONG_LONG
225 #define SIZEOF_LONG_LONG 8
226
227 /* OpenWatcom needs _WIN32_WINNT==0x0501 defined to pull in getaddrinfo()
228  * and freeaddrinfo() etc.
229  */
230 #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0501)
231 #undef _WIN32_WINNT
232 #define _WIN32_WINNT 0x0501
233 #endif
234
235 \f
236 #else
237 # error Your compiler is not supported.
238 #endif