Index: /issm/trunk-jpl/src/c/cores/controltao_core.cpp
===================================================================
--- /issm/trunk-jpl/src/c/cores/controltao_core.cpp	(revision 18224)
+++ /issm/trunk-jpl/src/c/cores/controltao_core.cpp	(revision 18225)
@@ -10,10 +10,19 @@
 #include "../solutionsequences/solutionsequences.h"
 
-#if defined (_HAVE_TAO_) && defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 1)
+#if defined (_HAVE_TAO_)
+#if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
 #include <tao.h>
+#else
+#include <petsctao.h>
+#endif
 
 /*Local prototype*/
+#if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
 int FormFunctionGradient(TaoSolver,Vec,IssmDouble*,Vec,void*);
 int IssmMonitor(TaoSolver,void*);
+#else
+int FormFunctionGradient(Tao,Vec,IssmDouble*,Vec,void*);
+int IssmMonitor(Tao,void*);
+#endif
 typedef struct {
 	FemModel* femmodel;
@@ -29,5 +38,9 @@
 	IssmDouble          fatol,frtol,gatol,grtol,gttol;
 	AppCtx              user;
+	#if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
 	TaoSolver           tao = 0;
+	#else
+	Tao                 tao = 0;
+	#endif
 	int                *control_list = NULL;
 	char               *algorithm    = NULL;
@@ -38,8 +51,10 @@
 
 	/*Initialize TAO*/
+	#if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
 	int argc; char **args=NULL;
 	PetscGetArgs(&argc,&args);
 	ierr = TaoInitialize(&argc,&args,(char*)0,"");
 	if(ierr) _error_("Could not initialize Tao");
+	#endif
 
 	/*Recover some parameters*/
@@ -111,7 +126,14 @@
 	delete X;
 	TaoDestroy(&tao);
+	#if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
 	TaoFinalize();
-}
+	#endif
+}
+
+#if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
 int FormFunctionGradient(TaoSolver tao, Vec Xpetsc, IssmDouble *fcn,Vec G,void *uservoid){
+#else
+int FormFunctionGradient(Tao tao, Vec Xpetsc, IssmDouble *fcn,Vec G,void *uservoid){
+#endif
 
 	/*Retreive arguments*/
@@ -152,5 +174,9 @@
 	return 0;
 }
+#if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
 int IssmMonitor(TaoSolver tao, void *userCtx){
+#else
+int IssmMonitor(Tao tao, void *userCtx){
+#endif
 
 	int         its,num_responses;
