Index: /issm/trunk-jpl/configs/config-win64.sh
===================================================================
--- /issm/trunk-jpl/configs/config-win64.sh	(revision 19109)
+++ /issm/trunk-jpl/configs/config-win64.sh	(revision 19109)
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# Works on Win8, but should also work on 7.
+./configure --prefix=$ISSM_DIR \
+	--with-vendor=MSVC-win64  \
+	--disable-static \
+	--enable-standalone-libraries \
+	--with-fortran=no  \
+	--without-Gia \
+	--without-kriging \
+	--with-matlab-dir="$ISSM_DIR/externalpackages/matlab/install" \
+	--with-metis-dir="$ISSM_DIR/externalpackages/metis/install" \
+	--with-triangle-dir="$ISSM_DIR/externalpackages/triangle/install" \
+	--with-petsc-dir="$ISSM_DIR/externalpackages/petsc/install" \
+	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install/lib/  \
+	--with-mpi-libdir="$ISSM_DIR/externalpackages/petsc/install/lib" \
+   --with-mpi-libflags="-Wl,libpetsc.lib" \
+	--with-mpi-include="$ISSM_DIR/externalpackages/petsc/install/include/mpiuni" 
+
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.1-win7.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.1-win7.sh	(revision 19108)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.1-win7.sh	(revision 19109)
@@ -16,4 +16,14 @@
 export PETSC_DIR=`cygpath -u "$ISSM_DIR/externalpackages/petsc/src"`
 export PREFIX_DIR=`cygpath -u "$ISSM_DIR/externalpackages/petsc/install"`
+
+
+# Version 3.1 of Petsc is really old. As such, it is likely that newer machines
+# will not be recognized. As such, the build will fail during configuration.
+# This can be resolved by simply updated the scripts 'config.guess' and 
+# 'config.sub'.
+cp ./../autotools/install/share/libtool/config/config.guess ./src/config/configarch/
+cp ./../autotools/install/share/libtool/config/config.guess ./src/config/BuildSystem/config/packages/
+cp ./../autotools/install/share/libtool/config/config.sub ./src/config/configarch/
+cp ./../autotools/install/share/libtool/config/config.sub ./src/config/BuildSystem/config/packages/
 
 #configure
Index: /issm/trunk-jpl/externalpackages/windows/configs/sdk7.1-win64.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/windows/configs/sdk7.1-win64.sh	(revision 19109)
+++ /issm/trunk-jpl/externalpackages/windows/configs/sdk7.1-win64.sh	(revision 19109)
@@ -0,0 +1,39 @@
+# -----------------------------------------------------------------------------
+# 
+# The following variables can vary from system to system and standard
+# installation is assumed throughout. If different directories were used when
+# installing MSVC, or Win SDK.
+#
+# TODO: Bring out the host machine arhictecture specific stuff from INCLUDE,
+# LIB and LIBPATH.
+#
+# -----------------------------------------------------------------------------
+
+# The version of Visual Studio is 10.0. Newer versions should work as well.
+export MSVC_DIR='C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\'
+
+# SDK change from 7 to 8 involved changing the locations of important 
+# libraries. If you wish to use 8.0 or 8.1 then you need to provide the 
+# directory of 'Windows Kits' instead.
+export WIN_SDK_DIR='C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\'
+
+# Unfotunately, standard installation directories of Matlab usually include 
+# white spaces that are not handled correctly by the command interpreter. As
+# such, the directory where one would find Matlab headers and libraries might
+# need to be provided as environment variables.
+export MATLAB_DIR_WIN=`cygpath -w ${MATLAB_DIR}`
+export MATLAB_DIR_LIB="${MATLAB_DIR_WIN}\\extern\\lib\\win64\\microsoft"
+
+# Information about the .NET framework is required to run the MSVC toolchain
+export FrameworkDir='C:\Windows\Microsoft.NET\Framework64\'
+export FrameworkVersion=v4.0.30319
+
+# LIB and LIBPATH seem redundant, but MSVC linker and compiler use different 
+# variables for the same purpose.
+export INCLUDE="${MSVC_DIR}include;${WIN_SDK_DIR}Include;${MATLAB_DIR_WIN}\\extern\\include;"
+export LIB="${MSVC_DIR}lib\\amd64;${WIN_SDK_DIR}Lib\\x64;${MATLAB_DIR_LIB}"
+export LIBPATH="${FrameworkDir}${FrameworkVersion};${MATLAB_DIR_LIB};"
+export LIBPATH="${LIBPATH}${MSVC_DIR}lib\\amd64;${MSVC_DIR}bin\\amd64;${WIN_SDK_DIR}Lib\\x64;"
+
+export MSVC_DIR_UNIX=`cygpath -u "${MSVC_DIR}"`
+export PATH="${MSVC_DIR_UNIX}/bin/amd64:$PATH"
Index: /issm/trunk-jpl/externalpackages/windows/windows_environment.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/windows/windows_environment.sh	(revision 19108)
+++ /issm/trunk-jpl/externalpackages/windows/windows_environment.sh	(revision 19109)
@@ -11,5 +11,5 @@
 
 #Determine OS version using uname: 
-version=`uname -s | grep 64`
+version=`uname -m | grep x86_64`
 if [[ $version == "" ]];then
 	compiler=1
@@ -27,5 +27,5 @@
 	source $config_dir/sdk7.1.win7-32.sh
 elif [[ "$compiler" == "2" ]]; then 
-	source $config_dir/sdk7.1.win7-64.sh
+	source $config_dir/sdk7.1-win64.sh
 elif [[ "$compiler" == "3" ]]; then 
 	source $config_dir/intel-win7.sh
Index: /issm/trunk-jpl/jenkins/windows
===================================================================
--- /issm/trunk-jpl/jenkins/windows	(revision 19108)
+++ /issm/trunk-jpl/jenkins/windows	(revision 19109)
@@ -9,5 +9,5 @@
 	--enable-standalone-libraries \
 	--without-Gia \
-	--with-vendor=intel-win7-64  \
+	--with-vendor=MSVC-Win64  \
 	--with-matlab-dir=""$ISSM_DIR/externalpackages/matlab/install"" \
 	--with-triangle-dir="$ISSM_DIR/externalpackages/triangle/install" \
@@ -47,5 +47,5 @@
 EXTERNALPACKAGES="cccl        install-win7.sh
 						cmake       install.sh                
-						petsc       install-3.5-win7.sh
+						petsc       install-3.1-win7.sh
 						triangle    install-win7.sh        
 						matlab      install.sh
Index: /issm/trunk-jpl/m4/issm_options.m4
===================================================================
--- /issm/trunk-jpl/m4/issm_options.m4	(revision 19108)
+++ /issm/trunk-jpl/m4/issm_options.m4	(revision 19109)
@@ -183,4 +183,13 @@
 			OSLIBS="-Wl,kernel32.lib -Wl,user32.lib -Wl,gdi32.lib -Wl,winspool.lib -Wl,comdlg32.lib -Wl,advapi32.lib -Wl,shell32.lib -Wl,ole32.lib -Wl,oleaut32.lib -Wl,uuid.lib -Wl,odbc32.lib -Wl,odbccp32.lib"
 		elif  test $VENDOR = intel-win7-64; then
+			export CC=cl
+			export CXX=cccl
+			export CXXFLAGS="-DWIN32 -D_INTEL_WIN_ -EHsc"
+			export CFLAGS="-DWIN32 -D_INTEL_WIN_ -EHsc"
+			export AR="ar-lib lib"
+			export OS_LDFLAG="-Wl,"
+			export RANLIB=true
+			OSLIBS="-Wl,kernel32.lib -Wl,user32.lib -Wl,gdi32.lib -Wl,winspool.lib -Wl,comdlg32.lib -Wl,advapi32.lib -Wl,shell32.lib -Wl,ole32.lib -Wl,oleaut32.lib -Wl,uuid.lib -Wl,odbc32.lib -Wl,odbccp32.lib"
+		elif  test $VENDOR = MSVC-Win64; then
 			export CC=cl
 			export CXX=cccl
@@ -262,13 +271,18 @@
   			*cygwin*) 
   				if  test $VENDOR = intel-win7-32; then
-  					MEXLIB="-Wl,./../../c/libISSMCore.a -Wl,libISSMApi.a -Wl,libISSMMatlab.a -Wl,./../../c/libISSMModules.a -Wl,libmx.lib -Wl,libmex.lib -Wl,libmat.lib ${OSLIBS} -Wl,libf2cblas.lib -Wl,libf2clapack.lib" 
-               MEXLINK="-Wl,/LIBPATH:`cygpath -m ${MATLAB_ROOT}/extern/lib/win32/microsoft` -no-undefined -Wl,/export:mexFunction -Wl,/LD"
+  					MEXLIB="-Wl,libmx.lib -Wl,libmex.lib -Wl,libmat.lib ${OSLIBS} -Wl,libf2cblas.lib -Wl,libf2clapack.lib" 
+               MEXLINK="-Wl,/LIBPATH:`cygpath -m ${MATLAB_DIR}/extern/lib/win32/microsoft` -Wl,/export:mexFunction -Wl,/LD"
 					MEXEXT=`$MATLAB_ROOT/bin/mexext.bat`
 					MEXEXT=".$MEXEXT"
-  				elif  test l-win7-64; then
-  					MEXLIB="-Wl,./../../c/libISSMCore.a -Wl,libISSMApi.a -Wl,libISSMMatlab.a -Wl,./../../c/libISSMModules.a -Wl,libmx.lib -Wl,libmex.lib -Wl,libmat.lib ${OSLIBS} -Wl,libf2cblas.lib -Wl,libf2clapack.lib" 
-               MEXLINK="-Wl,/LIBPATH:`cygpath -m ${MATLAB_ROOT}/extern/lib/win64/microsoft` -no-undefined -Wl,/export:mexFunction -Wl,/LD" 
+  				elif test $VENDOR = intel-win7-64; then
+  					MEXLIB="-Wl,libmx.lib -Wl,libmex.lib -Wl,libmat.lib ${OSLIBS} -Wl,libf2cblas.lib -Wl,libf2clapack.lib" 
+               MEXLINK="-Wl,/LIBPATH:`cygpath -m ${MATLAB_DIR}/extern/lib/win64/microsoft` -Wl,/export:mexFunction -Wl,/LD" 
+					MEXEXT=".mexw64"
+  				elif test $VENDOR = MSVC-Win64; then
+  					MEXLIB="-Wl,libmx.lib -Wl,libmex.lib -Wl,libmat.lib ${OSLIBS} -Wl,libf2cblas.lib -Wl,libf2clapack.lib" 
+               MEXLINK="-Wl,/LIBPATH:`cygpath -m ${MATLAB_DIR}/extern/lib/win64/microsoft` -Wl,/export:mexFunction -Wl,/LD" 
 					MEXEXT=".mexw64"
   				fi
+				IS_WINDOWS=yes
 
   			;;
@@ -298,4 +312,8 @@
 			AC_MSG_ERROR([Couldn't find mex... check your installation of matlab])
 	   fi
+	   if test "x$IS_WINDOWS" = "x" ; then
+			AC_MSG_ERROR([I'M PRETTY SURE THIS IS SUPPOSED TO BE WINDOWS...])
+	   fi
+		AM_CONDITIONAL([WINDOWS], [test x$IS_WINDOWS="xyes"])
 
 		AC_SUBST([MATLABINCL])
@@ -844,4 +862,7 @@
 			MPI_LIBDIR=`cygpath -m $MPI_LIBDIR`
 			MPI_INCLUDE=`cygpath -m $MPI_INCLUDE`
+		elif test x$VENDOR = xMSVC-Win64; then
+			MPI_LIBDIR=`cygpath -m $MPI_LIBDIR`
+			MPI_INCLUDE=`cygpath -m $MPI_INCLUDE`
 		fi
 
Index: /issm/trunk-jpl/src/wrappers/matlab/Makefile.am
===================================================================
--- /issm/trunk-jpl/src/wrappers/matlab/Makefile.am	(revision 19108)
+++ /issm/trunk-jpl/src/wrappers/matlab/Makefile.am	(revision 19109)
@@ -79,5 +79,5 @@
 
 #Matlab part
-AM_LDFLAGS = -module $(MEXLINK) -shrext ${EXEEXT} --export-dynamic -rdynamic
+AM_LDFLAGS = -module $(MEXLINK) -shrext ${EXEEXT} --export-dynamic -rdynamic -no-undefined
 if VERSION
 AM_LDFLAGS +=
@@ -92,5 +92,13 @@
 AM_CXXFLAGS +=  -D_HAVE_MATLAB_MODULES_ -fPIC
 
+# This is a temporary fix to an issue with Libtool regarding linking against 
+# static libraries for Windows. Ideally, we would build all libraries as DLLs
+# and and avoid this workaround which removes the dependency of ISSM libraries
+# from the perspective of our build system.
+if WINDOWS
+AM_LDFLAGS += -Wl,./.libs/libISSMMatlab.lib -Wl,./../../c/.libs/libISSMModules.lib -Wl,./../../c/.libs/libISSMCore.lib -Wl,././.libs/libISSMApi.lib
+else
 deps += ./libISSMMatlab.la ../../c/libISSMModules.la ../../c/libISSMCore.la ./libISSMApi.la
+endif
 
 if ADOLC
