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