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: set "PL~BUILD_JPL="
  :end_detect_java
  
  
  :export_environment
  if exist "config.dat" (del /Q config.dat)
  for /F "delims=~ tokens=2*" %%_ in ('set PL~') do (echo %%_ >> config.dat)
  :end_export_environment
  
  
  :build_now
  cls
  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.
  set "ANSWER=enter"
  set /P "ANSWER=Would you like to build and install SWI-Prolog %BITS%-bits now? (y or n): "
  if "%ANSWER%"=="y" (goto build_now_answer_yes)
  if "%ANSWER%"=="n" (goto build_now_answer_no)
  if "%ANSWER%"=="Y" (goto build_now_answer_yes)
  if "%ANSWER%"=="N" (goto build_now_answer_no)
  if "%ANSWER%"=="enter" (goto build_now_answer_yes)
  echo The only choices possible are y/Y and n/N or [enter]!
  goto build_now
  :build_now_answer_no
  echo.
  echo The environment has now been set up, the configuration has been saved
  echo to file config.dat in the current directory. automake.cmd starts the build
  echo process. For consecutive builds (with the current setup), it's not
  echo necessary to run this script again. When changes are made or when a different
  echo target is required, run this script.
  echo.
  echo The environment variables are setup as follows:
  echo.
  type config.dat
  echo.
  goto end_build_now
  :build_now_answer_yes
  call automake.cmd
  goto end_no_pause
  :end_build_now
  
  
  :end
  pause
  :end_no_pause
  
  ENDLOCAL
  
  