anchor.diff:  if "%BITS%"=="32" (set "PL~LIBPTHREAD=pthreadVC") else (set "PL~LIBPTHREAD=pthreadVC2")
   if "%BITS%"=="32" (set "PL~LIBZLIB=zlib1") else (set "PL~LIBZLIB=zlibwapi")
   if "%BITS%"=="32" (set "PL~ARCH=i386-win32") else (set "PL~ARCH=x64-win64")
  -set "PL~EXTRALIBS=%PL~GMP_LIB%"
  +:set_extra_libs
  +if "%VCXX%_%TYPE%_%BITS%"=="VC08_SDK_64" (set "BUFFEROVERFLOW=bufferoverflowU.lib") else (set "BUFFEROVERFLOW=")
  +set "PL~EXTRALIBS=%PL~GMP_LIB% %BUFFEROVERFLOW%"
  +:end_set_extra_libs
   
   :: MSVC Runtime
  -:: Needs more work...
  +:msvcrt8_sdk
  +if not "%VCXX%"=="VC08_SDK" (goto end_msvcrt8_sdk)
  +set "PL~MSVCRTDIR=%ProgramFiles%\Microsoft Platform SDK for Windows Server 2003 R2\Bin\win64"
  +set "PL~MSVCRT=msvcr80.dll"
  +:end_msvcrt8_sdk
  +:msvcrt8_studio
  +if not "%VCXX%"=="VC08_STU" (goto end_msvcrt8_studio)
  +if "%BITS%"=="32" (set "PL~MSVCRTDIR=%PL~PROGRAM_FILES_32%\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT") else (set "PL~MSVCRTDIR=%PL~PROGRAM_FILES_32%\Microsoft Visual Studio 8\VC\redist\amd64\Microsoft.VC80.CRT")
  +set "PL~MSVCRT=msvcr80.dll"
  +:end_msvcrt8_studio
   :msvcrt9
   if not "%VCXX%"=="VC09" (goto end_msvcrt9)
   if "%BITS%"=="32" (set "PL~MSVCRTDIR=%PL~PROGRAM_FILES_32%\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT") else (set "PL~MSVCRTDIR=%PL~PROGRAM_FILES_32%\Microsoft Visual Studio 9.0\VC\redist\amd64\Microsoft.VC90.CRT")
  
positive.code: 
  @echo off
  
  SETLOCAL
  
  :what_host
  set PL~WINDIR=%SystemRoot%
  if defined ProgramFiles(x86) (set "PL~HOST_OS_ARCH=X64") ELSE (set "PL~HOST_OS_ARCH=X86")
  if "%PL~HOST_OS_ARCH%"=="X64" (set "PL~PROGRAM_FILES_32=%ProgramFiles(x86)%") else (set "PL~PROGRAM_FILES_32=%ProgramFiles%")
  :end_what_host
  
  
  :what_target
  echo Welcome to SWI-Prolog Windows Build Environment Configuration Utility
  echo Copyright (c) 1990-2009 University of Amsterdam.
  echo SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
  echo and you are welcome to redistribute it under certain conditions.
  echo Please visit http://www.swi-prolog.org for details.
  echo Tested on Version 5.7.15 or higher, tested on VC9 and 
  echo VC10 (Beta1) in both 32 and 64 bit flavours
  echo.
  set /P "BITS=Would you like to do a 32bit or 64bit build? (32 or 64): "
  if "%BITS%"=="32" (goto what_target_bits_oke)
  if "%BITS%"=="64" (goto what_target_bits_oke) 
  echo The only choices possible are 32 and 64!
  goto what_target
  :what_target_bits_oke
  
negative.code: if "%BITS%"=="32" (set "PL~MSVCRTDIR=%PL~PROGRAM_FILES_32%\Microsoft Visual Studio 10.0\VC\redist\x86\Microsoft.VC100.CRT") else (set "PL~MSVCRTDIR=%PL~PROGRAM_FILES_32%\Microsoft Visual Studio 10.0\VC\redist\x64\Microsoft.VC100.CRT")
  set "PL~MSVCRT=msvcr100.dll"
  :end_msvcrt10
  
  
  if exist "%PL~PROGRAM_FILES_32%\NSIS\MakeNSIS.exe" (set "NSIS=%PL~PROGRAM_FILES_32%\NSIS\MakeNSIS.exe")
  if exist "%PL~PROGRAM_FILES_32%\NSIS\MakeNSIS.exe" (set "NSISDEFS=/DWIN%BITS% /DMSVCRT=$(MSVCRT)")
  if "%VCXX%_%TYPE%" GEQ "VC08_STU" (SET "PL~VC_VERSION=VC8_OR_MORE") else (SET "PL~VC_VERSION=VC7_OR_LESS")
  :end_set_additional_variables
  
  :: Assumes that the pre-requisites (gmp, jpeg, xpm, pthread, zlib, rfc882 and rfc2045) are present
  :: in ../pl/x86/bin, ../pl/x86/include and ../pl/x86/lib (../pl/x64/bin, ../pl/x64/include and ../pl/x64/lib)."
  