[cig-commits] r13591 - in cs/cigma/trunk: . config

luis at geodynamics.org luis at geodynamics.org
Tue Dec 9 18:15:22 PST 2008


Author: luis
Date: 2008-12-09 18:15:21 -0800 (Tue, 09 Dec 2008)
New Revision: 13591

Added:
   cs/cigma/trunk/config/check_numpy.m4
Modified:
   cs/cigma/trunk/configure.ac
Log:
Replaced usage of AC_CHECK_PYTHON_MODULE with specific module (numpy)

Variable variables don't seem to work with AC_SUBST in version 2.62
of autoconf (which is the default in MacPorts on Mac OS X 10.5).
The obvious workaround is to define AC_CHECK_PYTHON_NUMPY directly.

Added: cs/cigma/trunk/config/check_numpy.m4
===================================================================
--- cs/cigma/trunk/config/check_numpy.m4	                        (rev 0)
+++ cs/cigma/trunk/config/check_numpy.m4	2008-12-10 02:15:21 UTC (rev 13591)
@@ -0,0 +1,43 @@
+# AC_CHECK_PYTHON_NUMPY
+#
+# Based on http://www.sp.or.at/python_module.m4
+
+#
+# AC_CHECK_PYTHON_NUMPY([VERSION_VARIABLE])
+#
+AC_DEFUN([AC_CHECK_PYTHON_NUMPY],[
+    # check for the python binary defined in $PYTHON
+    # fall back to "python"
+    if test -z $PYTHON; then
+        PYTHON="python"
+    fi
+
+    AC_MSG_CHECKING(for python module numpy)
+
+    if test -z "$1"; then
+        $PYTHON -c "import numpy" 2>/dev/null
+        if test $? -eq 0; then
+            PYTHON_NUMPY=1
+            AC_MSG_RESULT(found)
+        else
+            PYTHON_NUMPY=0
+            AC_MSG_RESULT(not found)
+        fi
+        AC_SUBST(PYTHON_NUMPY)
+    else
+        VERSION=`$PYTHON -c "import numpy; print numpy.__version__" 2>/dev/null`
+        if test $? -eq 0; then
+            PYTHON_NUMPY=1
+            PYTHON_NUMPY_VERSION=$VERSION
+            AC_MSG_RESULT([found ($VERSION)])
+        else
+            PYTHON_NUMPY=0
+            PYTHON_NUMPY_VERSION=0
+            AC_MSG_RESULT(not found)
+        fi
+        AC_SUBST(PYTHON_NUMPY)
+        AC_SUBST(PYTHON_NUMPY_VERSION)
+    fi
+])
+
+# vim: syntax=config foldmethod=marker

Modified: cs/cigma/trunk/configure.ac
===================================================================
--- cs/cigma/trunk/configure.ac	2008-12-10 02:15:20 UTC (rev 13590)
+++ cs/cigma/trunk/configure.ac	2008-12-10 02:15:21 UTC (rev 13591)
@@ -41,8 +41,8 @@
 CIGMA_PATH_HDF5
 
 dnl Check for numpy
-AC_CHECK_PYTHON_MODULE(numpy)
-if [test "$PYTHON_numpy" != "1"]; then
+AC_CHECK_PYTHON_NUMPY
+if [test "$PYTHON_NUMPY" != "1"]; then
     AC_MSG_ERROR([[Could not import the numpy python module. Please ensure it is installed correctly and is available in your PYTHONPATH]])
 fi
 
@@ -83,7 +83,7 @@
 echo "- Python binary      : $PYTHON_BIN"
 echo "- Python header path : $PYTHON_INCLUDE_DIR"
 echo "- Python library     : -l$PYTHON_LIB"
-echo "- NumPy library      : $PYTHON_numpy"
+echo "- NumPy library      : $PYTHON_NUMPY"
 
 # if using cigma_boost.m4
 #echo "- BOOST_CPPFLAGS                : $BOOST_CPPFLAGS"



More information about the CIG-COMMITS mailing list