Index: /issm/trunk-jpl/externalpackages/autotools/install-win.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/autotools/install-win.sh	(revision 22027)
+++ /issm/trunk-jpl/externalpackages/autotools/install-win.sh	(revision 22028)
@@ -8,14 +8,14 @@
 
 #install m4
-#echo " === INSTALLING M4 =="
-#rm -rf src
-#$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/m4-1.4.17.tar.gz' 'm4-1.4.17.tar.gz'
-#tar -zxvf m4-1.4.17.tar.gz
-#mv m4-1.4.17 src
-#cd src
-#./configure --prefix="$ISSM_DIR/externalpackages/autotools/install"
-#make
-#make install
-#cd ..
+echo " === INSTALLING M4 =="
+rm -rf src
+$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/m4-1.4.17.tar.gz' 'm4-1.4.17.tar.gz'
+tar -zxvf m4-1.4.17.tar.gz
+mv m4-1.4.17 src
+cd src
+./configure --prefix="$ISSM_DIR/externalpackages/autotools/install"
+make
+make install
+cd ..
 
 #install autoconf
@@ -64,2 +64,7 @@
 # compiler.
 patch ./install/bin/automake < ./patches/automake.patch
+
+# This patch is for ar-lib, and removes carriage return characters that cause
+# commands to overwrite themselves and be misinterpreted during linking on 
+# Cygwin Windows.
+patch ./install/share/automake-1.14/ar-lib < ./patches/ar-lib.patch
Index: /issm/trunk-jpl/externalpackages/autotools/patches/ar-lib.patch
===================================================================
--- /issm/trunk-jpl/externalpackages/autotools/patches/ar-lib.patch	(revision 22028)
+++ /issm/trunk-jpl/externalpackages/autotools/patches/ar-lib.patch	(revision 22028)
@@ -0,0 +1,11 @@
+--- ar-lib	2017-08-30 21:58:06.863512300 -0700
++++ /home/Daniel/issm/trunk/aux-config/ar-lib	2017-08-30 21:58:01.291710300 -0700
+@@ -226,7 +226,7 @@
+   else
+     $AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
+     do
+-      $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
++      $AR -NOLOGO -EXTRACT:"$(echo $member | tr -d '\r')" "$archive" || exit $?
+     done
+   fi
+ 
Index: /issm/trunk-jpl/jenkins/jenkins.sh
===================================================================
--- /issm/trunk-jpl/jenkins/jenkins.sh	(revision 22027)
+++ /issm/trunk-jpl/jenkins/jenkins.sh	(revision 22028)
@@ -127,7 +127,11 @@
 echo "<testsuite tests=\"$NUMPACKAGES\">" > $EXTERNAL_TEST_FILE
 
-# Need a source here for when builds start midway through installation of 
-# externalpackages.
+# Need a source here for when builds start midway through installation of externalpackages.
 source $ISSM_DIR/etc/environment.sh
+
+if [ "$OS" == "win" ]; then
+	echo " == WINDOWS ENVIRONMENT DETECTED =="
+	source $ISSM_DIR/externalpackages/windows/windows_environment.sh
+fi
 
 EXTERNALPACKAGES_FAILED=0;
@@ -183,5 +187,5 @@
 fi
 
-
+# Source here to include any newly installed externalpackages on the path. 
 source $ISSM_DIR/etc/environment.sh
 
@@ -199,4 +203,5 @@
 	source $ISSM_DIR/externalpackages/emscripten/install/emsdk_env.sh
 fi
+
 #}}}
 #ISSM compilation yes/no                (ISSM_COMPILATION) {{{
