Digital Mars patches
Gisle Vanem <[email protected]> Tue, 05 Jul 2005 15:31:36 +0200
| Newsgroups | gmane.comp.web.wget.patches |
|---|---|
| Message-ID | <[email protected]> |
The attached patches will make Wget compile on DMC. This compiler produces very fast code, but it's clib is lacking 64-bit I/O support; - No _stati64() etc. Hence no large files are possible. - Has no _mkdir(). All Win32 targets have <direct.h> and mkdir(). - Doesn't support MS-style 'I64' suffixes. - Has '_Bool'. C99 type? --gv
diffs.txt
(text/plain, 3.8 KB)
diff -u3 -Hb -r SVN-Latest\src\getopt.c .\src\getopt.c
--- SVN-Latest\src\getopt.c Sun Jun 26 13:47:23 2005
+++ .\src\getopt.c Tue Jul 05 15:20:11 2005
@@ -38,6 +38,7 @@
#endif
#include <stdio.h>
+#include <stdlib.h> /* getenv */
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
diff -u3 -Hb -r SVN-Latest\src\mswindows.h .\src\mswindows.h
--- SVN-Latest\src\mswindows.h Tue Jul 05 14:51:15 2005
+++ .\src\mswindows.h Tue Jul 05 15:17:12 2005
@@ -78,7 +78,7 @@
typedef __int64 wgint;
#define SIZEOF_WGINT 8
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(__DMC__)
#define WGINT_MAX 9223372036854775807LL
#else
#define WGINT_MAX 9223372036854775807I64
@@ -96,10 +96,12 @@
#define lstat stat
/* 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. All Windows compilers we support (except DMC) use _stati64
+ (but have different names for 2nd argument type, see below), so
+ we use that. */
+#ifndef __DMC__
+# define stat(fname, buf) _stati64 (fname, buf)
+#endif
/* On Windows the 64-bit stat requires an explicitly different type
for the 2nd argument, so we define a struct_stat macro that expands
@@ -109,16 +111,23 @@
Note that Borland C 5.5 has 64-bit stat (_stati64), but not a
64-bit fstat! Because of that we also need a struct_fstat that
points to struct_stat on Unix and on Windows, except under Borland,
- where it points to the 32-bit struct stat. */
+ where it points to the 32-bit struct stat.
+
+ Also note that DMC completely lacks 64-bit I/O support. */
-#ifndef __BORLANDC__
+#ifdef __DMC__
+# define struct_stat struct stat
+# define struct_fstat struct stat
+#else
+# ifndef __BORLANDC__
# define fstat(fd, buf) _fstati64 (fd, buf)
# define struct_stat struct _stati64
# define struct_fstat struct _stati64
-#else /* __BORLANDC__ */
+# else /* __BORLANDC__ */
# define struct_stat struct stati64
# define struct_fstat struct stat
-#endif /* __BORLANDC__ */
+# endif /* __BORLANDC__ */
+#endif /* __DMC__ */
#define PATH_SEPARATOR '\\'
@@ -129,7 +138,8 @@
#endif
/* Win32 doesn't support the MODE argument to mkdir. */
-#define mkdir(a, b) _mkdir(a)
+#include <direct.h>
+#define mkdir(a, b) (mkdir)(a)
/* Additional declarations needed for IPv6: */
#ifdef ENABLE_IPV6
diff -u3 -Hb -r SVN-Latest\windows\config.h.ms .\windows\config.h.ms
--- SVN-Latest\windows\config.h.ms Thu Jun 30 15:15:35 2005
+++ .\windows\config.h.ms Thu Jun 30 15:04:56 2005
@@ -1,4 +1,4 @@
-/* Configuration header file.
+/* Configuration header file for MS Visual-C, Open Watcom and Digital Mars.
Copyright (C) 1995, 1996, 1997, 1998, 2004
Free Software Foundation, Inc.
@@ -57,6 +57,9 @@
/* Define if you want the debug output support compiled in. */
#define ENABLE_DEBUG 1
+/* Define if you have the sig_atomic_t type. */
+#define HAVE_SIG_ATOMIC_T 1
+
/* Define if you have sys/time.h header. */
#undef HAVE_SYS_TIME_H
@@ -76,10 +79,10 @@
#define HAVE_VSNPRINTF 1
/* Define if you have the strcasecmp function. */
-#define HAVE_STRCASECMP 1
+#undef HAVE_STRCASECMP
/* Define if you have the strncasecmp function. */
-#define HAVE_STRNCASECMP 1
+#undef HAVE_STRNCASECMP
/* Define if you have the strptime function. */
#undef HAVE_STRPTIME
@@ -90,10 +93,11 @@
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
-/* None except Digital Mars have sleep/usleep functions */
+/* Digital Mars is a bit more POSIX/C99. */
#if defined(__DMC__)
#define HAVE_USLEEP 1
#define HAVE_SLEEP 1
+#define HAVE__BOOL 1
#endif
/* Define if you have the <utime.h> header file. */