Enable forced 32-bit build on Windows

Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/README b/README
index 4c7b542..4173237 100644
--- a/README
+++ b/README
@@ -125,6 +125,9 @@
  5. Run 'make clean'.
  6. Run 'make'.
 
+To build fio on 32-bit Windows, download x86/pthreadGC2.dll instead and do
+'./configure --build-32bit-win=yes' before 'make'.
+
 
 Command line
 ------------
diff --git a/configure b/configure
index 078dab8..c011436 100755
--- a/configure
+++ b/configure
@@ -133,6 +133,8 @@
   ;;
   --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
   ;;
+  --build-32bit-win=*) build_32bit_win="$optarg"
+  ;;
   --help)
   show_help="yes"
   ;;
@@ -183,10 +185,18 @@
 CYGWIN*)
   echo "Forcing known good options on Windows"
   if test -z "$CC" ; then
-    CC="x86_64-w64-mingw32-gcc"
+    if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
+      CC="i686-w64-mingw32-gcc"
+    else
+      CC="x86_64-w64-mingw32-gcc"
+    fi
   fi
   output_sym "CONFIG_LITTLE_ENDIAN"
-  output_sym "CONFIG_64BIT_LLP64"
+  if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
+    output_sym "CONFIG_32BIT"
+  else
+    output_sym "CONFIG_64BIT_LLP64"
+  fi
   output_sym "CONFIG_FADVISE"
   output_sym "CONFIG_SOCKLEN_T"
   output_sym "CONFIG_POSIX_FALLOCATE"