diff --git a/config/ac_func_accept_argtypes.m4 b/config/ac_func_accept_argtypes.m4 index 1e77179..a82788d 100644 --- a/config/ac_func_accept_argtypes.m4 +++ b/config/ac_func_accept_argtypes.m4 @@ -46,7 +46,7 @@ AC_DEFUN([AC_FUNC_ACCEPT_ARGTYPES], [AC_CACHE_VAL(ac_cv_func_accept_arg1,dnl [AC_CACHE_VAL(ac_cv_func_accept_arg2,dnl [AC_CACHE_VAL(ac_cv_func_accept_arg3,dnl - [for ac_cv_func_accept_return in 'int' 'unsigned int PASCAL' 'SOCKET'; do + [for ac_cv_func_accept_return in 'int' 'unsigned int PASCAL' 'SOCKET WSAAPI'; do for ac_cv_func_accept_arg1 in 'int' 'unsigned int' 'SOCKET'; do for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int' 'void'; do diff --git a/configure b/configure index de9ba5a..dfdd034 100755 --- a/configure +++ b/configure @@ -10056,7 +10056,8 @@ done -for ac_header in crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h poll.h pwd.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/ucred.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h kernel/OS.h kernel/image.h SupportDefs.h + +for ac_header in crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h poll.h pwd.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/ucred.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h kernel/OS.h kernel/image.h SupportDefs.h crtdefs.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then @@ -17997,6 +17998,7 @@ fi # compiler characteristic, but you'd be wrong. We must check this before # probing existence of related functions such as fseeko, since the largefile # defines can affect what is generated for that. +if test "$PORTNAME" != "win32" ; then # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then enableval=$enable_largefile; @@ -18353,7 +18355,7 @@ rm -rf conftest* fi fi - +fi # Check for largefile support (must be after AC_SYS_LARGEFILE) # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects @@ -18808,7 +18810,7 @@ else if test "${ac_cv_func_accept_arg3+set}" = set; then $as_echo_n "(cached) " >&6 else - for ac_cv_func_accept_return in 'int' 'unsigned int PASCAL' 'SOCKET'; do + for ac_cv_func_accept_return in 'int' 'unsigned int PASCAL' 'SOCKET WSAAPI'; do for ac_cv_func_accept_arg1 in 'int' 'unsigned int' 'SOCKET'; do for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int' 'void'; do diff --git a/configure.in b/configure.in index 5591b93..79180df 100644 --- a/configure.in +++ b/configure.in @@ -985,7 +985,7 @@ AC_SUBST(OSSP_UUID_LIBS) ## dnl sys/socket.h is required by AC_FUNC_ACCEPT_ARGTYPES -AC_CHECK_HEADERS([crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h poll.h pwd.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/ucred.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h kernel/OS.h kernel/image.h SupportDefs.h]) +AC_CHECK_HEADERS([crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h poll.h pwd.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/ucred.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h kernel/OS.h kernel/image.h SupportDefs.h crtdefs.h]) # On BSD, cpp test for net/if.h will fail unless sys/socket.h # is included first. @@ -1174,8 +1174,9 @@ fi # compiler characteristic, but you'd be wrong. We must check this before # probing existence of related functions such as fseeko, since the largefile # defines can affect what is generated for that. +if test "$PORTNAME" != "win32" ; then AC_SYS_LARGEFILE - +fi # Check for largefile support (must be after AC_SYS_LARGEFILE) AC_CHECK_SIZEOF([off_t]) diff --git a/src/include/c.h b/src/include/c.h index 0391860..14f6443 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -58,7 +58,7 @@ #endif #include "postgres_ext.h" -#if _MSC_VER >= 1400 || defined(WIN64) +#if _MSC_VER >= 1400 || HAVE_CRTDEFS_H #define errcode __msvc_errcode #include #undef errcode diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 15fe0bf..b969d8c 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 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 34f4004..ca9ae0c 100644 --- a/src/include/port/win32.h +++ b/src/include/port/win32.h @@ -27,13 +27,6 @@ #undef ERROR -/* - * The Mingw64 headers choke if this is already defined - they - * define it themselves. - */ -#if !defined(WIN64) || defined(WIN32_ONLY_COMPILER) -#define _WINSOCKAPI_ -#endif #include #include #include @@ -225,9 +218,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 . @@ -264,16 +261,37 @@ 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/libpq/win32.h b/src/interfaces/libpq/win32.h index b65da9a..be00ea7 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 db19878..c2bed94 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";