]> sjero.net Git - wget/blobdiff - windows/config-compiler.h
[svn] Merge of fix for bugs 20341 and 20410.
[wget] / windows / config-compiler.h
index 5ce1c9b81a9a58ffbd68b9043fa8d7d1e1ae258d..fbd139bec70ef0540573fca7d997200bde4b26c8 100644 (file)
@@ -5,7 +5,7 @@ This file is part of GNU Wget.
 
 GNU Wget is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 
 GNU Wget is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.
 
 GNU Wget is distributed in the hope that it will be useful,
 (at your option) any later version.
 
 GNU Wget is distributed in the hope that it will be useful,
@@ -14,8 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with Wget; if not, write to the Free Software Foundation, Inc.,
-51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+along with Wget.  If not, see <http://www.gnu.org/licenses/>.
 
 In addition, as a special exception, the Free Software Foundation
 gives permission to link the code of its release of Wget with the
 
 In addition, as a special exception, the Free Software Foundation
 gives permission to link the code of its release of Wget with the
@@ -28,38 +27,39 @@ file, but you are not obligated to do so.  If you do not wish to do
 so, delete this exception statement from your version.  */
 
 
 so, delete this exception statement from your version.  */
 
 
-/* This file contains specifics of various compilers supported on the
-   Windows platform.  In this case "compiler" can refer either to the
-   specific compiler feature (such as how to construct a 64-bit
-   constant) or to a feature of the compilation environment shipped
-   with the compiler.
+/* This file contains information about various compilers used to
+   build Wget on the Windows platform using its "native" API,
+   sometimes referred to as "Win32".  (This excludes Cygwin, which
+   defines a Unix-compatible layer and is handled with configure.)
 
 
-   The file is divided into sections for each compiler.  Most of the
-   explanatory comments are in the first (MinGW) section to avoid
-   repetition.
+   The above "information about compilers" includes both actual
+   differences in compilers (such as how to construct 64-bit constants
+   or whether C99 `bool' is available) and the properties of the
+   compilation environment and run-time library shipped with the
+   compiler (such as whether stat handles large files or whether
+   strtoll is present).
 
 
-   Things that apply to *all* compilers, as well as things that are
-   specific to Wget, belong in src/mswindows.h.  */
-
-/* For all compilers: must include <sys/stat.h> before redefining
-   stat.  */
-
-#include <sys/stat.h>
+   The file is divided into sections for each compiler/environment.
+   Being based on free software, MinGW's section comes first and
+   contains most of the explanatory comments.  Things that apply to
+   *all* compilers, as well as things that are specific to Wget,
+   belong in src/mswindows.h.  */
 \f
 /* -------------------- */
 /* MinGW (GCC) section. */
 /* -------------------- */
 \f
 /* -------------------- */
 /* MinGW (GCC) section. */
 /* -------------------- */
-#if defined __GNUC__
+#if defined __MINGW32__
 
 #define OS_TYPE "Windows-MinGW"
 
 #define LL(n) n##LL
 
 /* Transparently support statting large files, like POSIX's LFS API
 
 #define OS_TYPE "Windows-MinGW"
 
 #define LL(n) n##LL
 
 /* Transparently support statting large files, like POSIX's LFS API
-   does.  All Windows compilers we support use _stati64 (but have
-   different names for 2nd argument type, see below), so we use
-   that.  */
-#define stat(fname, buf) _stati64 (fname, buf)
+   does, by aliasing stat and fstat to their equivalents that do LFS.
+   Most Windows compilers we support use _stati64 (but have different
+   names for 2nd argument type, see below), so we use that.  */
+#define stat_alias _stati64
+#define fstat_alias _fstati64
 
 /* On Windows the 64-bit stat requires an explicitly different type
    for the 2nd argument, so we define a struct_stat macro that expands
 
 /* On Windows the 64-bit stat requires an explicitly different type
    for the 2nd argument, so we define a struct_stat macro that expands
@@ -77,9 +77,27 @@ so, delete this exception statement from your version.  */
 /* MinGW 3.7 (or older) prototypes gai_strerror(), but is missing
    from all import libraries. */
 #ifdef ENABLE_IPV6
 /* MinGW 3.7 (or older) prototypes gai_strerror(), but is missing
    from all import libraries. */
 #ifdef ENABLE_IPV6
-# undef gai_strerror
-# define gai_strerror windows_strerror
+# define NEED_GAI_STRERROR
+#endif
+
+/* MinGW and GCC support some POSIX and C99 features.  */
+#define HAVE_INTTYPES_H 1
+
+#define HAVE__BOOL 1
+#undef SIZEOF_LONG_LONG                /* avoid redefinition warning */
+#define SIZEOF_LONG_LONG 8
+#define HAVE_INTPTR_T 1 
+#define HAVE_UINTPTR_T 1
+#define HAVE_STRTOLL 1
+\f
+/* MingW needs _WIN32_WINNT==0x0501 defined to pull in getaddrinfo()
+ * and freeaddrinfo() etc.
+ */
+#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0501)
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0501
 #endif
 #endif
+
 \f
 /* -------------------- */
 /* MS Visual C section. */
 \f
 /* -------------------- */
 /* MS Visual C section. */
@@ -90,11 +108,24 @@ so, delete this exception statement from your version.  */
 
 #define LL(n) n##I64
 
 
 #define LL(n) n##I64
 
-#define stat(fname, buf) _stati64 (fname, buf)
+#define stat_alias _stati64
+#define fstat_alias _fstati64
 #define struct_stat struct _stati64
 #define struct_fstat struct _stati64
 
 #define isatty _isatty
 #define struct_stat struct _stati64
 #define struct_fstat struct _stati64
 
 #define isatty _isatty
+
+#if _MSC_VER >= 1300
+# define HAVE__STRTOI64 1
+#endif
+
+#if _MSC_VER >= 1400
+#pragma warning ( disable : 4996 )
+#define _CRT_SECURE_NO_DEPRECATE
+#endif
+\f
+#undef HAVE_UTIME_H         /* no <utime.h> */
+
 \f
 /* ------------------ */
 /* Borland C section. */
 \f
 /* ------------------ */
 /* Borland C section. */
@@ -104,9 +135,11 @@ so, delete this exception statement from your version.  */
 #define OS_TYPE "Windows-Borland"
 
 #define LL(n) n##I64
 #define OS_TYPE "Windows-Borland"
 
 #define LL(n) n##I64
-#define stat(fname, buf) _stati64 (fname, buf)
+
+#define stat_alias _stati64
+#undef fstat_alias
 #define struct_stat struct stati64
 #define struct_stat struct stati64
-#define struct_fstat struct stat
+#undef struct_fstat
 \f
 /* ------------------------------ */
 /* Digital Mars Compiler section. */
 \f
 /* ------------------------------ */
 /* Digital Mars Compiler section. */
@@ -116,16 +149,74 @@ so, delete this exception statement from your version.  */
 #define OS_TYPE "Windows-DMC"
 
 #define LL(n) n##LL
 #define OS_TYPE "Windows-DMC"
 
 #define LL(n) n##LL
-#undef stat
+
+/* DMC supports 64-bit types, including long long, but not statting
+   large files.  */
+#undef stat_alias
+#undef fstat_alias
+/* If left undefined, sysdep.h will define these to struct stat. */
 #undef struct_stat
 #undef struct_fstat
 
 #undef struct_stat
 #undef struct_fstat
 
-/* DMC's runtime supports some POSIX and C99 features we use.  */
-#define HAVE_USLEEP 1
+/* DMC's runtime supports some POSIX and C99 headers, types, and
+   functions that we use.  */
+
+#define HAVE_STDINT_H 1
+#define HAVE_INTTYPES_H 1
 #define HAVE_STDBOOL_H 1
 #define HAVE_STDBOOL_H 1
+
+#define HAVE_UINT32_T 1
+#define HAVE_UINTPTR_T 1
+#define HAVE_INTPTR_T 1
+
+#undef SIZEOF_LONG_LONG
+#define SIZEOF_LONG_LONG 8
 #define HAVE__BOOL 1
 #define HAVE__BOOL 1
+
+#define HAVE_USLEEP 1
+#define HAVE_STRTOLL 1
+#undef HAVE_UTIME_H         /* no <utime.h> */
+
+\f
+/* -------------------- */
+/* OpenWatcom section.  */
+/* -------------------- */
+#elif defined __WATCOMC__
+
+#define OS_TYPE "Windows-Watcom"
+
+#define LL(n) n##LL
+
+#define stat_alias _stati64
+#define fstat_alias _fstati64
+#define struct_stat struct _stati64
+#define struct_fstat struct _stati64
+
+#ifdef ENABLE_IPV6
+# define NEED_GAI_STRERROR
+#endif
+
+#define HAVE_STDINT_H 1
+#define HAVE_INTTYPES_H 1
+
+/* Watcom 1.6 do have <stdbool.h>, but definition of '_Bool' is missing! */
+/* #define HAVE_STDBOOL_H 1 */
+#define HAVE_STRTOLL 1
+#define HAVE_UINT32_T 1
+#undef HAVE_UTIME_H
+#undef socklen_t                /* avoid clash with <ws2tcpip.h> */
+
 #undef SIZEOF_LONG_LONG
 #define SIZEOF_LONG_LONG 8
 #undef SIZEOF_LONG_LONG
 #define SIZEOF_LONG_LONG 8
+
+/* OpenWatcom needs _WIN32_WINNT==0x0501 defined to pull in getaddrinfo()
+ * and freeaddrinfo() etc.
+ */
+#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0501)
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0501
+#endif
+
 \f
 #else
 # error Your compiler is not supported.
 \f
 #else
 # error Your compiler is not supported.