Index: /issm/trunk-jpl/src/c/Container/Options.cpp
===================================================================
--- /issm/trunk-jpl/src/c/Container/Options.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/Container/Options.cpp	(revision 11861)
@@ -20,5 +20,5 @@
 #include "../shared/shared.h"
 #include "../EnumDefinitions/EnumDefinitions.h"
-#ifdef _SERIAL_
+#if _SERIAL_
 #include "../io/io.h"
 #endif
@@ -31,5 +31,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION Options::Options(int istart, int nrhs, const mxArray* prhs[]){{{1*/
 Options::Options(int istart, int nrhs, const mxArray* prhs[]){
Index: /issm/trunk-jpl/src/c/Container/Options.h
===================================================================
--- /issm/trunk-jpl/src/c/Container/Options.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/Container/Options.h	(revision 11861)
@@ -15,5 +15,5 @@
 		/*constructors, destructors*/
 		Options();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		Options(int istart, int nrhs, const mxArray* prhs[]);
 		#endif
Index: /issm/trunk-jpl/src/c/Container/Results.cpp
===================================================================
--- /issm/trunk-jpl/src/c/Container/Results.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/Container/Results.cpp	(revision 11861)
@@ -65,5 +65,5 @@
 /*}}}*/
 /*FUNCTION Results::Write{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void Results::Write(mxArray** pdataref){
 
Index: /issm/trunk-jpl/src/c/Container/Results.h
===================================================================
--- /issm/trunk-jpl/src/c/Container/Results.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/Container/Results.h	(revision 11861)
@@ -26,5 +26,5 @@
 		/*numerics: {{{1*/
 		Results* SpawnTriaResults(int* indices);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void Write(mxArray** pdataref);
 		#else 
Index: /issm/trunk-jpl/src/c/include/types.h
===================================================================
--- /issm/trunk-jpl/src/c/include/types.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/include/types.h	(revision 11861)
@@ -16,5 +16,5 @@
 
 /*Define abstract type for I/O: */
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 typedef const mxArray* ConstDataHandle;  //serially, we are reading data from a matlab array.
Index: /issm/trunk-jpl/src/c/io/Matlab/FetchMatlabData.cpp
===================================================================
--- /issm/trunk-jpl/src/c/io/Matlab/FetchMatlabData.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/io/Matlab/FetchMatlabData.cpp	(revision 11861)
@@ -12,5 +12,5 @@
 #include "../../include/include.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 /*FUNCTION FetchMatlabData(DataSet** pdataset,const mxArray* dataref){{{1*/
Index: /issm/trunk-jpl/src/c/io/Matlab/OptionParse.cpp
===================================================================
--- /issm/trunk-jpl/src/c/io/Matlab/OptionParse.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/io/Matlab/OptionParse.cpp	(revision 11861)
@@ -13,5 +13,5 @@
 #include "./matlabio.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 
Index: /issm/trunk-jpl/src/c/io/Matlab/WriteMatlabData.cpp
===================================================================
--- /issm/trunk-jpl/src/c/io/Matlab/WriteMatlabData.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/io/Matlab/WriteMatlabData.cpp	(revision 11861)
@@ -12,5 +12,5 @@
 #include "../../shared/shared.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 
Index: /issm/trunk-jpl/src/c/io/Matlab/matlabio.h
===================================================================
--- /issm/trunk-jpl/src/c/io/Matlab/matlabio.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/io/Matlab/matlabio.h	(revision 11861)
@@ -13,5 +13,5 @@
 class Parameters;
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 void WriteMatlabData(mxArray** pdataref,DataSet* dataset);
Index: /issm/trunk-jpl/src/c/io/io.h
===================================================================
--- /issm/trunk-jpl/src/c/io/io.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/io/io.h	(revision 11861)
@@ -15,5 +15,5 @@
 #include "./Disk/diskio.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "./Matlab/matlabio.h"
 #endif
Index: /issm/trunk-jpl/src/c/modules/Dakotax/Dakotax.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Dakotax/Dakotax.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/modules/Dakotax/Dakotax.cpp	(revision 11861)
@@ -51,5 +51,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void Dakotax(mxArray* femmodel){ 
 #else
@@ -69,5 +69,5 @@
 
 	/*Retrieve parameters: */
-	#ifdef _SERIAL_
+	#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	FetchMatlabData((Parameters**)&parameters,mxGetField((mxArray*)femmodel,0,"parameters"));
 	#else
@@ -86,5 +86,5 @@
 		// Instantiate/initialize the parallel library and problem description
 		// database objects.
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 			Dakota::ParallelLibrary parallel_lib; //use Dakota's standard library mode constructor
 		#else
@@ -143,5 +143,5 @@
 	xfree((void**)&dakota_output_file);
 
-	#ifdef _SERIAL_
+	#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	delete parameters;
 	#endif
Index: /issm/trunk-jpl/src/c/modules/Dakotax/Dakotax.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/Dakotax/Dakotax.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/modules/Dakotax/Dakotax.h	(revision 11861)
@@ -13,5 +13,5 @@
 int  DescriptorIndex(char* root, int* pindex,char* descriptor);
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void Dakotax(mxArray* femmodel);
 void SpawnCoreSerial(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, mxArray* femmodel,int counter);
Index: /issm/trunk-jpl/src/c/modules/Dakotax/SpawnCore.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Dakotax/SpawnCore.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/modules/Dakotax/SpawnCore.cpp	(revision 11861)
@@ -21,5 +21,5 @@
 	/*Branch into a serial SpawnCore and a parallel SpawnCore: */
 
-	#ifdef _SERIAL_
+	#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		SpawnCoreSerial(responses, numresponses, variables, variables_descriptors,numvariables, (mxArray*)femmodel, counter);
 	#else
Index: /issm/trunk-jpl/src/c/modules/Dakotax/SpawnCoreSerial.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Dakotax/SpawnCoreSerial.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/modules/Dakotax/SpawnCoreSerial.cpp	(revision 11861)
@@ -18,5 +18,5 @@
 #include "../../include/include.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void SpawnCoreSerial(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, mxArray* femmodel, int counter){
 
Index: /issm/trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 11861)
@@ -16,5 +16,5 @@
 #include "../../objects/objects.h"
 		
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void OutputResultsx(mxArray** pdataref, Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results* results){
 #else 
@@ -31,5 +31,5 @@
 	bool        dakota_analysis         = false;
 	
-	#ifdef _SERIAL_
+	#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	const char **fnames      = NULL;
 	mwSize       onebyone[2] = {0,0};
@@ -43,5 +43,5 @@
 	if(dakota_analysis){
 		//no need to output anything, Dakota analysis has different outputs
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		*pdataref=mxCreateStructArray( ndim,onebyone,nfields,fnames);
 		#endif
@@ -91,5 +91,5 @@
 
 	/*Write results to disk (in parallel), or to memory (in serial mode): */
-	#ifdef _SERIAL_
+	#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		results->Write(pdataref);
 	#else
Index: /issm/trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.h	(revision 11861)
@@ -14,5 +14,5 @@
 #include "../../Container/Container.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 void OutputResultsx(mxArray** pdataref, Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads,  Materials* materials, Parameters* parameters, Results* results);
Index: /issm/trunk-jpl/src/c/objects/Bamg/BamgGeom.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Bamg/BamgGeom.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Bamg/BamgGeom.cpp	(revision 11861)
@@ -19,5 +19,5 @@
 /*}}}*/
 /*FUNCTION BamgGeom::BamgGeom(mxArray* matlab_struct){{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 BamgGeom::BamgGeom(mxArray* matlab_struct){
 
@@ -51,5 +51,5 @@
 /*Methods*/
 /*FUNCTION BamgGeom::SetMatlabStructureFields{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void BamgGeom::SetMatlabStructureFields(mxArray** matlab_struct){
 
@@ -94,5 +94,5 @@
 /*}}}*/
 /*FUNCTION BamgGeom::SetMatlabStructureField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void BamgGeom::SetMatlabStructureField(mxArray* matlab_struct,const char* fieldname,int fieldrows,int fieldcols,double* fieldpointer){
 
Index: /issm/trunk-jpl/src/c/objects/Bamg/BamgGeom.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Bamg/BamgGeom.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Bamg/BamgGeom.h	(revision 11861)
@@ -5,5 +5,5 @@
 #define _BAMGGEOM_H_
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -30,10 +30,10 @@
 
 		BamgGeom();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		BamgGeom(mxArray* matlab_struct);
 		#endif
 		~BamgGeom();
 
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void SetMatlabStructureFields(mxArray** matlab_struct);
 		void SetMatlabStructureField(mxArray* matlab_struct,const char* fieldname,int fieldrows,int fieldcols,double* fieldpointer);
Index: /issm/trunk-jpl/src/c/objects/Bamg/BamgMesh.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Bamg/BamgMesh.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Bamg/BamgMesh.cpp	(revision 11861)
@@ -32,5 +32,5 @@
 /*}}}*/
 /*FUNCTION BamgMesh::BamgMesh(mxArray* matlab_struct){{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 BamgMesh::BamgMesh(mxArray* matlab_struct){
 
@@ -91,5 +91,5 @@
 /*Methods*/
 /*FUNCTION BamgMesh::SetMatlabStructureFields{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void BamgMesh::SetMatlabStructureFields(mxArray** matlab_struct){
 
@@ -152,5 +152,5 @@
 /*}}}*/
 /*FUNCTION BamgMesh::SetMatlabStructureField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void BamgMesh::SetMatlabStructureField(mxArray* matlab_struct,const char* fieldname,int fieldrows,int fieldcols,double* fieldpointer){
 
Index: /issm/trunk-jpl/src/c/objects/Bamg/BamgMesh.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Bamg/BamgMesh.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Bamg/BamgMesh.h	(revision 11861)
@@ -5,5 +5,5 @@
 #define _BAMGMESH_H_
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -51,10 +51,10 @@
 
 		BamgMesh();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		BamgMesh(mxArray* matlab_struct);
 		#endif
 		~BamgMesh();
 
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void SetMatlabStructureFields(mxArray** matlab_struct);
 		void SetMatlabStructureField(mxArray* matlab_struct,const char* fieldname,int fieldrows,int fieldcols,double* fieldpointer);
Index: /issm/trunk-jpl/src/c/objects/Bamg/BamgOpts.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Bamg/BamgOpts.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Bamg/BamgOpts.cpp	(revision 11861)
@@ -42,5 +42,5 @@
 /*}}}*/
 /*FUNCTION BamgOpts::BamgOpts(mxArray* matlab_struct){{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 BamgOpts::BamgOpts(mxArray* matlab_struct){
 
Index: /issm/trunk-jpl/src/c/objects/Bamg/BamgOpts.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Bamg/BamgOpts.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Bamg/BamgOpts.h	(revision 11861)
@@ -6,5 +6,5 @@
 #define _BAMGOPTS_H_
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -54,5 +54,5 @@
 
 		BamgOpts();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		BamgOpts(mxArray* matlab_struct);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/ExternalResults/BoolExternalResult.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/ExternalResults/BoolExternalResult.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/ExternalResults/BoolExternalResult.cpp	(revision 11861)
@@ -68,5 +68,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION BoolExternalResult::Marshall{{{1*/
 void  BoolExternalResult::Marshall(char** pmarshalled_dataset){
@@ -186,5 +186,5 @@
 /*}}}*/
 /*FUNCTION BoolExternalResult::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void BoolExternalResult::SetMatlabField(mxArray* dataref){
 
Index: /issm/trunk-jpl/src/c/objects/ExternalResults/BoolExternalResult.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/ExternalResults/BoolExternalResult.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/ExternalResults/BoolExternalResult.h	(revision 11861)
@@ -16,5 +16,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -47,5 +47,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -59,5 +59,5 @@
 		void  WriteData(FILE* fid,bool io_gather);
 		void  GetResultName(char**);
-	    #ifdef _SERIAL_
+	    #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleExternalResult.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleExternalResult.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleExternalResult.cpp	(revision 11861)
@@ -68,5 +68,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION DoubleExternalResult::Marshall{{{1*/
 void  DoubleExternalResult::Marshall(char** pmarshalled_dataset){
@@ -182,5 +182,5 @@
 /*}}}*/
 /*FUNCTION DoubleExternalResult::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void DoubleExternalResult::SetMatlabField(mxArray* dataref){
 
Index: /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleExternalResult.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleExternalResult.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleExternalResult.h	(revision 11861)
@@ -16,5 +16,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -48,5 +48,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -60,5 +60,5 @@
 		void  WriteData(FILE* fid,bool io_gather);
 		void  GetResultName(char**);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleMatExternalResult.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleMatExternalResult.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleMatExternalResult.cpp	(revision 11861)
@@ -96,5 +96,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION DoubleMatExternalResult::Marshall{{{1*/
 void  DoubleMatExternalResult::Marshall(char** pmarshalled_dataset){
@@ -223,5 +223,5 @@
 /*}}}*/
 /*FUNCTION DoubleMatExternalResult::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void DoubleMatExternalResult::SetMatlabField(mxArray* dataref){
 
Index: /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleMatExternalResult.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleMatExternalResult.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleMatExternalResult.h	(revision 11861)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -49,5 +49,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -61,5 +61,5 @@
 		void  WriteData(FILE* fid,bool io_gather);
 		void  GetResultName(char**);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleVecExternalResult.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleVecExternalResult.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleVecExternalResult.cpp	(revision 11861)
@@ -87,5 +87,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION DoubleVecExternalResult::Marshall{{{1*/
 void  DoubleVecExternalResult::Marshall(char** pmarshalled_dataset){
@@ -207,5 +207,5 @@
 /*}}}*/
 /*FUNCTION DoubleVecExternalResult::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void DoubleVecExternalResult::SetMatlabField(mxArray* dataref){
 
Index: /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleVecExternalResult.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleVecExternalResult.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleVecExternalResult.h	(revision 11861)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -48,5 +48,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -60,5 +60,5 @@
 		void  WriteData(FILE* fid,bool io_gather);
 		void  GetResultName(char**);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/ExternalResults/ExternalResult.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/ExternalResults/ExternalResult.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/ExternalResults/ExternalResult.h	(revision 11861)
@@ -16,5 +16,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -33,5 +33,5 @@
 		virtual void  WriteData(FILE* fid,bool io_gather)=0;
 		virtual void  GetResultName(char**)=0;
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		virtual void  SetMatlabField(mxArray* dataref)=0;
 		#endif
Index: /issm/trunk-jpl/src/c/objects/ExternalResults/IntExternalResult.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/ExternalResults/IntExternalResult.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/ExternalResults/IntExternalResult.cpp	(revision 11861)
@@ -68,5 +68,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION IntExternalResult::Marshall{{{1*/
 void  IntExternalResult::Marshall(char** pmarshalled_dataset){
@@ -186,5 +186,5 @@
 /*}}}*/
 /*FUNCTION IntExternalResult::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void IntExternalResult::SetMatlabField(mxArray* dataref){
 
Index: /issm/trunk-jpl/src/c/objects/ExternalResults/IntExternalResult.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/ExternalResults/IntExternalResult.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/ExternalResults/IntExternalResult.h	(revision 11861)
@@ -16,5 +16,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -46,5 +46,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -58,5 +58,5 @@
 		void  WriteData(FILE* fid,bool io_gather);
 		void  GetResultName(char**);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/ExternalResults/PetscVecExternalResult.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/ExternalResults/PetscVecExternalResult.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/ExternalResults/PetscVecExternalResult.cpp	(revision 11861)
@@ -80,5 +80,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION PetscVecExternalResult::Marshall{{{1*/
 void  PetscVecExternalResult::Marshall(char** pmarshalled_dataset){
@@ -245,5 +245,5 @@
 /*}}}*/
 /*FUNCTION PetscVecExternalResult::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  PetscVecExternalResult::SetMatlabField(mxArray* dataref){
 
Index: /issm/trunk-jpl/src/c/objects/ExternalResults/PetscVecExternalResult.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/ExternalResults/PetscVecExternalResult.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/ExternalResults/PetscVecExternalResult.h	(revision 11861)
@@ -16,5 +16,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -48,5 +48,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -60,5 +60,5 @@
 		void  WriteData(FILE* fid,bool io_gather);
 		void  GetResultName(char**);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/ExternalResults/StringExternalResult.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/ExternalResults/StringExternalResult.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/ExternalResults/StringExternalResult.cpp	(revision 11861)
@@ -71,5 +71,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION StringExternalResult::Marshall{{{1*/
 void  StringExternalResult::Marshall(char** pmarshalled_dataset){
@@ -198,5 +198,5 @@
 /*}}}*/
 /*FUNCTION StringExternalResult::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  StringExternalResult::SetMatlabField(mxArray* dataref){
 	
Index: /issm/trunk-jpl/src/c/objects/ExternalResults/StringExternalResult.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/ExternalResults/StringExternalResult.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/ExternalResults/StringExternalResult.h	(revision 11861)
@@ -16,5 +16,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -58,5 +58,5 @@
 		void  WriteData(FILE* fid,bool io_gather);
 		void  GetResultName(char**);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/Numerics/Matrix.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Numerics/Matrix.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Numerics/Matrix.cpp	(revision 11861)
@@ -140,5 +140,5 @@
 /*}}}*/
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION Matrix::ToMatlabMatrix{{{1*/
 mxArray* Matrix::ToMatlabMatrix(void){
Index: /issm/trunk-jpl/src/c/objects/Numerics/Matrix.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Numerics/Matrix.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Numerics/Matrix.h	(revision 11861)
@@ -21,5 +21,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
 #endif
@@ -51,5 +51,5 @@
 		/*Matrix specific routines {{{1*/
 		void Echo(void);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		mxArray* ToMatlabMatrix(void);
 		#endif
@@ -66,5 +66,5 @@
 };
 /*API: */
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 Matrix* MatlabMatrixToMatrix(const mxArray* mxmatrix);
 #endif
Index: /issm/trunk-jpl/src/c/objects/Numerics/Vector.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Numerics/Vector.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Numerics/Vector.cpp	(revision 11861)
@@ -133,5 +133,5 @@
 /*}}}*/
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION Vector::ToMatlabVector{{{1*/
 mxArray* Vector::ToMatlabVector(void){
Index: /issm/trunk-jpl/src/c/objects/Numerics/Vector.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Numerics/Vector.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Numerics/Vector.h	(revision 11861)
@@ -21,5 +21,5 @@
 #endif
 		
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
 #endif
@@ -54,5 +54,5 @@
 		/*Vector specific routines {{{1*/
 		void Echo(void);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		mxArray* ToMatlabVector(void);
 		#endif
@@ -78,5 +78,5 @@
 
 /*API: */
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 Vector* MatlabVectorToVector(const mxArray* mxvector);
 #endif
Index: /issm/trunk-jpl/src/c/objects/OptArgs.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/OptArgs.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/OptArgs.h	(revision 11861)
@@ -6,5 +6,5 @@
 #define _OPTARGS_H_
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 #include "mex.h"
Index: /issm/trunk-jpl/src/c/objects/Params/BoolParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/BoolParam.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/BoolParam.cpp	(revision 11861)
@@ -62,5 +62,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION BoolParam::Marshall{{{1*/
 void  BoolParam::Marshall(char** pmarshalled_dataset){
@@ -135,5 +135,5 @@
 /*}}}*/
 /*FUNCTION BoolParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  BoolParam::SetMatlabField(mxArray* dataref){
 	char* name=NULL;
Index: /issm/trunk-jpl/src/c/objects/Params/BoolParam.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/BoolParam.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/BoolParam.h	(revision 11861)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -41,5 +41,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -81,5 +81,5 @@
 		
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/Params/DoubleMatArrayParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/DoubleMatArrayParam.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/DoubleMatArrayParam.cpp	(revision 11861)
@@ -127,5 +127,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION DoubleMatArrayParam::Marshall{{{1*/
 void  DoubleMatArrayParam::Marshall(char** pmarshalled_dataset){
@@ -309,5 +309,5 @@
 /*}}}*/
 /*FUNCTION StringArrayParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  DoubleMatArrayParam::SetMatlabField(mxArray* dataref){
 	
Index: /issm/trunk-jpl/src/c/objects/Params/DoubleMatArrayParam.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/DoubleMatArrayParam.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/DoubleMatArrayParam.h	(revision 11861)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -44,5 +44,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -84,5 +84,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/Params/DoubleMatParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/DoubleMatParam.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/DoubleMatParam.cpp	(revision 11861)
@@ -78,5 +78,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION DoubleMatParam::Marshall{{{1*/
 void  DoubleMatParam::Marshall(char** pmarshalled_dataset){
@@ -169,5 +169,5 @@
 /*FUNCTION DoubleMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){{{1*/
 void  DoubleMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	int* output=NULL;
 	int  i;
@@ -191,5 +191,5 @@
 /*}}}*/
 /*FUNCTION DoubleMatParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  DoubleMatParam::SetMatlabField(mxArray* dataref){
 
Index: /issm/trunk-jpl/src/c/objects/Params/DoubleMatParam.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/DoubleMatParam.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/DoubleMatParam.h	(revision 11861)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -43,5 +43,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -84,5 +84,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/Params/DoubleParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/DoubleParam.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/DoubleParam.cpp	(revision 11861)
@@ -59,5 +59,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION DoubleParam::Marshall{{{1*/
 void  DoubleParam::Marshall(char** pmarshalled_dataset){
@@ -133,5 +133,5 @@
 /*FUNCTION DoubleParam::GetParameterValue(int* pinteger){{{1*/
 void DoubleParam::GetParameterValue(int* pinteger){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	*pinteger=(int)value;
 #else
@@ -142,5 +142,5 @@
 /*FUNCTION DoubleParam::GetParameterValue(bool* pbool){{{1*/
 void DoubleParam::GetParameterValue(bool* pbool){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 	/*If debugging mode, cheeck that the double is 0 or 1*/
@@ -155,5 +155,5 @@
 /*FUNCTION DoubleParam::GetParameterValue(int** pintarray,int* pM){{{1*/
 void DoubleParam::GetParameterValue(int** pintarray,int* pM){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	int* output=NULL;
 
@@ -171,5 +171,5 @@
 /*FUNCTION DoubleParam::GetParameterValue(int** pintarray,int* pM,int* pN){{{1*/
 void DoubleParam::GetParameterValue(int** pintarray,int* pM,int* pN){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	int* output=NULL;
 
@@ -188,5 +188,5 @@
 /*FUNCTION DoubleParam::GetParameterValue(double** pdoublearray,int* pM){{{1*/
 void DoubleParam::GetParameterValue(double** pdoublearray,int* pM){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	double* output=NULL;
 
@@ -204,5 +204,5 @@
 /*FUNCTION DoubleParam::GetParameterValue(double** pdoublearray,int* pM,int* pN){{{1*/
 void DoubleParam::GetParameterValue(double** pdoublearray,int* pM,int* pN){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	double* output=NULL;
 
@@ -220,5 +220,5 @@
 /*}}}*/
 /*FUNCTION DoubleParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  DoubleParam::SetMatlabField(mxArray* dataref){
 
Index: /issm/trunk-jpl/src/c/objects/Params/DoubleParam.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/DoubleParam.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/DoubleParam.h	(revision 11861)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -42,5 +42,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -82,5 +82,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/Params/DoubleTransientMatParam.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/DoubleTransientMatParam.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/DoubleTransientMatParam.h	(revision 11861)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
Index: /issm/trunk-jpl/src/c/objects/Params/DoubleVecParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/DoubleVecParam.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/DoubleVecParam.cpp	(revision 11861)
@@ -75,5 +75,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION DoubleVecParam::Marshall{{{1*/
 void  DoubleVecParam::Marshall(char** pmarshalled_dataset){
@@ -181,5 +181,5 @@
 /*FUNCTION DoubleVecParam::GetParameterValue(int** pintarray,int* pM){{{1*/
 void  DoubleVecParam::GetParameterValue(int** pintarray,int* pM){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	int* output=NULL;
 	int i;
@@ -203,5 +203,5 @@
 /*}}}*/
 /*FUNCTION DoubleVecParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  DoubleVecParam::SetMatlabField(mxArray* dataref){
 
Index: /issm/trunk-jpl/src/c/objects/Params/DoubleVecParam.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/DoubleVecParam.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/DoubleVecParam.h	(revision 11861)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -42,5 +42,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -82,5 +82,5 @@
 		
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/Params/FileParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/FileParam.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/FileParam.cpp	(revision 11861)
@@ -62,5 +62,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION FileParam::Marshall{{{1*/
 void  FileParam::Marshall(char** pmarshalled_dataset){
@@ -102,5 +102,5 @@
 /*}}}*/
 /*FUNCTION FileParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  FileParam::SetMatlabField(mxArray* dataref){
 	
Index: /issm/trunk-jpl/src/c/objects/Params/FileParam.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/FileParam.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/FileParam.h	(revision 11861)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -41,5 +41,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -81,5 +81,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/Params/IntMatParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/IntMatParam.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/IntMatParam.cpp	(revision 11861)
@@ -78,5 +78,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION IntMatParam::Marshall{{{1*/
 void  IntMatParam::Marshall(char** pmarshalled_dataset){
@@ -173,5 +173,5 @@
 /*}}}*/
 /*FUNCTION IntMatParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  IntMatParam::SetMatlabField(mxArray* dataref){
 
Index: /issm/trunk-jpl/src/c/objects/Params/IntMatParam.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/IntMatParam.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/IntMatParam.h	(revision 11861)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -43,5 +43,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -83,5 +83,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/Params/IntParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/IntParam.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/IntParam.cpp	(revision 11861)
@@ -62,5 +62,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION IntParam::Marshall{{{1*/
 void  IntParam::Marshall(char** pmarshalled_dataset){
@@ -135,5 +135,5 @@
 /*}}}*/
 /*FUNCTION IntParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  IntParam::SetMatlabField(mxArray* dataref){
 	
Index: /issm/trunk-jpl/src/c/objects/Params/IntParam.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/IntParam.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/IntParam.h	(revision 11861)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -42,5 +42,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -82,5 +82,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/Params/IntVecParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/IntVecParam.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/IntVecParam.cpp	(revision 11861)
@@ -91,5 +91,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION IntVecParam::Marshall{{{1*/
 void  IntVecParam::Marshall(char** pmarshalled_dataset){
@@ -186,5 +186,5 @@
 /*}}}*/
 /*FUNCTION IntVecParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  IntVecParam::SetMatlabField(mxArray* dataref){
 
Index: /issm/trunk-jpl/src/c/objects/Params/IntVecParam.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/IntVecParam.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/IntVecParam.h	(revision 11861)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -43,5 +43,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -83,5 +83,5 @@
 		
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/Params/MatrixParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/MatrixParam.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/MatrixParam.cpp	(revision 11861)
@@ -70,5 +70,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION MatrixParam::Marshall{{{1*/
 void  MatrixParam::Marshall(char** pmarshalled_dataset){
@@ -191,5 +191,5 @@
 /*}}}*/
 /*FUNCTION MatrixParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  MatrixParam::SetMatlabField(mxArray* dataref){
 	
Index: /issm/trunk-jpl/src/c/objects/Params/MatrixParam.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/MatrixParam.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/MatrixParam.h	(revision 11861)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -42,5 +42,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -82,5 +82,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/Params/Param.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/Param.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/Param.h	(revision 11861)
@@ -16,5 +16,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -60,5 +60,5 @@
 		virtual void  UnitConversion(int direction_enum)=0;
 		virtual void  GetParameterName(char**pname)=0;
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		virtual void  SetMatlabField(mxArray* dataref)=0;
 		#endif
Index: /issm/trunk-jpl/src/c/objects/Params/StringArrayParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/StringArrayParam.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/StringArrayParam.cpp	(revision 11861)
@@ -92,5 +92,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION StringArrayParam::Marshall{{{1*/
 void  StringArrayParam::Marshall(char** pmarshalled_dataset){
@@ -237,5 +237,5 @@
 /*}}}*/
 /*FUNCTION StringArrayParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  StringArrayParam::SetMatlabField(mxArray* dataref){
 	
Index: /issm/trunk-jpl/src/c/objects/Params/StringArrayParam.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/StringArrayParam.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/StringArrayParam.h	(revision 11861)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -44,5 +44,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -84,5 +84,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/Params/StringParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/StringParam.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/StringParam.cpp	(revision 11861)
@@ -64,5 +64,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION StringParam::Marshall{{{1*/
 void  StringParam::Marshall(char** pmarshalled_dataset){
@@ -165,5 +165,5 @@
 /*}}}*/
 /*FUNCTION StringParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  StringParam::SetMatlabField(mxArray* dataref){
 	
Index: /issm/trunk-jpl/src/c/objects/Params/StringParam.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/StringParam.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/StringParam.h	(revision 11861)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -42,5 +42,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -82,5 +82,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/objects/Params/VectorParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/VectorParam.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/VectorParam.cpp	(revision 11861)
@@ -72,5 +72,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION VectorParam::Marshall{{{1*/
 void  VectorParam::Marshall(char** pmarshalled_dataset){
@@ -189,5 +189,5 @@
 /*}}}*/
 /*FUNCTION VectorParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  VectorParam::SetMatlabField(mxArray* dataref){
 
Index: /issm/trunk-jpl/src/c/objects/Params/VectorParam.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Params/VectorParam.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/objects/Params/VectorParam.h	(revision 11861)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -42,5 +42,5 @@
 		int   Id(); 
 		int   MyRank();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
@@ -82,5 +82,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/trunk-jpl/src/c/shared/Alloc/alloc.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Alloc/alloc.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/shared/Alloc/alloc.cpp	(revision 11861)
@@ -125,5 +125,5 @@
 	if(!size)_error_("attempting to realloc to zero");
 
-	#ifdef _SERIAL_
+	#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	value = (void*)mxRealloc(pv,size);
 	#else
Index: /issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 11861)
@@ -11,5 +11,5 @@
 #include "../shared.h"
 #include "../../include/include.h"
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
 #endif
@@ -45,5 +45,5 @@
 	}
 	else{
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 			mexErrMsgTxt(exprintf("\n??? Error using ==> %s at %i\n%s error message: %s\n",
 							file_name.c_str(),file_line,function_name.c_str(),what()));
Index: /issm/trunk-jpl/src/c/shared/Matlab/PrintfFunction.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Matlab/PrintfFunction.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/shared/Matlab/PrintfFunction.cpp	(revision 11861)
@@ -9,5 +9,5 @@
 #include "../../include/include.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
 #endif
Index: /issm/trunk-jpl/src/c/shared/Matlab/matlabshared.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Matlab/matlabshared.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/shared/Matlab/matlabshared.h	(revision 11861)
@@ -9,10 +9,10 @@
 
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 int ModuleBoot(void);
 int ModuleEnd(void);
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
 mxArray* mxGetAssignedField(const mxArray* pmxa_array,int number, const char* field);
Index: /issm/trunk-jpl/src/c/shared/Matlab/mxGetAssignedField.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Matlab/mxGetAssignedField.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/shared/Matlab/mxGetAssignedField.cpp	(revision 11861)
@@ -9,5 +9,5 @@
 
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 #include "mex.h"
Index: /issm/trunk-jpl/src/c/shared/Numerics/OptFunc.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/OptFunc.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/shared/Numerics/OptFunc.cpp	(revision 11861)
@@ -13,5 +13,5 @@
 #include "../../include/include.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
 double OptFunc(double scalar, OptArgs* optargs){
Index: /issm/trunk-jpl/src/c/shared/Numerics/OptionsFromAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/OptionsFromAnalysis.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/shared/Numerics/OptionsFromAnalysis.cpp	(revision 11861)
@@ -30,5 +30,5 @@
 	parameters->FindParam(&strings,&numanalyses,PetscOptionsStringsEnum);
 
-	#ifdef _SERIAL_ //do not take this away, because ISSM loads analyses as a Double Param instead of a DoubleVec Param  when running with only 1 analysis
+	#if defined(_HAVE_MATLAB_) && defined(_SERIAL_) //do not take this away, because ISSM loads analyses as a Double Param instead of a DoubleVec Param  when running with only 1 analysis
 	if(numanalyses==1){ analyses=(double*)xmalloc(1*sizeof(double)); parameters->FindParam(analyses,PetscOptionsAnalysesEnum);
 	}
Index: /issm/trunk-jpl/src/c/shared/Numerics/Verbosity.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/Verbosity.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/shared/Numerics/Verbosity.cpp	(revision 11861)
@@ -18,5 +18,5 @@
 #include "../../include/macros.h"
 #include "../Exceptions/exceptions.h"
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -39,5 +39,5 @@
 	if(level<0) _error_("vebosity level should be a positive integer (user provided %i)",level);
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 	mxArray* output=NULL;
@@ -54,5 +54,5 @@
 /*FUNCTION GetVerbosityLevel {{{*/
 int  GetVerbosityLevel(void){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 	mxArray* output=NULL;
Index: /issm/trunk-jpl/src/c/toolkits/double/MatlabMatrixToDoubleMatrix.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/double/MatlabMatrixToDoubleMatrix.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/toolkits/double/MatlabMatrixToDoubleMatrix.cpp	(revision 11861)
@@ -11,5 +11,5 @@
 
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 /*Matlab includes: */
Index: /issm/trunk-jpl/src/c/toolkits/double/MatlabVectorToDoubleVector.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/double/MatlabVectorToDoubleVector.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/toolkits/double/MatlabVectorToDoubleVector.cpp	(revision 11861)
@@ -11,5 +11,5 @@
 
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 #include <string.h>
Index: /issm/trunk-jpl/src/c/toolkits/double/double.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/double/double.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/toolkits/double/double.h	(revision 11861)
@@ -6,5 +6,5 @@
 #define _DOUBLE_H_
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
 int MatlabMatrixToDoubleMatrix(double** pmatrix,int* pmatrix_rows,int* pmatrix_cols,const mxArray* mxmatrix);
Index: /issm/trunk-jpl/src/c/toolkits/issm/SeqMat.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/issm/SeqMat.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/toolkits/issm/SeqMat.cpp	(revision 11861)
@@ -93,5 +93,5 @@
 /*}}}*/
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION SeqMat::ToMatlabMatrix{{{1*/
 mxArray* SeqMat::ToMatlabMatrix(void){
Index: /issm/trunk-jpl/src/c/toolkits/issm/SeqMat.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/issm/SeqMat.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/toolkits/issm/SeqMat.h	(revision 11861)
@@ -16,5 +16,5 @@
 #include "../toolkitsenums.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
 #endif
@@ -40,5 +40,5 @@
 		/*SeqMat specific routines {{{1*/
 		void Echo(void);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		mxArray* ToMatlabMatrix(void);
 		#endif
@@ -56,5 +56,5 @@
 		
 /*API :*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 SeqMat*  MatlabMatrixToSeqMat(const mxArray* dataref);
 #endif
Index: /issm/trunk-jpl/src/c/toolkits/issm/SeqVec.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/issm/SeqVec.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/toolkits/issm/SeqVec.cpp	(revision 11861)
@@ -66,5 +66,5 @@
 /*}}}*/
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION SeqVec::ToMatlabVector{{{1*/
 mxArray* SeqVec::ToMatlabVector(void){
Index: /issm/trunk-jpl/src/c/toolkits/issm/SeqVec.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/issm/SeqVec.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/toolkits/issm/SeqVec.h	(revision 11861)
@@ -16,5 +16,5 @@
 #include "../toolkitsenums.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
 #endif
@@ -37,5 +37,5 @@
 		/*SeqVec specific routines {{{1*/
 		void Echo(void);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		mxArray* ToMatlabVector(void);
 		#endif
@@ -61,5 +61,5 @@
 
 /*API :*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 SeqVec*  MatlabVectorToSeqVec(const mxArray* dataref);
 #endif
Index: /issm/trunk-jpl/src/c/toolkits/matlab/MatlabNArrayToNArray.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/matlab/MatlabNArrayToNArray.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/toolkits/matlab/MatlabNArrayToNArray.cpp	(revision 11861)
@@ -13,5 +13,5 @@
 #include "../../include/include.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 
Index: /issm/trunk-jpl/src/c/toolkits/matlab/matlabincludes.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/matlab/matlabincludes.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/toolkits/matlab/matlabincludes.h	(revision 11861)
@@ -6,5 +6,5 @@
 #define _MATLAB_INCLUDES_H_
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 class Matrix;
Index: /issm/trunk-jpl/src/c/toolkits/petsc/patches/MatInvert.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/petsc/patches/MatInvert.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/toolkits/petsc/patches/MatInvert.cpp	(revision 11861)
@@ -56,5 +56,5 @@
 	MatAssemblyEnd(inv,MAT_FINAL_ASSEMBLY);
 
-	#ifdef _SERIAL_
+	#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		MatConvert(inv, MATSEQAIJ,MAT_REUSE_MATRIX,&inv);
 	#else
Index: /issm/trunk-jpl/src/c/toolkits/petsc/patches/MatlabMatrixToPetscMatrix.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/petsc/patches/MatlabMatrixToPetscMatrix.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/toolkits/petsc/patches/MatlabMatrixToPetscMatrix.cpp	(revision 11861)
@@ -11,5 +11,5 @@
 
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 /*Petsc includes: */
Index: /issm/trunk-jpl/src/c/toolkits/petsc/patches/MatlabVectorToPetscVector.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/petsc/patches/MatlabVectorToPetscVector.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/toolkits/petsc/patches/MatlabVectorToPetscVector.cpp	(revision 11861)
@@ -11,5 +11,5 @@
 
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 /*Petsc includes: */
Index: /issm/trunk-jpl/src/c/toolkits/petsc/patches/PetscMatrixToMatlabMatrix.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/petsc/patches/PetscMatrixToMatlabMatrix.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/toolkits/petsc/patches/PetscMatrixToMatlabMatrix.cpp	(revision 11861)
@@ -11,5 +11,5 @@
 
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 /*Petsc includes: */
Index: /issm/trunk-jpl/src/c/toolkits/petsc/patches/PetscVectorToMatlabVector.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/petsc/patches/PetscVectorToMatlabVector.cpp	(revision 11860)
+++ /issm/trunk-jpl/src/c/toolkits/petsc/patches/PetscVectorToMatlabVector.cpp	(revision 11861)
@@ -11,5 +11,5 @@
 
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 /*Petsc includes: */
@@ -64,3 +64,3 @@
 }
 
-#endif  //#ifdef _SERIAL_
+#endif  //#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
Index: /issm/trunk-jpl/src/c/toolkits/petsc/patches/petscpatches.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/petsc/patches/petscpatches.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/toolkits/petsc/patches/petscpatches.h	(revision 11861)
@@ -16,5 +16,5 @@
 class Parameters;
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
 int MatlabMatrixToPetscMatrix(Mat* matrix,int* prows,int* pcols, const mxArray* mxmatrix);
Index: /issm/trunk-jpl/src/c/toolkits/toolkits.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/toolkits.h	(revision 11860)
+++ /issm/trunk-jpl/src/c/toolkits/toolkits.h	(revision 11861)
@@ -16,9 +16,9 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "./matlab/matlabincludes.h"
 #endif
 
-#ifdef _HAVE_PYTHON_
+#if defined(_HAVE_PYTHON_) && defined(_SERIAL_)
 #include "./python/pythonincludes.h"
 #endif
