Index: ../trunk-jpl/m4/issm_options.m4
===================================================================
--- ../trunk-jpl/m4/issm_options.m4	(revision 18317)
+++ ../trunk-jpl/m4/issm_options.m4	(revision 18318)
@@ -1622,6 +1622,20 @@
 	dnl }}}
 
 	dnl Capabilities
+	dnl with-bamg{{{
+	AC_ARG_WITH([bamg],
+		AS_HELP_STRING([--with-bamg = YES],[compile with bamg capabilities (default is yes)]),
+		[BAMG=$withval],[BAMG=yes]) 
+	AC_MSG_CHECKING(for bamg capability compilation)
+
+	HAVE_BAMG=no
+	if test "x$BAMG" = "xyes"; then
+		HAVE_BAMG=yes
+		AC_DEFINE([_HAVE_BAMG_],[1],[with bamg meshing capability])
+	fi
+	AM_CONDITIONAL([BAMG], [test x$HAVE_BAMG = xyes])
+	AC_MSG_RESULT($HAVE_BAMG)
+	dnl }}}
 	dnl with-kml{{{
 	AC_ARG_WITH([kml],
 		AS_HELP_STRING([--with-kml = YES],[compile with kml capabilities (default is yes)]),
Index: ../trunk-jpl/src/c/Makefile.am
===================================================================
--- ../trunk-jpl/src/c/Makefile.am	(revision 18317)
+++ ../trunk-jpl/src/c/Makefile.am	(revision 18318)
@@ -458,6 +458,75 @@
 					  ./cores/DakotaSpawnCore.cpp
 endif
 #}}}
+#BAMG sources  {{{
+if BAMG
+issm_sources += ./bamg/bamgobjects.h\
+					 ./bamg/BamgGeom.h\
+					 ./bamg/BamgGeom.cpp\
+					 ./bamg/BamgMesh.h\
+					 ./bamg/BamgMesh.cpp\
+					 ./bamg/BamgOpts.h\
+					 ./bamg/BamgOpts.cpp\
+					 ./bamg/CrackedEdge.h\
+					 ./bamg/CrackedEdge.cpp\
+					 ./bamg/Curve.h\
+					 ./bamg/Curve.cpp\
+					 ./bamg/Direction.h\
+					 ./bamg/Direction.cpp\
+					 ./bamg/DoubleAndInt.h\
+					 ./bamg/Edge.h\
+					 ./bamg/Edge.cpp\
+					 ./bamg/GeomEdge.h\
+					 ./bamg/GeomEdge.cpp\
+					 ./bamg/GeomSubDomain.h\
+					 ./bamg/GeomSubDomain.cpp\
+					 ./bamg/GeomVertex.h\
+					 ./bamg/GeomVertex.cpp\
+					 ./bamg/Geometry.cpp\
+					 ./bamg/Geometry.h\
+					 ./bamg/ListofIntersectionTriangles.cpp\
+					 ./bamg/ListofIntersectionTriangles.h\
+					 ./bamg/EigenMetric.cpp\
+					 ./bamg/Metric.cpp\
+					 ./bamg/Metric.h\
+					 ./bamg/BamgQuadtree.cpp\
+					 ./bamg/BamgQuadtree.h\
+					 ./bamg/R2.h\
+					 ./bamg/SetOfE4.cpp\
+					 ./bamg/SetOfE4.h\
+					 ./bamg/SubDomain.h\
+					 ./bamg/SubDomain.cpp\
+					 ./bamg/AdjacentTriangle.h\
+					 ./bamg/AdjacentTriangle.cpp\
+					 ./bamg/Triangle.cpp\
+					 ./bamg/det.h \
+					 ./bamg/Triangle.h\
+					 ./bamg/BamgVertex.cpp\
+					 ./bamg/BamgVertex.h\
+					 ./bamg/VertexOnEdge.h\
+					 ./bamg/VertexOnEdge.cpp\
+					 ./bamg/VertexOnGeom.h\
+					 ./bamg/VertexOnGeom.cpp\
+					 ./bamg/VertexOnVertex.h\
+					 ./bamg/VertexOnVertex.cpp\
+					 ./bamg/Mesh.cpp\
+					 ./bamg/Mesh.h\
+					 ./shared/Bamg/Abs.h \
+					 ./shared/Bamg/BigPrimeNumber.h\
+					 ./shared/Bamg/BigPrimeNumber.cpp\
+					 ./shared/Bamg/BinaryRand.h \
+					 ./shared/Bamg/Exchange.h \
+					 ./shared/Bamg/extrema.h \
+					 ./shared/Bamg/HeapSort.h \
+					 ./shared/Bamg/OppositeAngle.h \
+					 ./modules/Bamgx/Bamgx.cpp\
+					 ./modules/Bamgx/Bamgx.h\
+					 ./modules/BamgConvertMeshx/BamgConvertMeshx.cpp\
+					 ./modules/BamgConvertMeshx/BamgConvertMeshx.h\
+					 ./modules/BamgTriangulatex/BamgTriangulatex.cpp\
+					 ./modules/BamgTriangulatex/BamgTriangulatex.h
+endif
+#}}}
 #Petsc sources  {{{
 if PETSC
 issm_sources += ./toolkits/petsc\
@@ -629,95 +698,8 @@
 
 #Wrapper sources
 #Bamg sources  {{{
-bamg_sources =  ./bamg/bamgobjects.h\
-					 ./bamg/BamgGeom.h\
-					 ./bamg/BamgGeom.cpp\
-					 ./bamg/BamgMesh.h\
-					 ./bamg/BamgMesh.cpp\
-					 ./bamg/BamgOpts.h\
-					 ./bamg/BamgOpts.cpp\
-					 ./bamg/CrackedEdge.h\
-					 ./bamg/CrackedEdge.cpp\
-					 ./bamg/Curve.h\
-					 ./bamg/Curve.cpp\
-					 ./bamg/Direction.h\
-					 ./bamg/Direction.cpp\
-					 ./bamg/DoubleAndInt.h\
-					 ./bamg/Edge.h\
-					 ./bamg/Edge.cpp\
-					 ./bamg/GeomEdge.h\
-					 ./bamg/GeomEdge.cpp\
-					 ./bamg/GeomSubDomain.h\
-					 ./bamg/GeomSubDomain.cpp\
-					 ./bamg/GeomVertex.h\
-					 ./bamg/GeomVertex.cpp\
-					 ./bamg/Geometry.cpp\
-					 ./bamg/Geometry.h\
-					 ./bamg/ListofIntersectionTriangles.cpp\
-					 ./bamg/ListofIntersectionTriangles.h\
-					 ./bamg/EigenMetric.cpp\
-					 ./bamg/Metric.cpp\
-					 ./bamg/Metric.h\
-					 ./bamg/BamgQuadtree.cpp\
-					 ./bamg/BamgQuadtree.h\
-					 ./bamg/R2.h\
-					 ./bamg/SetOfE4.cpp\
-					 ./bamg/SetOfE4.h\
-					 ./bamg/SubDomain.h\
-					 ./bamg/SubDomain.cpp\
-					 ./bamg/AdjacentTriangle.h\
-					 ./bamg/AdjacentTriangle.cpp\
-					 ./bamg/Triangle.cpp\
-					 ./bamg/det.h \
-					 ./bamg/Triangle.h\
-					 ./bamg/BamgVertex.cpp\
-					 ./bamg/BamgVertex.h\
-					 ./bamg/VertexOnEdge.h\
-					 ./bamg/VertexOnEdge.cpp\
-					 ./bamg/VertexOnGeom.h\
-					 ./bamg/VertexOnGeom.cpp\
-					 ./bamg/VertexOnVertex.h\
-					 ./bamg/VertexOnVertex.cpp\
-					 ./bamg/Mesh.cpp\
-					 ./bamg/Mesh.h\
-					 ./shared/Bamg/Abs.h \
-					 ./shared/Bamg/BigPrimeNumber.h\
-					 ./shared/Bamg/BigPrimeNumber.cpp\
-					 ./shared/Bamg/BinaryRand.h \
-					 ./shared/Bamg/Exchange.h \
-					 ./shared/Bamg/extrema.h \
-					 ./shared/Bamg/HeapSort.h \
-					 ./shared/Bamg/OppositeAngle.h \
-					 ./modules/Bamgx/Bamgx.cpp\
-					 ./modules/Bamgx/Bamgx.h\
-					 ./modules/BamgConvertMeshx/BamgConvertMeshx.cpp\
-					 ./modules/BamgConvertMeshx/BamgConvertMeshx.h\
-					 ./modules/BamgTriangulatex/BamgTriangulatex.cpp\
-					 ./modules/BamgTriangulatex/BamgTriangulatex.h
+
 #}}}
-#Kriging sources  {{{
-if KRIGING
-kriging_sources = ./classes/kriging/Observations.h\
-					./classes/kriging/Observations.cpp\
-					./classes/kriging/Variogram.h \
-					./classes/kriging/GaussianVariogram.h\
-					./classes/kriging/GaussianVariogram.cpp\
-					./classes/kriging/ExponentialVariogram.h\
-					./classes/kriging/ExponentialVariogram.cpp\
-					./classes/kriging/SphericalVariogram.h\
-					./classes/kriging/SphericalVariogram.cpp\
-					./classes/kriging/PowerVariogram.h\
-					./classes/kriging/PowerVariogram.cpp\
-					./classes/kriging/Quadtree.h\
-					./classes/kriging/Quadtree.cpp\
-					./classes/kriging/Observation.h\
-					./classes/kriging/Observation.cpp\
-					./modules/Krigingx/Krigingx.cpp\
-					./modules/Krigingx/Krigingx.h\
-					./modules/Krigingx/pKrigingx.cpp
-issm_sources +=$(kriging_sources)
-endif
-#}}}
 #Kml sources  {{{
 kml_sources = ./modules/Exp2Kmlx/Exp2Kmlx.h\
 				  ./modules/Exp2Kmlx/Exp2Kmlx.cpp\
@@ -844,7 +826,33 @@
 						./modules/Scotchx/Scotchx.h
 endif
 #}}}
+
+#kriging (WRAPPER and executable)
+#Kriging sources  {{{
+if KRIGING
+issm_sources +=./classes/kriging/Observations.h\
+					./classes/kriging/Observations.cpp\
+					./classes/kriging/Variogram.h \
+					./classes/kriging/GaussianVariogram.h\
+					./classes/kriging/GaussianVariogram.cpp\
+					./classes/kriging/ExponentialVariogram.h\
+					./classes/kriging/ExponentialVariogram.cpp\
+					./classes/kriging/SphericalVariogram.h\
+					./classes/kriging/SphericalVariogram.cpp\
+					./classes/kriging/PowerVariogram.h\
+					./classes/kriging/PowerVariogram.cpp\
+					./classes/kriging/Quadtree.h\
+					./classes/kriging/Quadtree.cpp\
+					./classes/kriging/Observation.h\
+					./classes/kriging/Observation.cpp\
+					./modules/Krigingx/pKrigingx.cpp
+
+modules_sources +=./modules/Krigingx/Krigingx.cpp\
+						./modules/Krigingx/Krigingx.h\
+						./modules/Krigingx/pKrigingx.cpp
+endif
 #}}}
+#}}}
 #Library flags and sources {{{
 ALLCXXFLAGS= -fPIC -D_GNU_SOURCE -fno-omit-frame-pointer -pthread -D_CPP_  $(CXXFLAGS) $(CXXOPTFLAGS) 
 
