*** ./include/pg_config.h.win64.orig	Wed Jul  2 23:08:06 2008
--- ./include/pg_config.h.win64	Thu Jul  3 15:24:48 2008
***************
*** 0 ****
--- 1,676 ----
+ /* src/include/pg_config.h.  Generated by configure.  */
+ /* src/include/pg_config.h.in.  Generated from configure.in by autoheader.  */
+ 
+ /* This file is generated from MingW ./configure, and with the following
+  * changes to be valid for Visual C++ (and compatible):
+  *
+  * HAVE_CBRT, HAVE_FUNCNAME_FUNC, HAVE_GETOPT, HAVE_GETOPT_H,
+  * HAVE_GETOPT_LONG, HAVE_RINT, HAVE_STRINGS_H, HAVE_STRTOLL,
+  * HAVE_STRTOULL, HAVE_STRUCT_OPTION, ENABLE_THREAD_SAFETY
+  *
+  */
+ 
+ /* Define to the type of arg 1 of 'accept' */
+ #define ACCEPT_TYPE_ARG1 unsigned int
+ 
+ /* Define to the type of arg 2 of 'accept' */
+ #define ACCEPT_TYPE_ARG2 struct sockaddr *
+ 
+ /* Define to the type of arg 3 of 'accept' */
+ #define ACCEPT_TYPE_ARG3 int
+ 
+ /* Define to the return type of 'accept' */
+ #define ACCEPT_TYPE_RETURN unsigned int PASCAL
+ 
+ /* The alignment requirement of a `double'. */
+ #define ALIGNOF_DOUBLE 8
+ 
+ /* The alignment requirement of a `int'. */
+ #define ALIGNOF_INT 4
+ 
+ /* The alignment requirement of a `long'. */
+ #define ALIGNOF_LONG 4
+ 
+ /* The alignment requirement of a `long long int'. */
+ #define ALIGNOF_LONG_LONG_INT 8
+ 
+ /* The alignment requirement of a `short'. */
+ #define ALIGNOF_SHORT 2
+ 
+ /* Define to the default TCP port number on which the server listens and to
+    which clients will try to connect. This can be overridden at run-time, but
+    it's convenient if your clients have the right default compiled in.
+    (--with-pgport=PORTNUM) */
+ #define DEF_PGPORT 5432
+ 
+ /* Define to the default TCP port number as a string constant. */
+ #define DEF_PGPORT_STR "5432"
+ 
+ /* Define to 1 if you want National Language Support. (--enable-nls) */
+ /* #undef ENABLE_NLS */
+ 
+ /* Define to 1 to build client libraries as thread-safe code.
+    (--enable-thread-safety) */
+ #define ENABLE_THREAD_SAFETY 1
+ 
+ /* Define to 1 if getpwuid_r() takes a 5th argument. */
+ /* #undef GETPWUID_R_5ARG */
+ 
+ /* Define to 1 if gettimeofday() takes only 1 argument. */
+ /* #undef GETTIMEOFDAY_1ARG */
+ 
+ #ifdef GETTIMEOFDAY_1ARG
+ # define gettimeofday(a,b) gettimeofday(a)
+ #endif
+ 
+ /* Define to 1 if you have the `atexit' function. */
+ #define HAVE_ATEXIT 1
+ 
+ /* Define to 1 if you have the `cbrt' function. */
+ //#define HAVE_CBRT 1
+ 
+ /* Define to 1 if you have the `class' function. */
+ /* #undef HAVE_CLASS */
+ 
+ /* Define to 1 if you have the `crypt' function. */
+ /* #undef HAVE_CRYPT */
+ 
+ /* Define to 1 if you have the <crypt.h> header file. */
+ /* #undef HAVE_CRYPT_H */
+ 
+ /* Define to 1 if you have the declaration of `fdatasync', and to 0 if you
+    don't. */
+ #define HAVE_DECL_FDATASYNC 0
+ 
+ /* Define to 1 if you have the declaration of `F_FULLFSYNC', and to 0 if you
+    don't. */
+ #define HAVE_DECL_F_FULLFSYNC 0
+ 
+ /* Define to 1 if you have the declaration of `snprintf', and to 0 if you
+    don't. */
+ #define HAVE_DECL_SNPRINTF 1
+ 
+ /* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
+    don't. */
+ #define HAVE_DECL_VSNPRINTF 1
+ 
+ /* Define to 1 if you have the <dld.h> header file. */
+ /* #undef HAVE_DLD_H */
+ 
+ /* Define to 1 if you have the `dlopen' function. */
+ /* #undef HAVE_DLOPEN */
+ 
+ /* Define to 1 if you have the <editline/history.h> header file. */
+ /* #undef HAVE_EDITLINE_HISTORY_H */
+ 
+ /* Define to 1 if you have the <editline/readline.h> header file. */
+ /* #undef HAVE_EDITLINE_READLINE_H */
+ 
+ /* Define to 1 if you have the `fcvt' function. */
+ #define HAVE_FCVT 1
+ 
+ /* Define to 1 if you have the `fdatasync' function. */
+ /* #undef HAVE_FDATASYNC */
+ 
+ /* Define to 1 if you have finite(). */
+ #define HAVE_FINITE 1
+ 
+ /* Define to 1 if you have the `fpclass' function. */
+ /* #undef HAVE_FPCLASS */
+ 
+ /* Define to 1 if you have the `fp_class' function. */
+ /* #undef HAVE_FP_CLASS */
+ 
+ /* Define to 1 if you have the `fp_class_d' function. */
+ /* #undef HAVE_FP_CLASS_D */
+ 
+ /* Define to 1 if you have the <fp_class.h> header file. */
+ /* #undef HAVE_FP_CLASS_H */
+ 
+ /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+ /* #undef HAVE_FSEEKO */
+ 
+ /* Define to 1 if your compiler understands __func__. */
+ //#define HAVE_FUNCNAME__FUNC 1
+ 
+ /* Define to 1 if your compiler understands __FUNCTION__. */
+ #define HAVE_FUNCNAME__FUNCTION 1
+ 
+ /* Define to 1 if you have getaddrinfo(). */
+ /* #undef HAVE_GETADDRINFO */
+ 
+ /* Define to 1 if you have the `gethostbyname_r' function. */
+ /* #undef HAVE_GETHOSTBYNAME_R */
+ 
+ /* Define to 1 if you have the `getopt' function. */
+ //#define HAVE_GETOPT 1
+ 
+ /* Define to 1 if you have the <getopt.h> header file. */
+ //#define HAVE_GETOPT_H 1
+ 
+ /* Define to 1 if you have the `getopt_long' function. */
+ //#define HAVE_GETOPT_LONG 1
+ 
+ /* Define to 1 if you have the `getpeereid' function. */
+ /* #undef HAVE_GETPEEREID */
+ 
+ /* Define to 1 if you have the `getpwuid_r' function. */
+ /* #undef HAVE_GETPWUID_R */
+ 
+ /* Define to 1 if you have the `getrusage' function. */
+ /* #undef HAVE_GETRUSAGE */
+ 
+ /* Define to 1 if you have the <history.h> header file. */
+ /* #undef HAVE_HISTORY_H */
+ 
+ /* Define to 1 if you have the <ieeefp.h> header file. */
+ /* #undef HAVE_IEEEFP_H */
+ 
+ /* Define to 1 if you have the `inet_aton' function. */
+ /* #undef HAVE_INET_ATON */
+ 
+ /* Define to 1 if the system has the type `int64'. */
+ /* #undef HAVE_INT64 */
+ 
+ /* Define to 1 if the system has the type `int8'. */
+ /* #undef HAVE_INT8 */
+ 
+ /* Define to 1 if you have the <inttypes.h> header file. */
+ #define HAVE_INTTYPES_H 1
+ 
+ /* Define to 1 if you have the global variable 'int optreset'. */
+ #define HAVE_INT_OPTRESET 1
+ 
+ /* Define to 1 if you have the global variable 'int timezone'. */
+ #define HAVE_INT_TIMEZONE 
+ 
+ /* Define to 1 if you have support for IPv6. */
+ #define HAVE_IPV6 1
+ 
+ /* Define to 1 if you have isinf(). */
+ #define HAVE_ISINF 1
+ 
+ /* Define to 1 if you have the <kernel/image.h> header file. */
+ /* #undef HAVE_KERNEL_IMAGE_H */
+ 
+ /* Define to 1 if you have the <kernel/OS.h> header file. */
+ /* #undef HAVE_KERNEL_OS_H */
+ 
+ /* Define to 1 if `e_data' is member of `krb5_error'. */
+ /* #undef HAVE_KRB5_ERROR_E_DATA */
+ 
+ /* Define to 1 if `text.data' is member of `krb5_error'. */
+ /* #undef HAVE_KRB5_ERROR_TEXT_DATA */
+ 
+ /* Define to 1 if `client' is member of `krb5_ticket'. */
+ /* #undef HAVE_KRB5_TICKET_CLIENT */
+ 
+ /* Define to 1 if `enc_part2' is member of `krb5_ticket'. */
+ /* #undef HAVE_KRB5_TICKET_ENC_PART2 */
+ 
+ /* Define to 1 if you have the <langinfo.h> header file. */
+ /* #undef HAVE_LANGINFO_H */
+ 
+ /* Define to 1 if you have the <ldap.h> header file. */
+ /* #undef HAVE_LDAP_H */
+ 
+ /* Define to 1 if you have the `crypto' library (-lcrypto). */
+ /* #undef HAVE_LIBCRYPTO */
+ 
+ /* Define to 1 if you have the `eay32' library (-leay32). */
+ /* #undef HAVE_LIBEAY32 */
+ 
+ /* Define to 1 if you have the `ldap' library (-lldap). */
+ /* #undef HAVE_LIBLDAP */
+ 
+ /* Define to 1 if you have the `pam' library (-lpam). */
+ /* #undef HAVE_LIBPAM */
+ 
+ /* Define if you have a function readline library */
+ /* #undef HAVE_LIBREADLINE */
+ 
+ /* Define to 1 if you have the `ssl' library (-lssl). */
+ /* #undef HAVE_LIBSSL */
+ 
+ /* Define to 1 if you have the `ssleay32' library (-lssleay32). */
+ /* #undef HAVE_LIBSSLEAY32 */
+ 
+ /* Define to 1 if you have the `wldap32' library (-lwldap32). */
+ /* #undef HAVE_LIBWLDAP32 */
+ 
+ /* Define to 1 if you have the `z' library (-lz). */
+ /* #undef HAVE_LIBZ */
+ 
+ /* Define to 1 if constants of type 'long long int' should have the suffix LL.
+    */
+ #if (_MSC_VER > 1200)
+ #define HAVE_LL_CONSTANTS 1
+ #endif
+ 
+ /* Define to 1 if `long int' works and is 64 bits. */
+ /* #undef HAVE_LONG_INT_64 */
+ 
+ /* Define to 1 if `long long int' works and is 64 bits. */
+ #if (_MSC_VER > 1200)
+ #define HAVE_LONG_LONG_INT_64 
+ #endif
+ 
+ /* Define to 1 if you have the `memmove' function. */
+ #define HAVE_MEMMOVE 1
+ 
+ /* Define to 1 if you have the <memory.h> header file. */
+ #define HAVE_MEMORY_H 1
+ 
+ /* Define to 1 if you have the <netinet/in.h> header file. */
+ #define HAVE_NETINET_IN_H 1
+ 
+ /* Define to 1 if you have the <netinet/tcp.h> header file. */
+ /* #undef HAVE_NETINET_TCP_H */
+ 
+ /* Define to 1 if you have the `on_exit' function. */
+ /* #undef HAVE_ON_EXIT */
+ 
+ /* Define to 1 if you have the <pam/pam_appl.h> header file. */
+ /* #undef HAVE_PAM_PAM_APPL_H */
+ 
+ /* Define to 1 if you have the `poll' function. */
+ /* #undef HAVE_POLL */
+ 
+ /* Define to 1 if you have the <poll.h> header file. */
+ /* #undef HAVE_POLL_H */
+ 
+ /* Define to 1 if you have the POSIX signal interface. */
+ /* #undef HAVE_POSIX_SIGNALS */
+ 
+ /* Define to 1 if you have the `pstat' function. */
+ /* #undef HAVE_PSTAT */
+ 
+ /* Define to 1 if the PS_STRINGS thing exists. */
+ /* #undef HAVE_PS_STRINGS */
+ 
+ /* Define if you have POSIX threads libraries and header files. */
+ /* #undef HAVE_PTHREAD */
+ 
+ /* Define to 1 if you have the <pwd.h> header file. */
+ #define HAVE_PWD_H 1
+ 
+ /* Define to 1 if you have the `random' function. */
+ /* #undef HAVE_RANDOM */
+ 
+ /* Define to 1 if you have the <readline.h> header file. */
+ /* #undef HAVE_READLINE_H */
+ 
+ /* Define to 1 if you have the <readline/history.h> header file. */
+ /* #undef HAVE_READLINE_HISTORY_H */
+ 
+ /* Define to 1 if you have the <readline/readline.h> header file. */
+ /* #undef HAVE_READLINE_READLINE_H */
+ 
+ /* Define to 1 if you have the `readlink' function. */
+ /* #undef HAVE_READLINK */
+ 
+ /* Define to 1 if you have the `replace_history_entry' function. */
+ /* #undef HAVE_REPLACE_HISTORY_ENTRY */
+ 
+ /* Define to 1 if you have the `rint' function. */
+ /*#define HAVE_RINT 1*/
+ 
+ /* Define to 1 if you have the global variable
+    'rl_completion_append_character'. */
+ /* #undef HAVE_RL_COMPLETION_APPEND_CHARACTER */
+ 
+ /* Define to 1 if you have the `rl_completion_matches' function. */
+ /* #undef HAVE_RL_COMPLETION_MATCHES */
+ 
+ /* Define to 1 if you have the `rl_filename_completion_function' function. */
+ /* #undef HAVE_RL_FILENAME_COMPLETION_FUNCTION */
+ 
+ /* Define to 1 if you have the <security/pam_appl.h> header file. */
+ /* #undef HAVE_SECURITY_PAM_APPL_H */
+ 
+ /* Define to 1 if you have the `setproctitle' function. */
+ /* #undef HAVE_SETPROCTITLE */
+ 
+ /* Define to 1 if you have the `setsid' function. */
+ /* #undef HAVE_SETSID */
+ 
+ /* Define to 1 if you have the `sigprocmask' function. */
+ /* #undef HAVE_SIGPROCMASK */
+ 
+ /* Define to 1 if you have sigsetjmp(). */
+ /* #undef HAVE_SIGSETJMP */
+ 
+ /* Define to 1 if the system has the type `sig_atomic_t'. */
+ #define HAVE_SIG_ATOMIC_T 1
+ 
+ /* Define to 1 if you have the `snprintf' function. */
+ /* #undef HAVE_SNPRINTF */
+ 
+ /* Define to 1 if you have spinlocks. */
+ #define HAVE_SPINLOCKS 1
+ 
+ /* Define to 1 if you have the `srandom' function. */
+ /* #undef HAVE_SRANDOM */
+ 
+ /* Define to 1 if you have the <stdint.h> header file. */
+ #define HAVE_STDINT_H 1
+ 
+ /* Define to 1 if you have the <stdlib.h> header file. */
+ #define HAVE_STDLIB_H 1
+ 
+ /* Define to 1 if you have the `strdup' function. */
+ #define HAVE_STRDUP 1
+ 
+ /* Define to 1 if you have the `strerror' function. */
+ #ifndef HAVE_STRERROR
+ #define HAVE_STRERROR 1
+ #endif
+ 
+ /* Define to 1 if you have the `strerror_r' function. */
+ /* #undef HAVE_STRERROR_R */
+ 
+ /* Define to 1 if cpp supports the ANSI # stringizing operator. */
+ #define HAVE_STRINGIZE 1
+ 
+ /* Define to 1 if you have the <strings.h> header file. */
+ /*#define HAVE_STRINGS_H 1 */
+ 
+ /* Define to 1 if you have the <string.h> header file. */
+ #define HAVE_STRING_H 1
+ 
+ /* Define to 1 if you have the `strtol' function. */
+ #define HAVE_STRTOL 1
+ 
+ /* Define to 1 if you have the `strtoll' function. */
+ //#define HAVE_STRTOLL 1
+ 
+ /* Define to 1 if you have the `strtoq' function. */
+ /* #undef HAVE_STRTOQ */
+ 
+ /* Define to 1 if you have the `strtoul' function. */
+ #define HAVE_STRTOUL 1
+ 
+ /* Define to 1 if you have the `strtoull' function. */
+ //#define HAVE_STRTOULL 1
+ 
+ /* Define to 1 if you have the `strtouq' function. */
+ /* #undef HAVE_STRTOUQ */
+ 
+ /* Define to 1 if the system has the type `struct addrinfo'. */
+ #if (_MSC_VER > 1200)
+ #define HAVE_STRUCT_ADDRINFO 1
+ #endif
+ 
+ /* Define to 1 if the system has the type `struct cmsgcred'. */
+ /* #undef HAVE_STRUCT_CMSGCRED */
+ 
+ /* Define to 1 if the system has the type `struct fcred'. */
+ /* #undef HAVE_STRUCT_FCRED */
+ 
+ /* Define to 1 if the system has the type `struct option'. */
+ //#define HAVE_STRUCT_OPTION 1
+ 
+ /* Define to 1 if `sa_len' is member of `struct sockaddr'. */
+ /* #undef HAVE_STRUCT_SOCKADDR_SA_LEN */
+ 
+ /* Define to 1 if the system has the type `struct sockaddr_storage'. */
+ #if (_MSC_VER > 1200)
+ #define HAVE_STRUCT_SOCKADDR_STORAGE 1
+ #endif
+ 
+ /* Define to 1 if `ss_family' is member of `struct sockaddr_storage'. */
+ #if (_MSC_VER > 1200)
+ #define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
+ #endif
+ 
+ /* Define to 1 if `ss_len' is member of `struct sockaddr_storage'. */
+ /* #undef HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN */
+ 
+ /* Define to 1 if `__ss_family' is member of `struct sockaddr_storage'. */
+ /* #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */
+ 
+ /* Define to 1 if `__ss_len' is member of `struct sockaddr_storage'. */
+ /* #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_LEN */
+ 
+ /* Define to 1 if the system has the type `struct sockaddr_un'. */
+ /* #undef HAVE_STRUCT_SOCKADDR_UN */
+ 
+ /* Define to 1 if the system has the type `struct sockcred'. */
+ /* #undef HAVE_STRUCT_SOCKCRED */
+ 
+ /* Define to 1 if `tm_zone' is member of `struct tm'. */
+ /* #undef HAVE_STRUCT_TM_TM_ZONE */
+ 
+ /* Define to 1 if you have the <SupportDefs.h> header file. */
+ /* #undef HAVE_SUPPORTDEFS_H */
+ 
+ /* Define to 1 if you have the `symlink' function. */
+ #define HAVE_SYMLINK 1
+ 
+ /* Define to 1 if you have the `sysconf' function. */
+ /* #undef HAVE_SYSCONF */
+ 
+ /* Define to 1 if you have the syslog interface. */
+ /* #undef HAVE_SYSLOG */
+ 
+ /* Define to 1 if you have the <sys/ipc.h> header file. */
+ /* #undef HAVE_SYS_IPC_H */
+ 
+ /* Define to 1 if you have the <sys/poll.h> header file. */
+ /* #undef HAVE_SYS_POLL_H */
+ 
+ /* Define to 1 if you have the <sys/pstat.h> header file. */
+ /* #undef HAVE_SYS_PSTAT_H */
+ 
+ /* Define to 1 if you have the <sys/select.h> header file. */
+ /* #undef HAVE_SYS_SELECT_H */
+ 
+ /* Define to 1 if you have the <sys/sem.h> header file. */
+ /* #undef HAVE_SYS_SEM_H */
+ 
+ /* Define to 1 if you have the <sys/shm.h> header file. */
+ /* #undef HAVE_SYS_SHM_H */
+ 
+ /* Define to 1 if you have the <sys/socket.h> header file. */
+ #define HAVE_SYS_SOCKET_H 1
+ 
+ /* Define to 1 if you have the <sys/stat.h> header file. */
+ #define HAVE_SYS_STAT_H 1
+ 
+ /* Define to 1 if you have the <sys/time.h> header file. */
+ #define HAVE_SYS_TIME_H 1
+ 
+ /* Define to 1 if you have the <sys/types.h> header file. */
+ #define HAVE_SYS_TYPES_H 1
+ 
+ /* Define to 1 if you have the <sys/un.h> header file. */
+ /* #undef HAVE_SYS_UN_H */
+ 
+ /* Define to 1 if you have the <termios.h> header file. */
+ /* #undef HAVE_TERMIOS_H */
+ 
+ /* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
+    `HAVE_STRUCT_TM_TM_ZONE' instead. */
+ /* #undef HAVE_TM_ZONE */
+ 
+ /* Define to 1 if you have the `towlower' function. */
+ #define HAVE_TOWLOWER 1
+ 
+ /* Define to 1 if you have the external array `tzname'. */
+ /* #undef HAVE_TZNAME */
+ 
+ /* Define to 1 if the system has the type `uint64'. */
+ /* #undef HAVE_UINT64 */
+ 
+ /* Define to 1 if the system has the type `uint8'. */
+ /* #undef HAVE_UINT8 */
+ 
+ /* Define to 1 if the system has the type `union semun'. */
+ /* #undef HAVE_UNION_SEMUN */
+ 
+ /* Define to 1 if you have the <unistd.h> header file. */
+ #define HAVE_UNISTD_H 1
+ 
+ /* Define to 1 if you have unix sockets. */
+ /* #undef HAVE_UNIX_SOCKETS */
+ 
+ /* Define to 1 if you have the `unsetenv' function. */
+ /* #undef HAVE_UNSETENV */
+ 
+ /* Define to 1 if you have the `utime' function. */
+ #define HAVE_UTIME 1
+ 
+ /* Define to 1 if you have the `utimes' function. */
+ /* #undef HAVE_UTIMES */
+ 
+ /* Define to 1 if you have the <utime.h> header file. */
+ #define HAVE_UTIME_H 1
+ 
+ /* Define to 1 if you have the `vsnprintf' function. */
+ #define HAVE_VSNPRINTF 1
+ 
+ /* Define to 1 if you have the `waitpid' function. */
+ /* #undef HAVE_WAITPID */
+ 
+ /* Define to 1 if you have the <wchar.h> header file. */
+ #define HAVE_WCHAR_H 1
+ 
+ /* Define to 1 if you have the `wcstombs' function. */
+ #define HAVE_WCSTOMBS 1
+ 
+ /* Define to 1 if you have the <wctype.h> header file. */
+ #define HAVE_WCTYPE_H 1
+ 
+ /* Define to 1 if you have the <winldap.h> header file. */
+ /* #undef HAVE_WINLDAP_H */
+ 
+ /* Define to the appropriate snprintf format for 64-bit ints, if any. */
+ #define INT64_FORMAT "%lld"
+ 
+ /* Define to build with Kerberos 5 support. (--with-krb5) */
+ /* #undef KRB5 */
+ 
+ /* Define to the location of locale files. */
+ /* #undef LOCALEDIR */
+ 
+ /* Define as the maximum alignment requirement of any C data type. */
+ #define MAXIMUM_ALIGNOF 8
+ 
+ /* Define bytes to use libc memset(). */
+ #define MEMSET_LOOP_LIMIT 1024
+ 
+ /* Define to the address where bug reports for this package should be sent. */
+ #define PACKAGE_BUGREPORT "pgsql-bugs@postgresql.org"
+ 
+ /* Define to the full name of this package. */
+ #define PACKAGE_NAME "PostgreSQL"
+ 
+ /* Define to the full name and version of this package. */
+ #define PACKAGE_STRING "PostgreSQL 8.4devel"
+ 
+ /* Define to the version of this package. */
+ #define PACKAGE_VERSION "8.4devel"
+ 
+ /* PostgreSQL version as a string */
+ #define PG_VERSION "8.4devel"
+ 
+ /* PostgreSQL version as a number */
+ #define PG_VERSION_NUM 80400
+ 
+ /* Define to the one symbol short name of this package. */
+ #define PACKAGE_TARNAME "postgresql"
+ 
+ /* Define to the name of the default PostgreSQL service principal in Kerberos.
+    (--with-krb-srvnam=NAME) */
+ #define PG_KRB_SRVNAM "postgres"
+ 
+ /* A string containing the version number, platform, and C compiler */
+ #define PG_VERSION_STR "Uninitialized version string (win32)"
+ 
+ /* Define to the necessary symbol if this constant uses a non-standard name on
+    your system. */
+ /* #undef PTHREAD_CREATE_JOINABLE */
+ 
+ /* The size of a `size_t', as computed by sizeof. */
+ #define SIZEOF_SIZE_T 8
+ 
+ /* The size of a `unsigned long', as computed by sizeof. */
+ #define SIZEOF_UNSIGNED_LONG 4
+ 
+ /* In the LLP64 data model, sizeof(size_t) = 8, sizeof(void*) = 8, and
+    sizeof(long) = 4.  Windows x64 uses this data model, whereas most
+    POSIX systems use LP64 or ILP64. */
+ #define DATA_MODEL_LLP64
+ 
+ /* Define to 1 if you have the ANSI C header files. */
+ #define STDC_HEADERS 1
+ 
+ /* Define to 1 if strerror_r() returns a int. */
+ /* #undef STRERROR_R_INT */
+ 
+ /* Define to 1 if your <sys/time.h> declares `struct tm'. */
+ /* #undef TM_IN_SYS_TIME */
+ 
+ /* Define to the appropriate snprintf format for unsigned 64-bit ints, if any.
+    */
+ #define UINT64_FORMAT "%llu"
+ 
+ /* Define to 1 to build with assertion checks. (--enable-cassert) */
+ /* #undef USE_ASSERT_CHECKING */
+ 
+ /* Define to 1 to build with Bonjour support. (--with-bonjour) */
+ /* #undef USE_BONJOUR */
+ 
+ /* Define to 1 if you want 64-bit integer timestamp and interval support.
+    (--enable-integer-datetimes) */
+ /* #undef USE_INTEGER_DATETIMES */
+ 
+ /* Define to 1 to build with LDAP support. (--with-ldap) */
+ /* #undef USE_LDAP */
+ 
+ /* Define to select named POSIX semaphores. */
+ /* #undef USE_NAMED_POSIX_SEMAPHORES */
+ 
+ /* Define to 1 to build with PAM support. (--with-pam) */
+ /* #undef USE_PAM */
+ 
+ /* Use replacement snprintf() functions. */
+ #define USE_REPL_SNPRINTF 1
+ 
+ /* Define to build with (Open)SSL support. (--with-openssl) */
+ /* #undef USE_SSL */
+ 
+ /* Define to select SysV-style semaphores. */
+ /* #undef USE_SYSV_SEMAPHORES */
+ 
+ /* Define to select SysV-style shared memory. */
+ #define USE_SYSV_SHARED_MEMORY 1
+ 
+ /* Define to select unnamed POSIX semaphores. */
+ /* #undef USE_UNNAMED_POSIX_SEMAPHORES */
+ 
+ /* Define to select Win32-style semaphores. */
+ #define USE_WIN32_SEMAPHORES
+ 
+ /* Number of bits in a file offset, on hosts where this is settable. */
+ /* #undef _FILE_OFFSET_BITS */
+ 
+ /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+ /* #undef _LARGEFILE_SOURCE */
+ 
+ /* Define for large files, on AIX-style hosts. */
+ /* #undef _LARGE_FILES */
+ 
+ /* Define to empty if `const' does not conform to ANSI C. */
+ /* #undef const */
+ 
+ /* Define as `__inline' if that's what the C compiler calls it, or to nothing
+    if it is not supported. */
+ /* #undef inline */
+ 
+ /* Define to empty if the C compiler does not understand signed types. */
+ /* #undef signed */
+ 
+ /* Define to empty if the keyword `volatile' does not work. Warning: valid
+    code using `volatile' can become incorrect without. Disable with care. */
+ /* #undef volatile */
*** ./include/port/win64.h.orig	Wed Jul  2 22:59:01 2008
--- ./include/port/win64.h	Fri Jul  4 01:20:48 2008
***************
*** 0 ****
--- 1,326 ----
+ /* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.84 2008/02/17 02:09:31 tgl Exp $ */
+ 
+ #if defined(_MSC_VER) || defined(__BORLANDC__)
+ #define WIN32_ONLY_COMPILER
+ #endif
+ 
+ /*
+  * 0501 is the XP or Server 2003 version of the API, prior to
+  * which there was no Windows x64.  The macro must have at least
+  * this value or else there are problems with Win64 Winsock.
+  */
+ #define _WIN32_WINNT 0x0501
+ /*
+  * Always build with SSPI support. Keep it as a #define in case
+  * we want a switch to disable it sometime in the future.
+  */
+ #ifndef __BORLANDC__
+ #define ENABLE_SSPI 1
+ #endif
+ 
+ /* undefine and redefine after #include */
+ #undef mkdir
+ 
+ #undef ERROR
+ #define _WINSOCKAPI_
+ #include <windows.h>
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+ #undef small
+ #include <process.h>
+ #include <signal.h>
+ #include <errno.h>
+ #include <direct.h>
+ #ifndef __BORLANDC__
+ #include <sys/utime.h>			/* for non-unicode version */
+ #endif
+ #undef near
+ 
+ /* Must be here to avoid conflicting with prototype in windows.h */
+ #define mkdir(a,b)	mkdir(a)
+ 
+ #define HAVE_FSYNC_WRITETHROUGH
+ #define HAVE_FSYNC_WRITETHROUGH_ONLY
+ #define ftruncate(a,b)	chsize(a,b)
+ /*
+  *	Even though we don't support 'fsync' as a wal_sync_method,
+  *	we do fsync() a few other places where _commit() is just fine.
+  */
+ #define fsync(fd) _commit(fd)
+ 
+ #define USES_WINSOCK
+ 
+ /* defines for dynamic linking on Win32 platform */
+ #if defined(WIN32) || defined(__CYGWIN__)
+ 
+ #if __GNUC__ && ! defined (__declspec)
+ #error You need egcs 1.1 or newer for compiling!
+ #endif
+ 
+ #ifdef BUILDING_DLL
+ #define PGDLLIMPORT __declspec (dllexport)
+ #else							/* not BUILDING_DLL */
+ #define PGDLLIMPORT __declspec (dllimport)
+ #endif
+ #else							/* not CYGWIN, not MSVC, not MingW */
+ 
+ #define PGDLLIMPORT
+ #endif
+ 
+ 
+ /*
+  *	IPC defines
+  */
+ #undef HAVE_UNION_SEMUN
+ #define HAVE_UNION_SEMUN 1
+ 
+ #define IPC_RMID 256
+ #define IPC_CREAT 512
+ #define IPC_EXCL 1024
+ #define IPC_PRIVATE 234564
+ #define IPC_NOWAIT	2048
+ #define IPC_STAT 4096
+ 
+ #define EACCESS 2048
+ #define EIDRM 4096
+ 
+ #define SETALL 8192
+ #define GETNCNT 16384
+ #define GETVAL 65536
+ #define SETVAL 131072
+ #define GETPID 262144
+ 
+ 
+ /*
+  *	Signal stuff
+  *
+  *	For WIN32, there is no wait() call so there are no wait() macros
+  *	to interpret the return value of system().	Instead, system()
+  *	return values < 0x100 are used for exit() termination, and higher
+  *	values are used to indicated non-exit() termination, which is
+  *	similar to a unix-style signal exit (think SIGSEGV ==
+  *	STATUS_ACCESS_VIOLATION).  Return values are broken up into groups:
+  *
+  *	http://msdn2.microsoft.com/en-gb/library/aa489609.aspx
+  *
+  *		NT_SUCCESS			0 - 0x3FFFFFFF
+  *		NT_INFORMATION		0x40000000 - 0x7FFFFFFF
+  *		NT_WARNING			0x80000000 - 0xBFFFFFFF
+  *		NT_ERROR			0xC0000000 - 0xFFFFFFFF
+  *
+  *	Effectively, we don't care on the severity of the return value from
+  *	system(), we just need to know if it was because of exit() or generated
+  *	by the system, and it seems values >= 0x100 are system-generated.
+  *	See this URL for a list of WIN32 STATUS_* values:
+  *
+  *		Wine (URL used in our error messages) -
+  *			http://source.winehq.org/source/include/ntstatus.h
+  *		Descriptions - http://www.comp.nus.edu.sg/~wuyongzh/my_doc/ntstatus.txt
+  *		MS SDK - http://www.nologs.com/ntstatus.html
+  *
+  *	It seems the exception lists are in both ntstatus.h and winnt.h, but
+  *	ntstatus.h has a more comprehensive list, and it only contains
+  *	exception values, rather than winnt, which contains lots of other
+  *	things:
+  *
+  *		http://www.microsoft.com/msj/0197/exception/exception.aspx
+  *
+  *		The ExceptionCode parameter is the number that the operating system
+  *		assigned to the exception. You can see a list of various exception codes
+  *		in WINNT.H by searching for #defines that start with "STATUS_". For
+  *		example, the code for the all-too-familiar STATUS_ACCESS_VIOLATION is
+  *		0xC0000005. A more complete set of exception codes can be found in
+  *		NTSTATUS.H from the Windows NT DDK.
+  *
+  *	Some day we might want to print descriptions for the most common
+  *	exceptions, rather than printing an include file name.	We could use
+  *	RtlNtStatusToDosError() and pass to FormatMessage(), which can print
+  *	the text of error values, but MinGW does not support
+  *	RtlNtStatusToDosError().
+  */
+ #define WIFEXITED(w)	(((w) & 0XFFFFFF00) == 0)
+ #define WIFSIGNALED(w)	(!WIFEXITED(w))
+ #define WEXITSTATUS(w)	(w)
+ #define WTERMSIG(w)		(w)
+ 
+ #define sigmask(sig) ( 1 << ((sig)-1) )
+ 
+ /* Signal function return values */
+ #undef SIG_DFL
+ #undef SIG_ERR
+ #undef SIG_IGN
+ #define SIG_DFL ((pqsigfunc)0)
+ #define SIG_ERR ((pqsigfunc)-1)
+ #define SIG_IGN ((pqsigfunc)1)
+ 
+ /* Some extra signals */
+ #define SIGHUP				1
+ #define SIGQUIT				3
+ #define SIGTRAP				5
+ #define SIGABRT				22	/* Set to match W32 value -- not UNIX value */
+ #define SIGKILL				9
+ #define SIGPIPE				13
+ #define SIGALRM				14
+ #define SIGSTOP				17
+ #define SIGTSTP				18
+ #define SIGCONT				19
+ #define SIGCHLD				20
+ #define SIGTTIN				21
+ #define SIGTTOU				22	/* Same as SIGABRT -- no problem, I hope */
+ #define SIGWINCH			28
+ #ifndef __BORLANDC__
+ #define SIGUSR1				30
+ #define SIGUSR2				31
+ #endif
+ 
+ /*
+  * New versions of mingw have gettimeofday() and also declare
+  * struct timezone to support it.
+  */
+ #ifndef HAVE_GETTIMEOFDAY
+ struct timezone
+ {
+ 	int			tz_minuteswest; /* Minutes west of GMT.  */
+ 	int			tz_dsttime;		/* Nonzero if DST is ever in effect.  */
+ };
+ #endif
+ 
+ /* for setitimer in backend/port/win32/timer.c */
+ #define ITIMER_REAL 0
+ struct itimerval
+ {
+ 	struct timeval it_interval;
+ 	struct timeval it_value;
+ };
+ 
+ int			setitimer(int which, const struct itimerval * value, struct itimerval * ovalue);
+ 
+ 
+ /*
+  * Supplement to <sys/types.h>.
+  *
+  * Perl already has typedefs for uid_t and gid_t.
+  */
+ #ifndef PLPERL_HAVE_UID_GID
+ typedef int uid_t;
+ typedef int gid_t;
+ #endif
+ typedef long key_t;
+ 
+ #ifdef WIN32_ONLY_COMPILER
+ typedef int pid_t;
+ #endif
+ 
+ /*
+  * Supplement to <sys/stat.h>.
+  */
+ #define lstat(path, sb) stat((path), (sb))
+ 
+ /*
+  * Supplement to <fcntl.h>.
+  * This is the same value as _O_NOINHERIT in the MS header file. This is
+  * to ensure that we don't collide with a future definition. It means
+  * we cannot use _O_NOINHERIT ourselves.
+  */
+ #define O_DSYNC 0x0080
+ 
+ /*
+  * Supplement to <errno.h>.
+  */
+ #undef EAGAIN
+ #undef EINTR
+ #define EINTR WSAEINTR
+ #define EAGAIN WSAEWOULDBLOCK
+ #define EMSGSIZE WSAEMSGSIZE
+ #define EAFNOSUPPORT WSAEAFNOSUPPORT
+ #define EWOULDBLOCK WSAEWOULDBLOCK
+ #define ECONNRESET WSAECONNRESET
+ #define EINPROGRESS WSAEINPROGRESS
+ #define ENOBUFS WSAENOBUFS
+ #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
+ #define ECONNREFUSED WSAECONNREFUSED
+ #define EBADFD WSAENOTSOCK
+ #define EOPNOTSUPP WSAEOPNOTSUPP
+ 
+ 
+ /* In backend/port/win32/signal.c */
+ extern PGDLLIMPORT volatile int pg_signal_queue;
+ extern PGDLLIMPORT int pg_signal_mask;
+ extern HANDLE pgwin32_signal_event;
+ extern HANDLE pgwin32_initial_signal_pipe;
+ 
+ #define UNBLOCKED_SIGNAL_QUEUE()	(pg_signal_queue & ~pg_signal_mask)
+ 
+ 
+ void		pgwin32_signal_initialize(void);
+ HANDLE		pgwin32_create_signal_listener(pid_t pid);
+ void		pgwin32_dispatch_queued_signals(void);
+ void		pg_queue_signal(int signum);
+ 
+ /* In backend/port/win32/socket.c */
+ #ifndef FRONTEND
+ #define socket(af, type, protocol) pgwin32_socket(af, type, protocol)
+ #define accept(s, addr, addrlen) pgwin32_accept(s, addr, addrlen)
+ #define connect(s, name, namelen) pgwin32_connect(s, name, namelen)
+ #define select(n, r, w, e, timeout) pgwin32_select(n, r, w, e, timeout)
+ #define recv(s, buf, len, flags) pgwin32_recv(s, buf, len, flags)
+ #define send(s, buf, len, flags) pgwin32_send(s, buf, len, flags)
+ 
+ SOCKET		pgwin32_socket(int af, int type, int protocol);
+ SOCKET		pgwin32_accept(SOCKET s, struct sockaddr * addr, int *addrlen);
+ int			pgwin32_connect(SOCKET s, const struct sockaddr * name, int namelen);
+ int			pgwin32_select(int nfds, fd_set *readfs, fd_set *writefds, fd_set *exceptfds, const struct timeval * timeout);
+ int			pgwin32_recv(SOCKET s, char *buf, int len, int flags);
+ int			pgwin32_send(SOCKET s, char *buf, int len, int flags);
+ 
+ const char *pgwin32_socket_strerror(int err);
+ int			pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout);
+ 
+ /* in backend/port/win32/security.c */
+ extern int	pgwin32_is_admin(void);
+ extern int	pgwin32_is_service(void);
+ #endif
+ 
+ /* in port/win32error.c */
+ extern void _dosmaperr(unsigned long);
+ 
+ 
+ /* Things that exist in MingW headers, but need to be added to MSVC */
+ #ifdef WIN32_ONLY_COMPILER
+ typedef long ssize_t;
+ #ifndef __BORLANDC__
+ typedef unsigned short mode_t;
+ #endif
+ 
+ /*
+  *	Certain "standard edition" versions of MSVC throw a warning
+  *	that later generates an error for "inline" statements, but
+  *	__inline seems to work.  e.g.  Microsoft Visual C++ .NET
+  *	Version 7.1.3088
+  */
+ #define inline __inline
+ #define __inline__ __inline
+ 
+ #ifndef __BORLANDC__
+ #define _S_IRWXU	(_S_IREAD | _S_IWRITE | _S_IEXEC)
+ #define _S_IXUSR	_S_IEXEC
+ #define _S_IWUSR	_S_IWRITE
+ #define _S_IRUSR	_S_IREAD
+ #define S_IRUSR		_S_IRUSR
+ #define S_IWUSR		_S_IWUSR
+ #define S_IXUSR		_S_IXUSR
+ #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+ #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+ #endif
+ 
+ #define F_OK 0
+ #define W_OK 2
+ #define R_OK 4
+ 
+ #define isinf(x) ((_fpclass(x) == _FPCLASS_PINF) || (_fpclass(x) == _FPCLASS_NINF))
+ #define isnan(x) _isnan(x)
+ 
+ /* Pulled from Makefile.port in mingw */
+ #define DLSUFFIX ".dll"
+ 
+ #endif
*** ./include/storage/s_lock.h.orig	Thu Jul  3 15:43:56 2008
--- ./include/storage/s_lock.h	Fri Jul  4 02:28:25 2008
***************
*** 806,817 ****
--- 806,828 ----
  
  #define SPIN_DELAY() spin_delay()
  
+ /* If using Visual C 2005 or 2008 on Win64, inline assembly is unavailable.  Use a __noop instrinsic instead
+   * of rep nop.  Might be slightly less efficient on EMT64, but its the same for AMD.
+   */
+ #if defined(_WIN64) && defined(_MSC_VER) && (_MSC_VER == 1400 || _MSC_VER == 1500)
+ static __forceinline void
+ spin_delay(void)
+ {
+ 	__noop();
+ }
+ #else
  static __forceinline void
  spin_delay(void)
  {
  	/* See comment for gcc code. Same code, MASM syntax */
  	__asm rep nop;
  }
+ #endif
  
  #endif
  
*** ./tools/msvc/Mkvcbuild.pm.orig	Wed Jul  2 19:32:53 2008
--- ./tools/msvc/Mkvcbuild.pm	Mon Jul  7 13:54:15 2008
***************
*** 70,76 ****
      $postgres->AddLibrary('ws2_32.lib');
      $postgres->AddLibrary('secur32.lib');
      $postgres->AddLibrary('wldap32.lib') if ($solution->{options}->{ldap});
!     $postgres->FullExportDLL('postgres.lib');
  
      my $snowball = $solution->AddProject('dict_snowball','dll','','src\backend\snowball');
      $snowball->RelocateFiles('src\backend\snowball\libstemmer', sub {
--- 70,76 ----
      $postgres->AddLibrary('ws2_32.lib');
      $postgres->AddLibrary('secur32.lib');
      $postgres->AddLibrary('wldap32.lib') if ($solution->{options}->{ldap});
!     $postgres->FullExportDLL('postgres.lib');   
  
      my $snowball = $solution->AddProject('dict_snowball','dll','','src\backend\snowball');
      $snowball->RelocateFiles('src\backend\snowball\libstemmer', sub {
***************
*** 104,110 ****
              }
          }
          $plperl->AddReference($postgres);
!         $plperl->AddLibrary($solution->{options}->{perl} . '\lib\CORE\perl58.lib');
      }
  
      if ($solution->{options}->{python})
--- 104,110 ----
              }
          }
          $plperl->AddReference($postgres);
!         $plperl->AddLibrary($solution->{options}->{perl} . "\\" . $solution->{options}->{perllib});
      }
  
      if ($solution->{options}->{python})
***************
*** 364,369 ****
--- 364,383 ----
      $pgregress->AddReference($libpgport);
  
      $solution->Save();
+ 	
+     # If this is Studio 2008 and up, then the projects need up be upgraded first
+     if ($config->{msvc_version} ge 1500)
+     {
+         print "Converting projects to current Visual Studio version...\n";
+         foreach my $fld (keys %{$solution->{projects}})
+         {
+             foreach my $proj (@{$solution->{projects}->{$fld}})
+             {
+                 print "\n\nUpgrading $proj->{name}\n\n";
+                 system("vcbuild /upgrade $proj->{name}.vcproj");
+             }
+         }
+ 	}
  }
  
  #####################
*** ./tools/msvc/Project.pm.orig	Wed Jul  2 19:11:05 2008
--- ./tools/msvc/Project.pm	Mon Jul  7 13:56:33 2008
***************
*** 338,343 ****
--- 338,344 ----
  sub Save
  {
      my ($self) = @_;
+     my $platform = $self->{solution}->{options}->{platform};
  
      # If doing DLL and haven't specified a DEF file, do a full export of all symbols
      # in the project.
***************
*** 391,397 ****
              $of =~ s{^src\\pl\\plpgsql\\src\\gram.c$}{src\\pl\\plpgsql\\src\\pl_gram.c};
              print F '>'
                . GenerateCustomTool('Running bison on ' . $f,
!                 'cmd /V:ON /c src\tools\msvc\pgbison.bat ' . $f, $of)
                . '</File>' . "\n";
          }
          elsif ($f =~ /\.l$/)
--- 392,398 ----
              $of =~ s{^src\\pl\\plpgsql\\src\\gram.c$}{src\\pl\\plpgsql\\src\\pl_gram.c};
              print F '>'
                . GenerateCustomTool('Running bison on ' . $f,
!                 'cmd /V:ON /c src\tools\msvc\pgbison.bat ' . $f, $of, $platform)
                . '</File>' . "\n";
          }
          elsif ($f =~ /\.l$/)
***************
*** 400,406 ****
              $of =~ s/\.l$/.c/;
              $of =~ s{^src\\pl\\plpgsql\\src\\scan.c$}{src\\pl\\plpgsql\\src\\pl_scan.c};
              print F '>'
!               . GenerateCustomTool('Running flex on ' . $f, 'src\tools\msvc\pgflex.bat ' . $f,$of)
                . '</File>' . "\n";
          }
          elsif (defined($uniquefiles{$file}))
--- 401,407 ----
              $of =~ s/\.l$/.c/;
              $of =~ s{^src\\pl\\plpgsql\\src\\scan.c$}{src\\pl\\plpgsql\\src\\pl_scan.c};
              print F '>'
!               . GenerateCustomTool('Running flex on ' . $f, 'src\tools\msvc\pgflex.bat ' . $f,$of, $platform)
                . '</File>' . "\n";
          }
          elsif (defined($uniquefiles{$file}))
***************
*** 410,417 ****
              my $obj = $dir;
              $obj =~ s/\\/_/g;
              print F
! "><FileConfiguration Name=\"Debug|Win32\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\debug\\$self->{name}\\$obj"
!               . "_$file.obj\" /></FileConfiguration><FileConfiguration Name=\"Release|Win32\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\release\\$self->{name}\\$obj"
                . "_$file.obj\" /></FileConfiguration></File>\n";
          }
          else
--- 411,418 ----
              my $obj = $dir;
              $obj =~ s/\\/_/g;
              print F
! "><FileConfiguration Name=\"Debug|$platform\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\debug\\$self->{name}\\$obj"
!               . "_$file.obj\" /></FileConfiguration><FileConfiguration Name=\"Release|$platform\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\release\\$self->{name}\\$obj"
                . "_$file.obj\" /></FileConfiguration></File>\n";
          }
          else
***************
*** 431,444 ****
  
  sub GenerateCustomTool
  {
!     my ($desc, $tool, $output, $cfg) = @_;
      if (!defined($cfg))
      {
!         return GenerateCustomTool($desc, $tool, $output, 'Debug')
!           .GenerateCustomTool($desc, $tool, $output, 'Release');
      }
      return
! "<FileConfiguration Name=\"$cfg|Win32\"><Tool Name=\"VCCustomBuildTool\" Description=\"$desc\" CommandLine=\"$tool\" AdditionalDependencies=\"\" Outputs=\"$output\" /></FileConfiguration>";
  }
  
  sub WriteReferences
--- 432,445 ----
  
  sub GenerateCustomTool
  {
!     my ($desc, $tool, $output, $platform, $cfg) = @_;
      if (!defined($cfg))
      {
!         return GenerateCustomTool($desc, $tool, $output, $platform, 'Debug')
!           .GenerateCustomTool($desc, $tool, $output, $platform, 'Release');
      }
      return
! "<FileConfiguration Name=\"$cfg|$platform\"><Tool Name=\"VCCustomBuildTool\" Description=\"$desc\" CommandLine=\"$tool\" AdditionalDependencies=\"\" Outputs=\"$output\" /></FileConfiguration>";
  }
  
  sub WriteReferences
***************
*** 456,466 ****
  sub WriteHeader
  {
      my ($self, $f) = @_;
! 
      print $f <<EOF;
  <?xml version="1.0" encoding="Windows-1252"?>
  <VisualStudioProject ProjectType="Visual C++" Version="8.00" Name="$self->{name}" ProjectGUID="$self->{guid}">
!  <Platforms><Platform Name="Win32"/></Platforms>
   <Configurations>
  EOF
      $self->WriteConfiguration($f, 'Debug',
--- 457,468 ----
  sub WriteHeader
  {
      my ($self, $f) = @_;
!     my $platform = $self->{solution}->{options}->{platform};
! 	
      print $f <<EOF;
  <?xml version="1.0" encoding="Windows-1252"?>
  <VisualStudioProject ProjectType="Visual C++" Version="8.00" Name="$self->{name}" ProjectGUID="$self->{guid}">
!  <Platforms><Platform Name="$platform"/></Platforms>
   <Configurations>
  EOF
      $self->WriteConfiguration($f, 'Debug',
***************
*** 478,483 ****
--- 480,534 ----
      my $cfgtype = ($self->{type} eq "exe")?1:($self->{type} eq "dll"?2:4);
      my $libcfg = (uc $cfgname eq "RELEASE")?"MD":"MDd";
      my $libs = '';
+ 	my $minimal_rebuild = 'MinimalRebuild="true"';
+ 	my $local_compiler_opt = $self->{solution}->{options}->{compiler_opt};
+ 	my $local_linker_opt = $self->{solution}->{options}->{linker_opt};
+ 	my $platform = $self->{solution}->{options}->{platform};
+ 	
+     # Add the /MP switch to the additional compiler options if both msvc_parallel_compile is enabled
+     # and compiler version is at least 2008. This is incompatible with Minimal Rebuild (/GM) so
+     # disable it in this case, otherwise keep it
+     if ($self->{solution}->{options}->{msvc_parallel_compile} eq 1 &&
+         $self->{solution}->{options}->{msvc_version} ge 1500)
+     {
+         $local_compiler_opt .= ' ' unless ($local_compiler_opt eq '');
+         $local_compiler_opt .= '/MP';
+         $minimal_rebuild = 'MinimalRebuild="false"';
+     }
+ 
+     # We should specify the target machine as an additional option, since Microsoft uses cryptic
+     # undocumented codes for different target platforms.
+     $local_linker_opt .= ' ' unless ($local_linker_opt eq ''); # add a space
+     if ($platform eq 'Win32')
+     {
+         $local_linker_opt .= '/Machine:X86';
+     }
+ 	elsif ($platform eq 'x64')
+ 	{
+ 	    $local_linker_opt .= '/Machine:X64';
+     }
+     else
+     {
+         die 'That platform is not supported';
+     }
+ 	
+     # if we're using x64, we need to disable LNK4197.  This link explains why:
+ 	# http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99193
+     if ($platform eq 'x64')
+     {
+         # from some reason (?) it is an error to specify this together with the other /ignore arguments...
+         # making it separate makes the error disappear
+         $local_linker_opt .= ' ' unless ($local_linker_opt eq ''); # add a space
+ 		$local_linker_opt .= '/ignore:4197';
+     }
+ 		
+     # Fold the disable linker warnings stuff into the local_linker_opt variable
+     if ($self->{disablelinkerwarnings})
+     {
+ 		$local_linker_opt .= ' ' unless ($local_linker_opt eq ''); # add a space
+         $local_linker_opt .= "/ignore:$self->{disablelinkerwarnings}";
+     }
+ 	
      foreach my $lib (@{$self->{libraries}})
      {
          my $xlib = $lib;
***************
*** 494,503 ****
      $libs =~ s/ $//;
      $libs =~ s/__CFGNAME__/$cfgname/g;
      print $f <<EOF;
!   <Configuration Name="$cfgname|Win32" OutputDirectory=".\\$cfgname\\$self->{name}" IntermediateDirectory=".\\$cfgname\\$self->{name}"
  	ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2" WholeProgramOptimization="$p->{wholeopt}">
  	<Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"
  		AdditionalIncludeDirectories="$self->{prefixincludes}src/include;src/include/port/win32;src/include/port/win32_msvc;$self->{includes}"
  		PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$self->{defines}$p->{defs}"
  		StringPooling="$p->{strpool}"
  		RuntimeLibrary="$p->{runtime}" DisableSpecificWarnings="$self->{disablewarnings}"
--- 545,556 ----
      $libs =~ s/ $//;
      $libs =~ s/__CFGNAME__/$cfgname/g;
      print $f <<EOF;
!   <Configuration Name="$cfgname|$platform" OutputDirectory=".\\$cfgname\\$self->{name}" IntermediateDirectory=".\\$cfgname\\$self->{name}"
  	ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2" WholeProgramOptimization="$p->{wholeopt}">
  	<Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"
+ 		AdditionalOptions="$local_compiler_opt"
  		AdditionalIncludeDirectories="$self->{prefixincludes}src/include;src/include/port/win32;src/include/port/win32_msvc;$self->{includes}"
+ 		$minimal_rebuild
  		PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$self->{defines}$p->{defs}"
  		StringPooling="$p->{strpool}"
  		RuntimeLibrary="$p->{runtime}" DisableSpecificWarnings="$self->{disablewarnings}"
***************
*** 507,523 ****
  		ProgramDataBaseFileName=".\\$cfgname\\$self->{name}\\" BrowseInformation="0"
  		WarningLevel="3" SuppressStartupBanner="TRUE" DebugInformationFormat="3" CompileAs="0"/>
  	<Tool Name="VCLinkerTool" OutputFile=".\\$cfgname\\$self->{name}\\$self->{name}.$self->{type}"
  		AdditionalDependencies="$libs"
  		LinkIncremental="0" SuppressStartupBanner="TRUE" AdditionalLibraryDirectories="" IgnoreDefaultLibraryNames="libc"
  		StackReserveSize="4194304" DisableSpecificWarnings="$self->{disablewarnings}"
  		GenerateDebugInformation="TRUE" ProgramDatabaseFile=".\\$cfgname\\$self->{name}\\$self->{name}.pdb"
  		GenerateMapFile="FALSE" MapFileName=".\\$cfgname\\$self->{name}\\$self->{name}.map"
! 		SubSystem="1" TargetMachine="1"
  EOF
-     if ($self->{disablelinkerwarnings})
-     {
-         print $f "\t\tAdditionalOptions=\"/ignore:$self->{disablelinkerwarnings}\"\n";
-     }
      if ($self->{implib})
      {
          my $l = $self->{implib};
--- 560,573 ----
  		ProgramDataBaseFileName=".\\$cfgname\\$self->{name}\\" BrowseInformation="0"
  		WarningLevel="3" SuppressStartupBanner="TRUE" DebugInformationFormat="3" CompileAs="0"/>
  	<Tool Name="VCLinkerTool" OutputFile=".\\$cfgname\\$self->{name}\\$self->{name}.$self->{type}"
+ 		AdditionalOptions="$local_linker_opt"
  		AdditionalDependencies="$libs"
  		LinkIncremental="0" SuppressStartupBanner="TRUE" AdditionalLibraryDirectories="" IgnoreDefaultLibraryNames="libc"
  		StackReserveSize="4194304" DisableSpecificWarnings="$self->{disablewarnings}"
  		GenerateDebugInformation="TRUE" ProgramDatabaseFile=".\\$cfgname\\$self->{name}\\$self->{name}.pdb"
  		GenerateMapFile="FALSE" MapFileName=".\\$cfgname\\$self->{name}\\$self->{name}.map"
! 		SubSystem="1"
  EOF
      if ($self->{implib})
      {
          my $l = $self->{implib};
***************
*** 538,545 ****
        "\t<Tool Name=\"VCResourceCompilerTool\" AdditionalIncludeDirectories=\"src\\include\" />\n";
      if ($self->{builddef})
      {
          print $f
! "\t<Tool Name=\"VCPreLinkEventTool\" Description=\"Generate DEF file\" CommandLine=\"perl src\\tools\\msvc\\gendef.pl $cfgname\\$self->{name}\" />\n";
      }
      print $f <<EOF;
    </Configuration>
--- 588,598 ----
        "\t<Tool Name=\"VCResourceCompilerTool\" AdditionalIncludeDirectories=\"src\\include\" />\n";
      if ($self->{builddef})
      {
+         # gendef needs to be passed the platform now, because the x64 COFF ABI is different
+         # than the 32 bit ABI.  The old one placed a _ in front of all the symbols we need, while
+         # the x64 version has no special prefix
          print $f
! "\t<Tool Name=\"VCPreLinkEventTool\" Description=\"Generate DEF file\" CommandLine=\"perl src\\tools\\msvc\\gendef.pl $cfgname\\$self->{name} $platform\" />\n";
      }
      print $f <<EOF;
    </Configuration>
*** ./tools/msvc/Solution.pm.orig	Wed Jul  2 18:27:55 2008
--- ./tools/msvc/Solution.pm	Thu Jul  3 15:51:11 2008
***************
*** 87,93 ****
  sub GenerateFiles
  {
      my $self = shift;
! 
      # Parse configure.in to get version numbers
      open(C,"configure.in") || confess("Could not open configure.in for reading\n");
      while (<C>)
--- 87,93 ----
  sub GenerateFiles
  {
      my $self = shift;
! 	
      # Parse configure.in to get version numbers
      open(C,"configure.in") || confess("Could not open configure.in for reading\n");
      while (<C>)
***************
*** 107,122 ****
      confess "Unable to parse configure.in for all variables!"
        if ($self->{strver} eq '' || $self->{numver} eq '');
  
!     if (IsNewer("src\\include\\pg_config_os.h","src\\include\\port\\win32.h"))
      {
          print "Copying pg_config_os.h...\n";
!         copyFile("src\\include\\port\\win32.h","src\\include\\pg_config_os.h");
      }
! 
!     if (IsNewer("src\\include\\pg_config.h","src\\include\\pg_config.h.win32"))
      {
          print "Generating pg_config.h...\n";
!         open(I,"src\\include\\pg_config.h.win32") || confess "Could not open pg_config.h.win32\n";
          open(O,">src\\include\\pg_config.h") || confess "Could not write to pg_config.h\n";
          while (<I>)
          {
--- 107,133 ----
      confess "Unable to parse configure.in for all variables!"
        if ($self->{strver} eq '' || $self->{numver} eq '');
  
!     # Configuration is different for Win32 and Win64.  There is now a
!     # win64.h port include and a pg_config.h.win64 configuration include
!     my $bits = '';
!     if ($self->{options}->{platform} eq 'Win32')
!     {
!         $bits = '32';
!     }
! 	elsif ($self->{options}->{platform} eq 'x64')
!     {
!         $bits = '64';
!     }
! 	
!     if (IsNewer("src\\include\\pg_config_os.h","src\\include\\port\\win$bits.h"))
      {
          print "Copying pg_config_os.h...\n";
!         copyFile("src\\include\\port\\win$bits.h","src\\include\\pg_config_os.h");
      }
!     if (IsNewer("src\\include\\pg_config.h","src\\include\\pg_config.h.win$bits"))
      {
          print "Generating pg_config.h...\n";
!         open(I,"src\\include\\pg_config.h.win$bits") || confess "Could not open pg_config.h.win$bits\n";
          open(O,">src\\include\\pg_config.h") || confess "Could not write to pg_config.h\n";
          while (<I>)
          {
***************
*** 125,130 ****
--- 136,151 ----
  s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY(z)\n#define PG_VERSION_STR "PostgreSQL $self->{strver}, compiled by Visual C++ build " __STRINGIFY2(_MSC_VER)};
              print O;
          }
+ 		
+         # Microsoft Visual C 2008 will define the macro REPEATABLE, which will conflict with a symbol generated by
+         # src/backend/parser/gram.y
+         if ($self->{options}->{msvc_version} ge 1500)
+         {
+             print O "#ifdef REPEATABLE\n";
+             print O "#undef REPEATABLE\n";
+             print O "#endif\n";
+         }
+ 		
          print O "#define LOCALEDIR \"/share/locale\"\n" if ($self->{options}->{nls});
          print O "/* defines added by config steps */\n";
          print O "#ifndef IGNORE_CONFIGURED_SETTINGS\n";
***************
*** 162,168 ****
          {
              print O "#define FLOAT8PASSBYVAL false\n";
          }
- 
          if ($self->{options}->{uuid})
          {
              print O "#define HAVE_UUID_H\n";
--- 183,188 ----
***************
*** 409,416 ****
      print SLN <<EOF;
  Global
  	GlobalSection(SolutionConfigurationPlatforms) = preSolution
! 		Debug|Win32 = Debug|Win32
! 		Release|Win32 = Release|Win32
  	EndGlobalSection
  	GlobalSection(ProjectConfigurationPlatforms) = postSolution
  EOF
--- 429,436 ----
      print SLN <<EOF;
  Global
  	GlobalSection(SolutionConfigurationPlatforms) = preSolution
! 		Debug|$self->{options}->{platform} = Debug|$self->{options}->{platform}
! 		Release|$self->{options}->{platform} = Release|$self->{options}->{platform}
  	EndGlobalSection
  	GlobalSection(ProjectConfigurationPlatforms) = postSolution
  EOF
***************
*** 420,429 ****
          foreach my $proj (@{$self->{projects}->{$fld}})
          {
              print SLN <<EOF;
! 		$proj->{guid}.Debug|Win32.ActiveCfg = Debug|Win32
! 		$proj->{guid}.Debug|Win32.Build.0  = Debug|Win32	
! 		$proj->{guid}.Release|Win32.ActiveCfg = Release|Win32
! 		$proj->{guid}.Release|Win32.Build.0 = Release|Win32
  EOF
          }
      }
--- 440,449 ----
          foreach my $proj (@{$self->{projects}->{$fld}})
          {
              print SLN <<EOF;
! 		$proj->{guid}.Debug|$self->{options}->{platform}.ActiveCfg = Debug|$self->{options}->{platform}
! 		$proj->{guid}.Debug|$self->{options}->{platform}.Build.0  = Debug|$self->{options}->{platform}
! 		$proj->{guid}.Release|$self->{options}->{platform}.ActiveCfg = Release|$self->{options}->{platform}
! 		$proj->{guid}.Release|$self->{options}->{platform}.Build.0 = Release|$self->{options}->{platform}
  EOF
          }
      }
*** ./tools/msvc/clean.bat.orig	Wed Jul  2 22:38:09 2008
--- ./tools/msvc/clean.bat	Thu Jul  3 18:22:40 2008
***************
*** 1,4 ****
! @echo off
  REM $PostgreSQL: pgsql/src/tools/msvc/clean.bat,v 1.12 2008/06/24 01:15:36 tgl Exp $
  
  set DIST=0
--- 1,4 ----
!  @echo off
  REM $PostgreSQL: pgsql/src/tools/msvc/clean.bat,v 1.12 2008/06/24 01:15:36 tgl Exp $
  
  set DIST=0
***************
*** 9,16 ****
--- 9,21 ----
  
  if exist debug rd /s /q debug
  if exist release rd /s /q release
+ if exist _UpgradeReport_Files rd /s /q _UpgradeReport_Files
+ for %%f in (UpgradeLog*.xml) do del %%f
+ for %%f in (*.old) do del %%f
+ for %%f in (*.user) do del %%f
  for %%f in (*.vcproj) do del %%f
  if exist pgsql.sln del /q pgsql.sln
+ if exist pgsql.ncb del /q pgsql.ncb
  del /s /q src\bin\win32ver.rc 2> NUL
  del /s /q src\interfaces\win32ver.rc 2> NUL
  if exist src\backend\win32ver.rc del /q src\backend\win32ver.rc
*** ./tools/msvc/config.pl.orig	Wed Jul  2 18:09:01 2008
--- ./tools/msvc/config.pl	Thu Jul  3 21:23:44 2008
***************
*** 3,8 ****
--- 3,15 ----
  use warnings;
  
  our $config = {
+     # new configuration options
+     msvc_version=>1500, # 1400 = VC 2005, 1500 = VC 2008
+     msvc_parallel_compile=>1, # 2008 only, compile multiple .c in ||
+     platform=>'x64', # 'Win32' for x86, 'x64' for x64
+     compiler_opt=>'', # additional compiler command line arguments
+     linker_opt=>'', #additional linker command line arguments
+ 	
      asserts=>0,			# --enable-cassert
      # integer_datetimes=>1,   # --enable-integer-datetimes - on is now default
      # float4byval=>1,         # --disable-float4-byval, on by default
***************
*** 13,18 ****
--- 20,26 ----
      nls=>undef,				# --enable-nls=<path>
      tcl=>undef,		# --with-tls=<path>
      perl=>'c:\perl64', 			# --with-perl
+     perllib=>'lib\CORE\perl510.lib', # the library, relative path
      python=>undef, # --with-python=<path>
      krb5=>undef, # --with-krb5=<path>
      ldap=>0,			# --with-ldap
*** ./tools/msvc/gendef.pl.orig	Thu Jul  3 20:52:57 2008
--- ./tools/msvc/gendef.pl	Mon Jul  7 13:58:51 2008
***************
*** 5,28 ****
  # $PostgreSQL: pgsql/src/tools/msvc/gendef.pl,v 1.8 2008/01/31 16:30:24 adunstan Exp $
  #
  
! die "Usage: gendef.pl <modulepath>\n" unless ($ARGV[0] =~ /\\([^\\]+$)/);
  my $defname = uc $1;
  
! if (-f "$ARGV[0]/$defname.def")
  {
      print "Not re-generating $defname.DEF, file already exists.\n";
      exit(0);
  }
  
  print "Generating $defname.DEF from directory $ARGV[0]\n";
  
! while (<$ARGV[0]/*.obj>)
  {
!     my $symfile = $_;
!     $symfile=~ s/\.obj$/.sym/i;
      print ".";
!     system("dumpbin /symbols /out:symbols.out $_ >NUL") && die "Could not call dumpbin";
!     open(F, "<symbols.out") || die "Could not open symbols.out for $_\n";
      while (<F>)
      {
          s/\(\)//g;
--- 5,42 ----
  # $PostgreSQL: pgsql/src/tools/msvc/gendef.pl,v 1.8 2008/01/31 16:30:24 adunstan Exp $
  #
  
! die "Usage: gendef.pl <modulepath> <platform>\n" unless ($ARGV[0] =~ /\\([^\\]+$)/ &&
!     ($ARGV[1] == 'Win32' || $ARGV[1] == 'x64'));
  my $defname = uc $1;
  
! # First, change to the project directory.  Instead of producing symbol.out in the root directory
! # like before and then and renaming it to (configuration)/project/(object file).sym, we directly
! # output the symbol table as ((object file base name).sym.  The reason for doing this is that when
! # compiling in parallel, several attempts might be made to work on the same file (symbols.out)
! # but this way we can keep everything separate. 
! chdir($ARGV[0]);
! 
! if (-f "$defname.def")
  {
      print "Not re-generating $defname.DEF, file already exists.\n";
      exit(0);
  }
  
+ # We need access to the platform, because the symbol tables are different for Win32 and x64.
+ # The x64 symbols don't have a leading _ character, unlike their 32-bit counterparts
+ $platform = $ARGV[1];
+ 
  print "Generating $defname.DEF from directory $ARGV[0]\n";
  
! while (<*.obj>)
  {
!     my $objectfile = $_;
! 	$symfile = $objectfile;
!     $symfile =~ s/\.obj$/.sym/i;
! 	
      print ".";
!     system("dumpbin /symbols /out:$symfile $objectfile >NUL") && die "Could not call dumpbin";
!     open(F, "<$symfile") || die "Could not open $symfile for $_\n";
      while (<F>)
      {
          s/\(\)//g;
***************
*** 39,53 ****
          next if $pieces[6] =~ /^__IMPORT_DESCRIPTOR/;
          next if $pieces[6] =~ /^__NULL_IMPORT/;
          next if $pieces[6] =~ /^\?\?_C/;
- 
          push @def, $pieces[6];
      }
      close(F);
-     rename("symbols.out",$symfile);
  }
  print "\n";
  
! open(DEF,">$ARGV[0]/$defname.def") || die "Could not write to $defname\n";
  print DEF "EXPORTS\n";
  my $i = 0;
  my $last = "";
--- 53,65 ----
          next if $pieces[6] =~ /^__IMPORT_DESCRIPTOR/;
          next if $pieces[6] =~ /^__NULL_IMPORT/;
          next if $pieces[6] =~ /^\?\?_C/;
          push @def, $pieces[6];
      }
      close(F);
  }
  print "\n";
  
! open(DEF,">$defname.def") || die "Could not write to $defname\n";
  print DEF "EXPORTS\n";
  my $i = 0;
  my $last = "";
***************
*** 55,61 ****
  {
      next if ($f eq $last);
      $last = $f;
!     $f =~ s/^_//;
      $i++;
  
      #   print DEF "  $f \@ $i\n";  # ordinaled exports?
--- 67,78 ----
  {
      next if ($f eq $last);
      $last = $f;
! 	
!     if ($platform eq 'Win32')
!     {
!         $f =~ s/^_//;
!     }
! 	
      $i++;
  
      #   print DEF "  $f \@ $i\n";  # ordinaled exports?