Merged r9881:9917 from jcorgan/deb-wip into trunk. Updates Debian/Ubuntu packaging...
[debian/gnuradio] / config / gr_python.m4
index 6c862bba397b2516ef92f92c5f8a403ab8a7d2c7..ea6df49c44c3be821118d91aad7dd23e70a3a394 100644 (file)
@@ -126,3 +126,29 @@ print path
            AC_SUBST(PYTHON_LDFLAGS)
        fi
 ])
+
+# PYTHON_CHECK_MODULE
+#
+# Determines if a particular Python module can be imported
+#
+# $1 - module name
+# $2 - module description
+# $3 - action if found
+# $4 - action if not found
+
+AC_DEFUN([PYTHON_CHECK_MODULE],[
+    AC_MSG_CHECKING([for $2]) 
+    python_cmd='import sys
+try:
+    import $1
+except:
+    sys.exit(1)'
+
+    if ! $PYTHON -c "$python_cmd" ; then
+       AC_MSG_RESULT([no])
+       $4
+    else
+       AC_MSG_RESULT([yes])
+       $3
+    fi
+])