Index: /issm/trunk-jpl/m4/issm_options.m4
===================================================================
--- /issm/trunk-jpl/m4/issm_options.m4	(revision 18118)
+++ /issm/trunk-jpl/m4/issm_options.m4	(revision 18119)
@@ -168,4 +168,5 @@
 		
 		dnl 4. get MEXLIB MEXLINK and MEXEXT (experimental) except for windows
+		AC_MSG_CHECKING([matlab's mex compilation flags])
   		case "${host_os}" in
   			*cygwin*) 
@@ -184,6 +185,20 @@
 	         MEXLIB=$( $MATLAB_ROOT/bin/mex -v 2>&1 < /dev/null | grep CXXLIBS     | sed -e "s/         CXXLIBS            = //g")
 		      MEXEXT=$( $MATLAB_ROOT/bin/mex -v 2>&1 < /dev/null | grep LDEXTENSION | sed -e "s/         LDEXTENSION        = //g")
+
+				dnl version 2014 and up
+				if test "x$MEXEXT" = "x" ; then
+					 echo "#include <mex.h>" > conftest.cpp
+					 echo "void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){}" >> conftest.cpp
+					 $MATLAB_ROOT/bin/mex -v -lmex conftest.cpp > conftest.tmp 2>&1 
+					 rm -f conftest.cpp
+					 MEXLINK=$(cat conftest.tmp | grep LDFLAGS  | sed -e "s/LDFLAGS ://g")
+					 MEXLIB=$( cat conftest.tmp | grep LINKLIBS | sed -e "s/LINKLIBS ://g")
+					 MEXEXT=$( cat conftest.tmp | grep LDEXT    | sed -e "s/LDEXT ://g" | awk '{print $[1]}')
+					 rm -f conftest.tmp
+				fi
+
   			;;
       esac
+		AC_MSG_RESULT(done)
 	   if test "x$MEXEXT" = "x" ; then
 			AC_MSG_ERROR([Couldn't find mex... check your installation of matlab])
@@ -191,5 +206,4 @@
 
 		AC_SUBST([MATLABINCL])
-		AC_SUBST([MEX])
 		MATLABWRAPPEREXT=$MEXEXT
 		AC_SUBST([MATLABWRAPPEREXT])
