Index: /issm/trunk-jpl/m4/issm_options.m4
===================================================================
--- /issm/trunk-jpl/m4/issm_options.m4	(revision 15673)
+++ /issm/trunk-jpl/m4/issm_options.m4	(revision 15674)
@@ -98,8 +98,8 @@
 
 	dnl 1. See if matlab has been provided
-	AC_ARG_WITH([matlab-dir],                                                                     dnl feature
-	AS_HELP_STRING([--with-matlab-dir=DIR],[matlab root directory. necessary for serial build.]), dnl help string
-	[MATLAB_ROOT=$withval],                                                                       dnl action if given
-	[MATLAB_ROOT="no"])                                                                           dnl action if not given
+	AC_ARG_WITH([matlab-dir],                                         dnl feature
+	AS_HELP_STRING([--with-matlab-dir=DIR],[matlab root directory.]), dnl help string
+	[MATLAB_ROOT=$withval],                                           dnl action if given
+	[MATLAB_ROOT="no"])                                               dnl action if not given
 
 	AC_MSG_CHECKING([whether matlab is enabled])
@@ -111,5 +111,4 @@
 		  AC_MSG_ERROR([matlab directory provided ($MATLAB_ROOT) does not exist]);
 		fi
-		AC_DEFINE([_HAVE_MATLAB_],[1],[with matlab in ISSM src])
 	fi
 	AC_MSG_RESULT($HAVE_MATLAB)
@@ -119,4 +118,5 @@
 	if test "x$HAVE_MATLAB" = "xyes"; then
 
+		AC_DEFINE([_HAVE_MATLAB_],[1],[with matlab in ISSM src])
 		AC_MSG_CHECKING(for matlab headers and libraries in $MATLAB_ROOT)
   		MATLABINCL="-I$MATLAB_ROOT/extern/include/"
@@ -152,5 +152,5 @@
 	dnl triangle {{{
 	AC_ARG_WITH([triangle-dir],
-			  AS_HELP_STRING([--with-triangle-dir=DIR], [triangle root directory. necessary for serial build]),
+			  AS_HELP_STRING([--with-triangle-dir=DIR], [triangle root directory.]),
 			 [TRIANGLE_ROOT=$withval],[TRIANGLE_ROOT="no"]) 
 
@@ -164,5 +164,4 @@
 			AC_MSG_ERROR([triangle directory provided ($TRIANGLE_ROOT) does not exist]);
 		fi
-		AC_DEFINE([_HAVE_TRIANGLE_],[1],[with triangle in ISSM src])
 	fi
 	AC_MSG_RESULT($HAVE_TRIANGLE)
@@ -202,5 +201,4 @@
 			AC_MSG_ERROR([boost directory provided ($BOOST_ROOT) does not exist]);
 		fi
-		AC_DEFINE([_HAVE_BOOST_],[1],[with boost in ISSM src])
 	fi
 	AC_MSG_RESULT($HAVE_BOOST)
@@ -218,5 +216,5 @@
 	dnl dakota{{{
 	AC_ARG_WITH([dakota-dir],
-	  AS_HELP_STRING([--with-dakota-dir=DIR], [dakota root directory. necessary for serial build]),
+	  AS_HELP_STRING([--with-dakota-dir=DIR], [dakota root directory.]),
 	  [DAKOTA_ROOT=$withval],[DAKOTA_ROOT="no"]) 
 	
@@ -230,5 +228,4 @@
 			AC_MSG_ERROR([dakota directory provided ($DAKOTA_ROOT) does not exist]);
 		fi
-		AC_DEFINE([_HAVE_DAKOTA_],[1],[with dakota in ISSM src])
 	fi
 	AC_MSG_RESULT($HAVE_DAKOTA)
@@ -290,5 +287,4 @@
 			;;
 		esac
-		AC_DEFINE([_HAVE_DAKOTA_],[1],[with Dakota in ISSM src])
 
 		case $DAKOTA_VERSION in
@@ -322,4 +318,5 @@
 		AC_DEFINE_UNQUOTED([_DAKOTA_BUILD_],$DAKOTA_BUILD,[Dakota build version number])
 
+		AC_DEFINE([_HAVE_DAKOTA_],[1],[with Dakota in ISSM src])
 		AC_SUBST([DAKOTAINCL])
 		AC_SUBST([DAKOTAFLAGS])
@@ -330,38 +327,40 @@
 	AC_ARG_WITH([python-dir],
 	  AS_HELP_STRING([--with-python-dir=DIR], [python root directory.]),
-	  [PYTHON_ROOT=$withval],[PYTHON_ROOT=""]) 
-
-	AC_MSG_CHECKING(for python)
-	if test -d "$PYTHON_ROOT"; then
-		HAVE_PYTHON="yes"
-		AC_DEFINE([_HAVE_PYTHON_],[1],[with Python in ISSM src])
-	else
+	  [PYTHON_ROOT=$withval],[PYTHON_ROOT="no"]) 
+
+	dnl Check whether python is enabled
+	AC_MSG_CHECKING([for python])
+	if test "x$PYTHON_ROOT" = "xno" ; then
 		HAVE_PYTHON=no
+	else
+		HAVE_PYTHON=yes
+		if ! test -d "$PYTHON_ROOT"; then
+			AC_MSG_ERROR([python directory provided ($PYTHON_ROOT) does not exist]);
+		fi
 	fi
 	AC_MSG_RESULT($HAVE_PYTHON)
-
-	dnl get python version
-	if test x$HAVE_PYTHON = xyes; then
+	AM_CONDITIONAL([PYTHON],[test x$HAVE_PYTHON = xyes])
+
+	dnl python specifics
+	if test "x$HAVE_PYTHON" = "xyes"; then
 		AC_MSG_CHECKING(for python version)
-		dnl Query Python for its version number.  Getting [:3] seems to be
-		dnl the best way to do this; it's what "site.py" does in the standard
-		dnl library.
+		dnl Query Python for its version number.  Getting [:3] seems to be the
+		dnl best way to do this; it's what "site.py" does in the standard library.
 		PYTHON_VERSION=$($PYTHON_ROOT/bin/python -c "import sys; print sys.version[[:3]]")
 		AC_MSG_RESULT($PYTHON_VERSION)
 
-		dnl recover major: 
+		dnl recover major 
 		PYTHON_MAJOR=${PYTHON_VERSION%.*}
-		if test x$PYTHON_MAJOR = x3; then
-			dnl are we running python 3?
+		AC_DEFINE_UNQUOTED([_PYTHON_MAJOR_],$PYTHON_MAJOR,[python version major])
+		if test "x$PYTHON_MAJOR" = "x3"; then
 			HAVE_PYTHON3="yes"
 		else
 			HAVE_PYTHON3="no"
 		fi
-		AC_DEFINE_UNQUOTED([_PYTHON_MAJOR_],$PYTHON_MAJOR,[python version major])
+		AM_CONDITIONAL([PYTHON3], [test x$HAVE_PYTHON3 = xyes])
 
 		PYTHONINCL=-I$PYTHON_ROOT/include
 		PYTHONLIB="-L$PYTHON_ROOT/lib -lpython$PYTHON_VERSION"
 		PYTHONEXT=.so
-
 		case "${host_os}" in
 			*cygwin*)
@@ -375,5 +374,5 @@
 			;;
 		esac
-
+		AC_DEFINE([_HAVE_PYTHON_],[1],[with python in ISSM src])
 		AC_SUBST([PYTHONINCL])
 		AC_SUBST([PYTHONLIB])
@@ -382,46 +381,55 @@
 		AC_SUBST([PYTHONLINK])
 	fi
-	AM_CONDITIONAL([PYTHON], [test x$HAVE_PYTHON = xyes])
-	AM_CONDITIONAL([PYTHON3], [test x$HAVE_PYTHON3 = xyes])
 	dnl }}}
 	dnl python-numpy{{{
 	AC_ARG_WITH([python-numpy-dir],
 	  AS_HELP_STRING([--with-python-numpy-dir=DIR], [python-numpy root directory.]),
-	  [PYTHON_NUMPY_ROOT=$withval],[PYTHON_NUMPY_ROOT=""]) 
+	  [PYTHON_NUMPY_ROOT=$withval],[PYTHON_NUMPY_ROOT="no"]) 
+	
+	dnl Check whether numpy is enabled
 	AC_MSG_CHECKING(for python-numpy)
-	
-	if test -d "$PYTHON_NUMPY_ROOT"; then
-		dnl defaults
+	if test "x$PYTHON_NUMPY_ROOT" = "xno" ; then
+		HAVE_PYTHON_NUMPY=no
+	else
 		HAVE_PYTHON_NUMPY=yes
+		if ! test -d "$PYTHON_NUMPY_ROOT"; then
+			AC_MSG_ERROR([numpy directory provided ($PYTHON_NUMPY_ROOT) does not exist]);
+		fi
+	fi
+	AC_MSG_RESULT($HAVE_PYTHON_NUMPY)
+
+	dnl numpy lib
+	if test "x$HAVE_PYTHON_NUMPY" = "xyes"; then
 		PYTHON_NUMPYINCL="-I$PYTHON_NUMPY_ROOT -I$PYTHON_NUMPY_ROOT/core/include/numpy"
-
 		AC_DEFINE([_HAVE_PYTHON_NUMPY_],[1],[with Python-Numpy in ISSM src])
 		AC_SUBST([PYTHON_NUMPYINCL])
-	else
-		HAVE_PYTHON_NUMPY=no
-	fi
-	AC_MSG_RESULT($HAVE_PYTHON_NUMPY)
+	fi
 	dnl }}}
 	dnl chaco{{{
 	AC_ARG_WITH([chaco-dir],
 	  AS_HELP_STRING([--with-chaco-dir=DIR], [chaco root directory.]),
-	  [CHACO_ROOT=$withval],[CHACO_ROOT=""]) 
-	AC_MSG_CHECKING(for chaco)
+	  [CHACO_ROOT=$withval],[CHACO_ROOT="no"]) 
 	
-	if test -d "$CHACO_ROOT"; then
-
-		dnl defaults
+	dnl Check whether chaco is enabled
+	AC_MSG_CHECKING([for chaco])
+	if test "x$CHACO_ROOT" = "xno" ; then
+		HAVE_CHACO=no
+	else
 		HAVE_CHACO=yes
+		if ! test -d "$CHACO_ROOT"; then
+			AC_MSG_ERROR([chaco directory provided ($CHACO_ROOT) does not exist]);
+		fi
+	fi
+	AC_MSG_RESULT($HAVE_CHACO)
+	AM_CONDITIONAL([CHACO],[test x$HAVE_CHACO = xyes])
+
+	dnl library and header files
+	if test "x$HAVE_CHACO" = "xyes"; then
 		CHACOINCL=-I$CHACO_ROOT/include
 		CHACOLIB="-L$CHACO_ROOT/lib -lchacominusblas"
-
 		AC_DEFINE([_HAVE_CHACO_],[1],[with Chaco in ISSM src])
 		AC_SUBST([CHACOINCL])
 		AC_SUBST([CHACOLIB])
-
-	else
-		HAVE_CHACO=no
-	fi
-	AC_MSG_RESULT($HAVE_CHACO)
+	fi
 	dnl }}}
 	dnl scotch{{{
