diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2011-12-10 15:35:41 -0500 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2011-12-10 15:35:41 -0500 |
commit | 1a0c76c32fe470142d3663dd84ac960d75a4e8db (patch) | |
tree | d783c0f17e41b6a627b3750e92bb60b301215a8b /src | |
parent | ab7d4213f93f0ef0e45b9b9343725974f196b091 (diff) | |
download | postgresql-1a0c76c32fe470142d3663dd84ac960d75a4e8db.tar.gz postgresql-1a0c76c32fe470142d3663dd84ac960d75a4e8db.zip |
Enable compiling with the mingw-w64 32 bit compiler.
Original patch by Lars Kanis, reviewed by Nishiyama Tomoaki and tweaked some by me.
This compiler, or at least the latest version of it, is currently broken, and
only passes the regression tests if built with -O0.
Diffstat (limited to 'src')
-rw-r--r-- | src/include/c.h | 3 | ||||
-rw-r--r-- | src/include/pg_config.h.in | 3 | ||||
-rw-r--r-- | src/include/port/win32.h | 26 | ||||
-rw-r--r-- | src/interfaces/ecpg/test/resultmap | 3 | ||||
-rw-r--r-- | src/interfaces/libpq/win32.h | 6 | ||||
-rw-r--r-- | src/port/getaddrinfo.c | 4 | ||||
-rw-r--r-- | src/test/regress/resultmap | 3 |
7 files changed, 43 insertions, 5 deletions
diff --git a/src/include/c.h b/src/include/c.h index 03918608464..cb9b150f8a6 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -58,7 +58,8 @@ #endif #include "postgres_ext.h" -#if _MSC_VER >= 1400 || defined(WIN64) +#define HAVE_CRTDEFS_H 1 +#if _MSC_VER >= 1400 || defined(HAVE_CRTDEFS_H) #define errcode __msvc_errcode #include <crtdefs.h> #undef errcode diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 15fe0bfff46..b969d8c8e6f 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -99,6 +99,9 @@ /* Define to 1 if you have the `class' function. */ #undef HAVE_CLASS +/* Define to 1 if you have the <crtdefs.h> header file. */ +#undef HAVE_CRTDEFS_H + /* Define to 1 if you have the `crypt' function. */ #undef HAVE_CRYPT diff --git a/src/include/port/win32.h b/src/include/port/win32.h index 34f40041298..afc96283ebc 100644 --- a/src/include/port/win32.h +++ b/src/include/port/win32.h @@ -31,7 +31,7 @@ * The Mingw64 headers choke if this is already defined - they * define it themselves. */ -#if !defined(WIN64) || defined(WIN32_ONLY_COMPILER) +#if !defined(__MINGW64_VERSION_MAJOR) || defined(WIN32_ONLY_COMPILER) #define _WINSOCKAPI_ #endif #include <winsock2.h> @@ -225,9 +225,13 @@ int setitimer(int which, const struct itimerval * value, struct itimerval * ov #define fseeko(stream, offset, origin) _fseeki64(stream, offset, origin) #define ftello(stream) _ftelli64(stream) #else +#ifndef fseeko #define fseeko(stream, offset, origin) fseeko64(stream, offset, origin) +#endif +#ifndef ftello #define ftello(stream) ftello64(stream) #endif +#endif /* * Supplement to <sys/types.h>. @@ -264,16 +268,36 @@ typedef int pid_t; #undef EINTR #define EINTR WSAEINTR #define EAGAIN WSAEWOULDBLOCK +#ifndef EMSGSIZE #define EMSGSIZE WSAEMSGSIZE +#endif +#ifndef EAFNOSUPPORT #define EAFNOSUPPORT WSAEAFNOSUPPORT +#endif +#ifndef EWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK +#endif +#ifndef ECONNRESET #define ECONNRESET WSAECONNRESET +#endif +#ifndef EINPROGRESS #define EINPROGRESS WSAEINPROGRESS +#endif +#ifndef ENOBUFS #define ENOBUFS WSAENOBUFS +#endif +#ifndef EPROTONOSUPPORT #define EPROTONOSUPPORT WSAEPROTONOSUPPORT +#endif +#ifndef ECONNREFUSED #define ECONNREFUSED WSAECONNREFUSED +#endif +#ifndef EBADFD #define EBADFD WSAENOTSOCK +#endif +#ifndef EOPNOTSUPP #define EOPNOTSUPP WSAEOPNOTSUPP +#endif /* * Extended locale functions with gratuitous underscore prefixes. diff --git a/src/interfaces/ecpg/test/resultmap b/src/interfaces/ecpg/test/resultmap index 95ea5831ccb..aef7338e819 100644 --- a/src/interfaces/ecpg/test/resultmap +++ b/src/interfaces/ecpg/test/resultmap @@ -1,9 +1,12 @@ compat_informix/dec_test:stdout:i.86-pc-win32vc=compat_informix-dec_test-MinGW32.stdout compat_informix/dec_test:stdout:i.86-pc-mingw32=compat_informix-dec_test-MinGW32.stdout compat_informix/dec_test:stdout:x86_64-w64-mingw32=compat_informix-dec_test-MinGW32.stdout +compat_informix/dec_test:stdout:i.86-w64-mingw32=compat_informix-dec_test-MinGW32.stdout pgtypeslib/num_test:stdout:i.86-pc-win32vc=pgtypeslib-num_test-MinGW32.stdout pgtypeslib/num_test:stdout:i.86-pc-mingw32=pgtypeslib-num_test-MinGW32.stdout pgtypeslib/num_test:stdout:x86_64-w64-mingw32=pgtypeslib-num_test-MinGW32.stdout +pgtypeslib/num_test:stdout:i.86-w64-mingw32=pgtypeslib-num_test-MinGW32.stdout pgtypeslib/num_test2:stdout:i.86-pc-win32vc=pgtypeslib-num_test2-MinGW32.stdout pgtypeslib/num_test2:stdout:i.86-pc-mingw32=pgtypeslib-num_test2-MinGW32.stdout pgtypeslib/num_test2:stdout:x86_64-w64-mingw32=pgtypeslib-num_test2-MinGW32.stdout +pgtypeslib/num_test2:stdout:i.86-w64-mingw32=pgtypeslib-num_test2-MinGW32.stdout diff --git a/src/interfaces/libpq/win32.h b/src/interfaces/libpq/win32.h index b65da9ada14..be00ea73cbb 100644 --- a/src/interfaces/libpq/win32.h +++ b/src/interfaces/libpq/win32.h @@ -22,9 +22,15 @@ #undef EAGAIN /* doesn't apply on sockets */ #undef EINTR #define EINTR WSAEINTR +#ifndef EWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK +#endif +#ifndef ECONNRESET #define ECONNRESET WSAECONNRESET +#endif +#ifndef EINPROGRESS #define EINPROGRESS WSAEINPROGRESS +#endif /* * support for handling Windows Socket errors diff --git a/src/port/getaddrinfo.c b/src/port/getaddrinfo.c index db19878ae14..b6368ae6916 100644 --- a/src/port/getaddrinfo.c +++ b/src/port/getaddrinfo.c @@ -328,12 +328,10 @@ gai_strerror(int errcode) case EAI_MEMORY: return "Not enough memory"; #endif -#ifdef EAI_NODATA -#if !defined(WIN64) && !defined(WIN32_ONLY_COMPILER) /* MSVC/WIN64 duplicate */ +#if defined(EAI_NODATA) && EAI_NODATA != EAI_NONAME /* MSVC/WIN64 duplicate */ case EAI_NODATA: return "No host data of that type was found"; #endif -#endif #ifdef EAI_SERVICE case EAI_SERVICE: return "Class type not found"; diff --git a/src/test/regress/resultmap b/src/test/regress/resultmap index d02d221d56f..04ba99fe338 100644 --- a/src/test/regress/resultmap +++ b/src/test/regress/resultmap @@ -1,5 +1,6 @@ float4:out:i.86-pc-mingw32=float4-exp-three-digits.out float4:out:x86_64-w64-mingw32=float4-exp-three-digits.out +float4:out:i.86-w64-mingw32=float4-exp-three-digits.out float4:out:i.86-pc-win32vc=float4-exp-three-digits.out float8:out:i.86-.*-freebsd=float8-small-is-zero.out float8:out:i.86-.*-openbsd=float8-small-is-zero.out @@ -7,8 +8,10 @@ float8:out:i.86-.*-netbsd=float8-small-is-zero.out float8:out:m68k-.*-netbsd=float8-small-is-zero.out float8:out:i.86-pc-mingw32=float8-exp-three-digits-win32.out float8:out:x86_64-w64-mingw32=float8-exp-three-digits-win32.out +float8:out:i.86-w64-mingw32=float8-exp-three-digits-win32.out float8:out:i.86-pc-win32vc=float8-exp-three-digits-win32.out float8:out:i.86-pc-cygwin=float8-small-is-zero.out int8:out:i.86-pc-mingw32=int8-exp-three-digits.out int8:out:x86_64-w64-mingw32=int8-exp-three-digits.out +int8:out:i.86-w64-mingw32=int8-exp-three-digits.out int8:out:i.86-pc-win32vc=int8-exp-three-digits.out |