diff --git a/configure b/configure
index bb7145e5d7a8a90d5d7e8cc3b78b87d01e70ab1c..f71fcd642d7739d6531c7fa95030330f8fac7c9b 100755
--- a/configure
+++ b/configure
@@ -2638,7 +2638,8 @@ fi
 
 
 # this expression is set up to avoid unnecessary integer overflow
-RELSEG_SIZE=`expr '(' 1024 '*' ${segsize} / ${blocksize} ')' '*' 1024`
+# blocksize is already guaranteed to be a factor of 1024
+RELSEG_SIZE=`expr '(' 1024 / ${blocksize} ')' '*' ${segsize} '*' 1024`
 test $? -eq 0 || exit 1
 { echo "$as_me:$LINENO: result: ${segsize}GB" >&5
 echo "${ECHO_T}${segsize}GB" >&6; }
diff --git a/configure.in b/configure.in
index 9925389a472d01cbf37d5136e26880e0198e38ad..b8f8396030816d864c16bd1003357daa3430e84f 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-dnl $PostgreSQL: pgsql/configure.in,v 1.559 2008/05/02 19:52:37 tgl Exp $
+dnl $PostgreSQL: pgsql/configure.in,v 1.560 2008/05/03 00:24:05 adunstan Exp $
 dnl
 dnl Developers, please strive to achieve this order:
 dnl
@@ -257,7 +257,8 @@ PGAC_ARG_REQ(with, segsize, [  --with-segsize=SEGSIZE  set table segment size in
              [segsize=$withval],
              [segsize=1])
 # this expression is set up to avoid unnecessary integer overflow
-RELSEG_SIZE=`expr '(' 1024 '*' ${segsize} / ${blocksize} ')' '*' 1024`
+# blocksize is already guaranteed to be a factor of 1024
+RELSEG_SIZE=`expr '(' 1024 / ${blocksize} ')' '*' ${segsize} '*' 1024`
 test $? -eq 0 || exit 1
 AC_MSG_RESULT([${segsize}GB])
 
diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32
index 49892c24ec8d8fb23ce3bd457faa5784d5f2f236..1c7e3cd2d00e182f67df98fe50516b5dbdd69ea2 100644
--- a/src/include/pg_config.h.win32
+++ b/src/include/pg_config.h.win32
@@ -37,15 +37,6 @@
 /* The alignment requirement of a `short'. */
 #define ALIGNOF_SHORT 2
 
-/* Size of a disk block --- this also limits the size of a tuple. You can set
-   it bigger if you need bigger tuples (although TOAST should reduce the need
-   to have large tuples, since fields can be spread across multiple tuples).
-   BLCKSZ must be a power of 2. The maximum possible value of BLCKSZ is
-   currently 2^15 (32768). This is determined by the 15-bit widths of the
-   lp_off and lp_len fields in ItemIdData (see include/storage/itemid.h).
-   Changing BLCKSZ requires an initdb. */
-#define BLCKSZ 8192
-
 /* 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.
@@ -600,19 +591,6 @@
    your system. */
 /* #undef PTHREAD_CREATE_JOINABLE */
 
-/* RELSEG_SIZE is the maximum number of blocks allowed in one disk file. Thus,
-   the maximum size of a single file is RELSEG_SIZE * BLCKSZ; relations bigger
-   than that are divided into multiple files. RELSEG_SIZE * BLCKSZ must be
-   less than your OS' limit on file size. This is often 2 GB or 4GB in a
-   32-bit operating system, unless you have large file support enabled. By
-   default, we make the limit 1 GB to avoid any possible integer-overflow
-   problems within the OS. A limit smaller than necessary only means we divide
-   a large relation into more chunks than necessary, so it seems best to err
-   in the direction of a small limit. A power-of-2 value is recommended to
-   save a few cycles in md.c, but is not absolutely required. Changing
-   RELSEG_SIZE requires an initdb. */
-#define RELSEG_SIZE 131072
-
 /* The size of a `size_t', as computed by sizeof. */
 #define SIZEOF_SIZE_T 4
 
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 026068896786125129a0804f5e6461e2ea05da12..e257aa1445c1815870265e95b59e94373f419961 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -3,7 +3,7 @@ package Solution;
 #
 # Package that encapsulates a Visual C++ solution file generation
 #
-# $PostgreSQL: pgsql/src/tools/msvc/Solution.pm,v 1.40 2008/04/21 18:37:28 mha Exp $
+# $PostgreSQL: pgsql/src/tools/msvc/Solution.pm,v 1.41 2008/05/03 00:24:06 adunstan Exp $
 #
 use Carp;
 use strict;
@@ -34,6 +34,23 @@ sub new
             die "XML requires both XSLT and ICONV\n";
         }
     }
+	$options->{blocksize} = 8
+		unless $options->{blocksize}; # undef or 0 means default
+	die "Bad blocksize $options->{blocksize}"
+		unless grep {$_ == $options->{blocksize}} (1,2,4,8,16,32);
+	$options->{segsize} = 1
+		unless $options->{segsize}; # undef or 0 means default
+	# only allow segsize 1 for now, as we can't do large files yet in windows
+	die "Bad segsize $options->{segsize}"
+		unless $options->{segsize} == 1;
+	$options->{wal_blocksize} = 8
+		unless $options->{wal_blocksize}; # undef or 0 means default
+	die "Bad wal_blocksize $options->{wal_blocksize}"
+		unless grep {$_ == $options->{wal_blocksize}} (1,2,4,8,16,32,64);
+	$options->{wal_segsize} = 16
+		unless $options->{wal_segsize}; # undef or 0 means default
+	die "Bad wal_segsize $options->{wal_segsize}"
+		unless grep {$_ == $options->{wal_segsize}} (1,2,4,8,16,32,64);
     return $self;
 }
 
@@ -116,7 +133,16 @@ s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY
         print O "#define USE_LDAP 1\n" if ($self->{options}->{ldap});
         print O "#define HAVE_LIBZ 1\n" if ($self->{options}->{zlib});
         print O "#define USE_SSL 1\n" if ($self->{options}->{openssl});
-        print O "#define ENABLE_NLS 1\n" if ($self->{options}->{nls});
+		print O "#define ENABLE_NLS 1\n" if ($self->{options}->{nls});
+
+		print O "#define BLCKSZ ",1024 * $self->{options}->{blocksize},"\n";
+		print O "#define RELSEG_SIZE ",
+			(1024 / $self->{options}->{blocksize}) * 
+				$self->{options}->{segsize} * 1024, "\n";
+		print O "#define XLOG_BLCKSZ ",
+			1024 * $self->{options}->{wal_blocksize},"\n";
+		print O "#define XLOG_SEG_SIZE (",
+			$self->{options}->{wal_segsize}," * 1024 * 1024)\n";
         
         if ($self->{options}->{float4byval}) 
         {
diff --git a/src/tools/msvc/config.pl b/src/tools/msvc/config.pl
index bebb9a7c494012f92d6c400acb9a91955b13d223..1e3750535deed3aa3b6f27a067515168fdbef165 100644
--- a/src/tools/msvc/config.pl
+++ b/src/tools/msvc/config.pl
@@ -7,6 +7,9 @@ our $config = {
     # integer_datetimes=>1,   # --enable-integer-datetimes - on is now default
     # float4byval=>1,         # --disable-float4-byval, on by default
     # float8byval=>0,         # --disable-float8-byval, off by default
+    # blocksize => 8,         # --with-blocksize, 8kB by default
+    # wal_blocksize => 8,     # --with-wal-blocksize, 8kb by default
+    # wal_segsize => 16,      # --with-wal-segsize, 16MB by default
     nls=>undef,				# --enable-nls=<path>
     tcl=>'c:\tcl',		# --with-tls=<path>
     perl=>'c:\perl', 			# --with-perl