Hi,
> FYI I've been testing with the attached patch.
> We'll need to construct a configure test for HAVE_CRTDEFS_H.
Isn't it enough to add the name in configure.in and run autoconf to
update configure and autoheaders to update pg_config.h.in?
The check of win32 before large file perhaps should also go to configure.in,
otherwise they would be wiped with next autoconf.
The patch recreated with removing the #undef
but adding the conditional to skip AC_SYS_LARGEFILE in configure.in and
update configure by autoconf.
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 <crtdefs.h>
#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 <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 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 <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
@@ -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 <sys/types.h>.
@@ -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";
On 2011/12/09, at 2:46, Andrew Dunstan wrote:
>
>
> On 12/05/2011 06:27 PM, Andrew Dunstan wrote:
>>
>>
>> $ cat regression.diffs
>> ***
>>
>> C:/MinGW/msys/1.0/home/pgrunner/bf/root32/HEAD/pgsql/src/test/regress/expected/float8-exp-three-digits-win32.out
>> Fri Nov 25 14:24:49 2011
>> ---
>>
>> C:/MinGW/msys/1.0/home/pgrunner/bf/root32/HEAD/pgsql/src/test/regress/results/float8.out
>> Mon Dec 5 18:17:36 2011
>> ***************
>> *** 382,388 ****
>> SET f1 = FLOAT8_TBL.f1 * '-1'
>> WHERE FLOAT8_TBL.f1 > '0.0';
>> SELECT '' AS bad, f.f1 * '1e200' from FLOAT8_TBL f;
>> ! ERROR: value out of range: overflow
>> SELECT '' AS bad, f.f1 ^ '1e200' from FLOAT8_TBL f;
>> ERROR: value out of range: overflow
>> SELECT 0 ^ 0 + 0 ^ 1 + 0 ^ 0.0 + 0 ^ 0.5;
>> --- 382,396 ----
>> SET f1 = FLOAT8_TBL.f1 * '-1'
>> WHERE FLOAT8_TBL.f1 > '0.0';
>> SELECT '' AS bad, f.f1 * '1e200' from FLOAT8_TBL f;
>> ! bad | ?column?
>> ! -----+------------------
>> ! | 0
>> ! | -3.484e+201
>> ! | -1.0043e+203
>> ! | -Infinity
>> ! | -1.2345678901234
>> ! (5 rows)
>> !
>> SELECT '' AS bad, f.f1 ^ '1e200' from FLOAT8_TBL f;
>> ERROR: value out of range: overflow
>> SELECT 0 ^ 0 + 0 ^ 1 + 0 ^ 0.0 + 0 ^ 0.5;
>>
>> ======================================================================
>>
>>
>>
>
>
> This is apparently an optimization bug in the compiler. If I turn
> optimization off (CFLAGS=-O0) it goes away. Ick.
>
> So at the moment I'm a bit blocked. I can't really file a bug because the
> compiler can't currently be used to build postgres, I don't have time to
> construct a self-contained test case, and I don't want to commit changes to
> enable the compiler until the issue is solved.
>
> FYI I've been testing with the attached patch. We'll need to construct a
> configure test for HAVE_CRTDEFS_H.
>
> cheers
>
> andrew
>
>
> <mingw-w64-32.patch>
> --
> Sent via pgsql-hackers mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers