mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #4938 from dearblue/socket-mingw
Fix builds for old mingw in mruby-socket; ref #4914
This commit is contained in:
@@ -74,6 +74,16 @@ MRB_BEGIN_DECL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Declare mingw versions */
|
||||
#if defined(__MINGW32__) || defined(__MINGW64__)
|
||||
# include <_mingw.h>
|
||||
# if defined(__MINGW64_VERSION_MAJOR)
|
||||
# define MRB_MINGW64_VERSION (__MINGW64_VERSION_MAJOR * 1000 + __MINGW64_VERSION_MINOR)
|
||||
# elif defined(__MINGW32_MAJOR_VERSION)
|
||||
# define MRB_MINGW32_VERSION (__MINGW32_MAJOR_VERSION * 1000 + __MINGW32_MINOR_VERSION)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
MRB_END_DECL
|
||||
|
||||
#endif /* MRUBY_COMMON_H */
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <mruby/common.h>
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -18,12 +19,6 @@ typedef int mode_t;
|
||||
#define open _open
|
||||
#define close _close
|
||||
|
||||
#if defined(__MINGW64_VERSION_MAJOR)
|
||||
# define MRB_MINGW64_VERSION (__MINGW64_VERSION_MAJOR * 1000 + __MINGW64_VERSION_MINOR)
|
||||
#elif defined(__MINGW32_MAJOR_VERSION)
|
||||
# define MRB_MINGW32_VERSION (__MINGW32_MAJOR_VERSION * 1000 + __MINGW32_MINOR_VERSION)
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) || \
|
||||
(defined(MRB_MINGW32_VERSION) && MRB_MINGW32_VERSION < 3021) || \
|
||||
(defined(MRB_MINGW64_VERSION) && MRB_MINGW64_VERSION < 4000)
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
|
||||
#include <io.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) || \
|
||||
(defined(MRB_MINGW32_VERSION) && MRB_MINGW32_VERSION < 3021) || \
|
||||
(defined(MRB_MINGW64_VERSION) && MRB_MINGW64_VERSION < 4000)
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
Reference in New Issue
Block a user