diff -crN oommf12a3/config/cache/wintel.tcl oommf12a3-patched/config/cache/wintel.tcl
*** oommf12a3/config/cache/wintel.tcl	Wed Oct 30 22:01:12 2002
--- oommf12a3-patched/config/cache/wintel.tcl	Tue Dec 12 18:04:25 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/>
***************
*** 98,118 ****
  # $config SetValue path_directory_temporary {C:\}
  
  ########################################################################
  # ADVANCED CONFIGURATION
  
  # Compiler option processing...
  set ccbasename [file tail [lindex [$config GetValue program_compiler_c++] 0]]
  if {[string match cl $ccbasename]} {
      # ... for Microsoft Visual C++
!     # Default optimization
!     # $config SetValue program_compiler_c++_option_opt {}
!     # Options:
      #             Maximum optimization: /Ox
      #      Enable runtime debug checks: /GZ
      #   Optimize for Pentium processor: /G5
      #         Optimize for Pentium Pro: /G6
!     #$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}
--- 98,173 ----
  # $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
  
  # Compiler option processing...
  set ccbasename [file tail [lindex [$config GetValue program_compiler_c++] 0]]
  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
!     }
! 
!     # Optimizations
!     #
!     # 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\""
!     # OR, default optimization:
!     # $config SetValue program_compiler_c++_option_opt {}
! 
      # 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}
