mittinatten / freesasa

C-library for calculating Solvent Accessible Surface Areas
http://freesasa.github.io/
MIT License
105 stars 37 forks source link

Cython not found with --enable-python-bindings #15

Closed jaredsagendorf closed 7 years ago

jaredsagendorf commented 7 years ago

Hello, I'm trying to upgrade to version 2.0 (I had the previous version installed and working fine), with python-binding enabled (I am using freesasa as a python library).

I am running the configure script like so:

./configure --prefix="~/anaconda2/pkgs/freesasa-py27_0" --exec-prefix="~/anaconda2/pkgs/freesasa-py27_0" --enable-python-bindings  --with-python="~/anaconda2/bin/python2.7" --disable-json CFLAGS=-fPICgrep

This is identical to how I would run it before (except for the --disable-json flag), and everything was fine. Now, I get the error:

checking for cython... cython
configure: error: Cython not available, can not build Python bindings

However, Cython is definitely available, and is located in the system path, and the previous version of freesasa did not have any trouble finding it.

What has changed that could be causing this, and how can I fix it? Thank you, and this is a great tool.

jaredsagendorf commented 7 years ago

So I found a fix. I replace the following lines in configure.ac

if test "x$enable_python_bindings" = "xyes" ; then
  AC_CHECK_PROG([PYTHON], [$python_bin], [$python_bin])
  AC_CHECK_PROG([CYTHON], [cython], [cython])
  if test $CYTHON && test $PYTHON ; then
    AM_CONDITIONAL([HAVE_CYTHON], true)
  fi
  AM_COND_IF([HAVE_CYTHON],[],[AC_MSG_ERROR([Cython not available, can not build Python bindings])])
fi

with

if test "x$enable_python_bindings" = "xyes" ; then
  AC_CHECK_PROG(PYTHON, python, $python_bin)
  AC_CHECK_PROG(CYTHON, cython, cython)
  AM_CONDITIONAL([HAVE_CYTHON], [test -n "$CYTHON" && test -n "$PYTHON"])
  AM_COND_IF([HAVE_CYTHON],[],[echo "Cython not available, will not build Python bindings"])
else
  AM_CONDITIONAL([HAVE_CYTHON],false)
fi

I don't have any insight into why one works and one doesn't, but maybe someone can look into it.

mittinatten commented 7 years ago

Hi, thanks for the heads-up! Didn't get this error myself (assume this is sensitive to version of autoconf or some other detail of the system used). Your solution makes sense to me, will do some checks to make sure it doesn't break anything else.

mittinatten commented 7 years ago

Could you give me the details of your system so I can try to reproduce the error? Version of autoconf, operating system, perl, m4, cython and python.

mittinatten commented 7 years ago

Also, does it still work if you keep the square brackets around the arguments in AC_CHECK_PROG(...)?

mittinatten commented 7 years ago

I committed something similar to your change to the dev branch (3cdcebd). Can you check if that works for you?

mittinatten commented 7 years ago

Closing this, let me know if you have further problems!