Index: /issm/trunk-jpl/m4/issm_options.m4
===================================================================
--- /issm/trunk-jpl/m4/issm_options.m4	(revision 14170)
+++ /issm/trunk-jpl/m4/issm_options.m4	(revision 14171)
@@ -1045,7 +1045,18 @@
 		dnl check that --with-fortran-lib may have been provided
 		if test -n "$FORTRAN_LIB" ; then
-			FORTRANLIB="$FORTRAN_LIB"
-			AC_DEFINE([_HAVE_FORTRAN_],[1],[with FORTRAN in ISSM src])
-			AC_SUBST([FORTRANLIB])
+			dnl check that library provided EXISTS!
+			if test -f "$FORTRAN_LIB"; then
+				FORTRANLIB="$FORTRAN_LIB"
+				AC_DEFINE([_HAVE_FORTRAN_],[1],[with FORTRAN in ISSM src])
+				AC_SUBST([FORTRANLIB])
+			else
+			 if test "x$HAVE_MPI" = "xyes"; then
+				FORTRANLIB=$(mpif77 -print-file-name="libgfortran.a")
+				if test -f "$FORTRANLIB"; then
+					 AC_MSG_ERROR([fortran library provided ($FORTRAN_LIB) does not exist, MPI suggests the following library: $FORTRANLIB]);
+				fi
+			 fi
+				AC_MSG_ERROR([frtran library provided ($FORTRAN_LIB$) does not exist!]);
+			fi
 		fi
 		AC_MSG_RESULT(done)
@@ -1059,10 +1070,19 @@
 
 	dnl check that --with-graphics-lib may have been provided
+	
 	if test -n "$GRAPHICS_LIB" ; then
-		HAVE_GRAPHICS=yes
-		GRAPHICSLIB="$GRAPHICS_LIB"
-
-		AC_DEFINE([_HAVE_GRAPHICS_],[1],[with GRAPHICS in ISSM src])
-		AC_SUBST([GRAPHICSLIB])
+		dnl check that library provided EXISTS!
+		if test -f "$GRAPHICS_LIB"; then
+			HAVE_GRAPHICS=yes
+			GRAPHICSLIB="$GRAPHICS_LIB"
+			AC_DEFINE([_HAVE_GRAPHICS_],[1],[with GRAPHICS in ISSM src])
+			AC_SUBST([GRAPHICSLIB])
+		else
+			if test -f "$PETSC_ROOT/conf/petscvariables"; then
+				GRAPHICSLIB=$(cat $PETSC_ROOT/conf/petscvariables | grep X_LIB)
+				AC_MSG_ERROR([graphics library provided ($GRAPHICS_LIB) does not exist, PETSc suggests the following library: $GRAPHICSLIB]);
+			fi
+			AC_MSG_ERROR([graphics library provided ($GRAPHICS_LIB$) does not exist!]);
+		fi
 	fi
 	AC_MSG_RESULT(done)
