summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/linux/acinclude.m412
-rw-r--r--build/linux/configure.ac28
2 files changed, 28 insertions, 12 deletions
diff --git a/build/linux/acinclude.m4 b/build/linux/acinclude.m4
index 713b5d3..e4b6de7 100644
--- a/build/linux/acinclude.m4
+++ b/build/linux/acinclude.m4
@@ -70,6 +70,18 @@ AC_DEFUN([ASTRA_RUN_LOGOUTPUT],[{
}])
+dnl ASTRA_TRY_PYTHON(code, action-if-ok, action-if-not-ok)
+AC_DEFUN([ASTRA_TRY_PYTHON],[
+cat >conftest.py <<_ACEOF
+$1
+_ACEOF
+ASTRA_RUN_LOGOUTPUT($PYTHON conftest.py)
+AS_IF([test $? = 0],[$2],[
+ AS_ECHO(["$as_me: failed program was:"]) >&AS_MESSAGE_LOG_FD
+ sed 's/^/| /' conftest.py >&AS_MESSAGE_LOG_FD
+ $3])
+])
+
dnl ASTRA_CHECK_NVCC(variable-to-set,cppflags-to-set)
AC_DEFUN([ASTRA_CHECK_NVCC],[
diff --git a/build/linux/configure.ac b/build/linux/configure.ac
index 525ca9d..b97a7a0 100644
--- a/build/linux/configure.ac
+++ b/build/linux/configure.ac
@@ -180,26 +180,30 @@ if test x"$with_python" != x -a x"$with_python" != xno; then
HAVEPYTHON=yes
AC_SUBST(PYTHON)
AC_MSG_CHECKING(for numpy module)
- echo "import numpy" | $PYTHON -
- if test $? -ne 0 ; then
- AC_MSG_RESULT(not found)
+ ASTRA_TRY_PYTHON([import numpy],,HAVEPYTHON=no)
+ if test x$HAVEPYTHON = xno; then
+ AC_MSG_RESULT(no)
AC_MSG_ERROR(You need the numpy module to use the ASTRA toolbox in Python)
fi
- AC_MSG_RESULT(found)
+ AC_MSG_RESULT(yes)
AC_MSG_CHECKING(for Cython module)
- echo "import Cython;from distutils.version import LooseVersion;assert(LooseVersion(Cython.__version__)>=LooseVersion('0.13'))" | $PYTHON -
- if test $? -ne 0 ; then
- AC_MSG_RESULT(not found)
+ ASTRA_TRY_PYTHON([
+import Cython
+from distutils.version import LooseVersion
+assert(LooseVersion(Cython.__version__)>=LooseVersion("0.13"))
+],,HAVEPYTHON=no)
+ if test x$HAVEPYTHON = xno; then
+ AC_MSG_RESULT(no)
AC_MSG_ERROR(You need the Cython module (version >=0.13) to use the ASTRA toolbox in Python)
fi
- AC_MSG_RESULT(found)
+ AC_MSG_RESULT(yes)
AC_MSG_CHECKING(for six module)
- echo "import six" | $PYTHON -
- if test $? -ne 0 ; then
- AC_MSG_RESULT(not found)
+ ASTRA_TRY_PYTHON([import six])
+ if test x$HAVEPYTHON = xno; then
+ AC_MSG_RESULT(no)
AC_MSG_ERROR(You need the six module to use the ASTRA toolbox in Python)
fi
- AC_MSG_RESULT(found)
+ AC_MSG_RESULT(yes)
fi
AC_SUBST(HAVEPYTHON)