diff -crN oommf11b2/config/cache/wintel.tcl oommf11b2-patched/config/cache/wintel.tcl
*** oommf11b2/config/cache/wintel.tcl	Thu Jan 15 15:22:46 2004
--- oommf11b2-patched/config/cache/wintel.tcl	Tue Dec 12 17:49:23 2006
***************
*** 60,69 ****
  #
  # Microsoft Visual C++
  # <URL:http://msdn.microsoft.com/visualc/>
! # $config SetValue program_compiler_c++ {cl /nologo /c /GX /GR}
  #
  # Intel C++
! $config SetValue program_compiler_c++ {icl /nologo /c /GX /GR}
  #
  # Borland C++ 5.5 Win32 command line tools.
  # <URL:http://www.inprise.com/>
--- 60,69 ----
  #
  # Microsoft Visual C++
  # <URL:http://msdn.microsoft.com/visualc/>
! $config SetValue program_compiler_c++ {cl /nologo /c /GR}
  #
  # Intel C++
! # $config SetValue program_compiler_c++ {icl /nologo /c /GX /GR}
  #
  # Borland C++ 5.5 Win32 command line tools.
  # <URL:http://www.inprise.com/>
***************
*** 102,107 ****
--- 102,122 ----
  # $config SetValue path_directory_temporary {C:\temp}
  # $config SetValue path_directory_temporary {C:\}
  
+ 
+ ########################################################################
+ # SUPPORT PROCEDURES
+ #
+ # Routine to guess the cl version
+ proc GuessClVersion { cl } {
+     set guess {}
+     catch {exec $cl} usage_str
+     if {[regexp -- {Version ([0-9]+)[.][0-9]+[.][0-9]+} \
+              $usage_str dummy version]} {
+         set guess [expr {$version - 6}]
+     }
+     return $guess
+ }
+ 
  ########################################################################
  # ADVANCED CONFIGURATION
  
***************
*** 113,118 ****
--- 128,148 ----
  }
  if {[string match cl $ccbasename]} {
      # ... for Microsoft Visual C++
+     if {![info exists mvcpp_version]} {
+        set compilestr [$config GetValue program_compiler_c++]
+        set mvcpp_version [GuessClVersion [lindex $compilestr 0]]
+        unset compilestr
+     }
+     set opts {}
+     # Exception handling
+     if {![string match {} $mvcpp_version] && $mvcpp_version>7} {
+ 	# The exception handling specification switch "/GX"
+ 	# is deprecated in version 8.
+ 	# lappend opts /EHsc
+ 	lappend opts /EHac
+     } else {
+ 	lappend opts /GX
+     }
      #
      #	Usually you'll want maximum optimzation for greater simulation
      #   performance, so that is the default choice.  However, you may
***************
*** 122,136 ****
      #   option, MSVC 5 was unable to compile the demag.cc file at all,
      #   and other errors caused problems with auto-sizing of the display
      #   in mmDisp.
!     # Options:
      #             Maximum optimization: /Ox
      #      Enable runtime debug checks: /GZ
      #   Optimize for Pentium processor: /G5
      #         Optimize for Pentium Pro: /G6
!     #                  No optimization: /Od
!     #$config SetValue program_compiler_c++_option_opt {format "/Od"}
!     #$config SetValue program_compiler_c++_option_opt {format "/GZ"}
!     $config SetValue program_compiler_c++_option_opt {format "/Ox"}
      # NOTE: If you want good performance, be sure to edit ../options.tcl
      #  or ../local/options.tcl to include the line
      #    Oc_Option Add * Platform cflags {-def NDEBUG}
--- 152,188 ----
      #   option, MSVC 5 was unable to compile the demag.cc file at all,
      #   and other errors caused problems with auto-sizing of the display
      #   in mmDisp.
!     #
!     # Options for VC++ 7 and earlier:
!     #            Disable optimizations: /Od
      #             Maximum optimization: /Ox
      #      Enable runtime debug checks: /GZ
      #   Optimize for Pentium processor: /G5
      #         Optimize for Pentium Pro: /G6
!     #
!     # Options for VC++ 8:
!     #                  Disable optimizations: /Od
!     #                   Maximum optimization: /Ox
!     #                    Enable stack checks: /GZ
!     #                   Require SSE2 support: /arch:SSE2
!     # Fast (less predictable) floating point: /fp:fast
!     #     Use portable but insecure lib fcns: /D_CRT_SECURE_NO_DEPRECATE
!     #
!     if {![string match {} $mvcpp_version] && $mvcpp_version<=7} {
!        #lappend opts /GZ
!        if {$mvcpp_version<6} {
!           lappend opts /Od /G6
!        } else {
!           lappend opts /Ox /G6
!        }
!     } else {
!        #lappend opts /GZ /fp:strict /D_CRT_SECURE_NO_DEPRECATE
!        lappend opts /Ox /fp:fast /D_CRT_SECURE_NO_DEPRECATE
!        lappend opts /wd4996
!        # /wd4996 disables warnings about deprecated function calls
!     }
!     $config SetValue program_compiler_c++_option_opt "format \"$opts\""
! 
      # NOTE: If you want good performance, be sure to edit ../options.tcl
      #  or ../local/options.tcl to include the line
      #    Oc_Option Add * Platform cflags {-def NDEBUG}
***************
*** 149,160 ****
      # The program to run on this platform to create a single library file out
      # of many object files.
      # Microsoft Visual C++'s library maker
!     $config SetValue program_libmaker {lib}
  
      # The program to run on this platform to link together object files and
      # library files to create an executable binary.
      # Microsoft Visual C++'s linker
!     $config SetValue program_linker {link /DEBUG}
  
  } elseif {[string match icl $ccbasename]} {
      # ... for Intel C++
--- 201,215 ----
      # The program to run on this platform to create a single library file out
      # of many object files.
      # Microsoft Visual C++'s library maker
!     $config SetValue program_libmaker {link /lib}
!     # If your link doesn't accept the /lib option, try this instead:
!     # $config SetValue program_libmaker {lib}
  
      # The program to run on this platform to link together object files and
      # library files to create an executable binary.
      # Microsoft Visual C++'s linker
!     $config SetValue program_linker {link}
!     # $config SetValue program_linker {link /DEBUG} ;# For debugging
  
  } elseif {[string match icl $ccbasename]} {
      # ... for Intel C++
***************
*** 273,279 ****
  } else {
      set libbasename [file tail [lindex $libbasename 0]]
  }
! if {[string match lib $libbasename]} {
      # ...for Microsoft VC++ lib
      $config SetValue program_libmaker_option_obj {format \"%s\"}
      $config SetValue program_libmaker_option_out {format "\"/OUT:%s\""}
--- 328,334 ----
  } else {
      set libbasename [file tail [lindex $libbasename 0]]
  }
! if {[string match lib $libbasename] || [string match link $libbasename] } {
      # ...for Microsoft VC++ lib
      $config SetValue program_libmaker_option_obj {format \"%s\"}
      $config SetValue program_libmaker_option_out {format "\"/OUT:%s\""}
