[cig-commits] r17956 - cs/autoconf/trunk

brad at geodynamics.org brad at geodynamics.org
Wed Feb 23 12:20:08 PST 2011


Author: brad
Date: 2011-02-23 12:20:08 -0800 (Wed, 23 Feb 2011)
New Revision: 17956

Modified:
   cs/autoconf/trunk/cit_python.m4
Log:
Added function to check for python module and version.

Modified: cs/autoconf/trunk/cit_python.m4
===================================================================
--- cs/autoconf/trunk/cit_python.m4	2011-02-23 17:52:39 UTC (rev 17955)
+++ cs/autoconf/trunk/cit_python.m4	2011-02-23 20:20:08 UTC (rev 17956)
@@ -425,5 +425,34 @@
 fi
 ])dnl CIT_PATH_NEMESIS
 
+# CIT_PYTHON_MODULE(name, version)
+# -----------------
+# Determine whether module is available.
+AC_DEFUN([CIT_PYTHON_MODULE],[
+AC_REQUIRE([AM_PATH_PYTHON])
+AC_MSG_CHECKING(for python module $1)
+$PYTHON -c "import $1" 2>/dev/null
+if test $? == 0; then
+  eval s=`$PYTHON -c "import $1; print $1.__""file__"`
+  AC_MSG_RESULT([found $s])
+else
+  AC_MSG_FAILURE(not found)
+fi
+if test -n "$2" ; then
+  eval $PYTHON -c "import $1; print $1.__version__" | sed 's/\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)/avail_major=\1; avail_minor=\2; avail_patch=\3/'
+  eval `echo $2 | sed 's/\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)/req_major=\1; req_minor=\2; req_patch=\3/'`
+  if test $avail_major -lt $req_major ; then
+    AC_MSG_FAILURE([$1 version >= $2 is required. You have $avail_major.$avail_minor.$avail_patch.])
+  elif test $avail_major -eq $req_major -a $avail_minor -lt $req_minor; then
+    AC_MSG_FAILURE([$1 version >= $2 is required. You have $avail_major.$avail_minor.$avail_path.])
+  elif test $avail_major -eq $req_major -a $avail_minor -eq $req_minor -a $avail_patch -lt $req_patch; then
+    AC_MSG_FAILURE([$1 version >= $2 is required. You have $avail_major.$avail_minor.$avail_path.])
+  fi
+fi
 
+]) dnl CIT_PYTHON_MODULE
+
+
+
+
 dnl end of file



More information about the CIG-COMMITS mailing list