Merge branch 'kb/msvc-compile'
authorJonathan Nieder <jrnieder@gmail.com>
Wed, 25 Sep 2013 06:31:58 +0000 (23:31 -0700)
committerJonathan Nieder <jrnieder@gmail.com>
Wed, 25 Sep 2013 06:31:58 +0000 (23:31 -0700)
* kb/msvc-compile:
Windows: do not redefine _WIN32_WINNT
MinGW: Fix stat definitions to work with MinGW runtime version 4.0
MSVC: fix stat definition hell
MSVC: fix compile errors due to macro redefinitions
MSVC: fix compile errors due to missing libintl.h

1  2 
compat/mingw.h
diff --combined compat/mingw.h
index 9eb3b17ff071a724c269978bb6f4e3272238216c,19d82de41a4b5abf2e67db21dc34aec502ece700..92cd728d3db2e3a21650d28f044ea4f59c2673e4
@@@ -32,7 -32,9 +32,9 @@@ typedef int socklen_t
  #define WEXITSTATUS(x) ((x) & 0xff)
  #define WTERMSIG(x) SIGTERM
  
+ #ifndef EWOULDBLOCK
  #define EWOULDBLOCK EAGAIN
+ #endif
  #define SHUT_WR SD_SEND
  
  #define SIGHUP 1
  #define F_SETFD 2
  #define FD_CLOEXEC 0x1
  
+ #ifndef EAFNOSUPPORT
  #define EAFNOSUPPORT WSAEAFNOSUPPORT
+ #endif
+ #ifndef ECONNABORTED
  #define ECONNABORTED WSAECONNABORTED
+ #endif
  
  struct passwd {
        char *pw_name;
@@@ -258,19 -264,35 +264,35 @@@ static inline int getrlimit(int resourc
        return 0;
  }
  
- /* Use mingw_lstat() instead of lstat()/stat() and
-  * mingw_fstat() instead of fstat() on Windows.
+ /*
+  * Use mingw specific stat()/lstat()/fstat() implementations on Windows.
   */
  #define off_t off64_t
  #define lseek _lseeki64
- #ifndef ALREADY_DECLARED_STAT_FUNCS
+ /* use struct stat with 64 bit st_size */
+ #ifdef stat
+ #undef stat
+ #endif
  #define stat _stati64
  int mingw_lstat(const char *file_name, struct stat *buf);
  int mingw_stat(const char *file_name, struct stat *buf);
  int mingw_fstat(int fd, struct stat *buf);
+ #ifdef fstat
+ #undef fstat
+ #endif
  #define fstat mingw_fstat
+ #ifdef lstat
+ #undef lstat
+ #endif
  #define lstat mingw_lstat
- #define _stati64(x,y) mingw_stat(x,y)
+ #ifndef _stati64
+ # define _stati64(x,y) mingw_stat(x,y)
+ #elif defined (_USE_32BIT_TIME_T)
+ # define _stat32i64(x,y) mingw_stat(x,y)
+ #else
+ # define _stat64(x,y) mingw_stat(x,y)
  #endif
  
  int mingw_utime(const char *file_name, const struct utimbuf *times);
@@@ -322,7 -344,6 +344,7 @@@ static inline char *mingw_find_last_dir
  #define find_last_dir_sep mingw_find_last_dir_sep
  #define PATH_SEP ';'
  #define PRIuMAX "I64u"
 +#define PRId64 "I64d"
  
  void mingw_open_html(const char *path);
  #define open_html mingw_open_html