diff options
Diffstat (limited to 'config/gr_python.m4')
-rw-r--r-- | config/gr_python.m4 | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/config/gr_python.m4 b/config/gr_python.m4 index 6c862bba39..ea6df49c44 100644 --- a/config/gr_python.m4 +++ b/config/gr_python.m4 @@ -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 +]) |