Skip to content

Commit

Permalink
now if no python package is found also python_bin is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
Iximiel committed Dec 12, 2023
1 parent 80cdd25 commit 16acc46
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 56 deletions.
83 changes: 42 additions & 41 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ CPPFLAGS
LDFLAGS
CXXFLAGS
CXX
CYTHON_FOUND
PYTHON_CFLAGS
PYTHON_LDFLAGS
PYBIND11_CFLAGS
Expand Down Expand Up @@ -3251,6 +3252,7 @@ fi




# by default use -O flag
# we override the autoconf default (-g) because in release build we do not want to
# include symbol information (obj files are huge)
Expand Down Expand Up @@ -8973,44 +8975,9 @@ $as_echo "$as_me: WARNING: cannot enable __PLUMED_HAS_FFTW" >&2;}

fi

if test $pycv = true ; then
if test -n "$PYTHON_BIN"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Python executable is $PYTHON_BIN" >&5
$as_echo "$as_me: Python executable is $PYTHON_BIN" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pycv: support for required python modules (python3, pybind11, numpy)" >&5
$as_echo_n "checking pycv: support for required python modules (python3, pybind11, numpy)... " >&6; }
testimport="
import numpy
import pybind11
#no need to check for python3, if you have python2, you don't have pybind11 (and vice-versa)
"
if echo "$testimport" | "$PYTHON_BIN" 1>/dev/null 2>/dev/null; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
pyver=$($PYTHON_BIN -c "import sysconfig;print(sysconfig.get_config_var('VERSION'))")
python_config=python${pyver}-config
PYBIND11_CFLAGS="$($PYTHON_BIN -m pybind11 --includes) -fvisibility=hidden"
PYTHON_CFLAGS=$(${python_config} --cflags --embed)
PYTHON_LDFLAGS=$(${python_config} --ldflags --embed)
#TODO: conda_fixup
PLUMED_CAN_PYCV=yes
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot enable pycv" >&5
$as_echo "$as_me: WARNING: cannot enable pycv" >&2;}
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot enable pycv" >&5
$as_echo "$as_me: WARNING: cannot enable pycv" >&2;}
fi
fi

if test $python = true ; then
# if PYTHON_BIN is defined, it is expected to be the full path to python
# Otherwise, search from a list of names:
if test -z "$PYTHON_BIN" ; then
if test -z "$PYTHON_BIN" ; then
for ac_prog in python
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
Expand Down Expand Up @@ -9053,14 +9020,43 @@ fi
test -n "$PYTHON_BIN" && break
done

fi
if test -n "$PYTHON_BIN"
then
fi
if test -n "$PYTHON_BIN" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Python executable is $PYTHON_BIN" >&5
$as_echo "$as_me: Python executable is $PYTHON_BIN" >&6;}
if test $pycv = true ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pycv: support for required python modules (python3, pybind11, numpy)" >&5
$as_echo_n "checking pycv: support for required python modules (python3, pybind11, numpy)... " >&6; }
testimport="
import numpy
import pybind11
#no need to check for python3, if you have python2, you don't have pybind11 (and vice-versa)
"
if echo "$testimport" | "$PYTHON_BIN" 1>/dev/null 2>/dev/null; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
pyver=$($PYTHON_BIN -c "import sysconfig;print(sysconfig.get_config_var('VERSION'))")
python_config=python${pyver}-config
PYBIND11_CFLAGS="$($PYTHON_BIN -m pybind11 --includes) -fvisibility=hidden"
PYTHON_CFLAGS=$(${python_config} --cflags --embed)
PYTHON_LDFLAGS=$(${python_config} --ldflags --embed)
#TODO: conda_fixup
PLUMED_CAN_PYCV=yes
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot enable pycv" >&5
$as_echo "$as_me: WARNING: cannot enable pycv" >&2;}
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot enable pycv" >&5
$as_echo "$as_me: WARNING: cannot enable pycv" >&2;}
fi

if test $python = true ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for required python modules (python3, setuptools, cython)" >&5
$as_echo_n "checking support for required python modules (python3, setuptools, cython)... " >&6; }
testimport="
testimport="
from setuptools import setup
from setuptools import Extension
from Cython.Build import cythonize
Expand All @@ -9073,19 +9069,24 @@ if sys.version_info < (3,):
$as_echo "yes" >&6; }
$as_echo "#define __PLUMED_HAS_PYTHON 1" >>confdefs.h

CYTHON_FOUND=yes
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot enable python interface" >&5
$as_echo "$as_me: WARNING: cannot enable python interface" >&2;}
PYTHON_BIN=
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot enable python interface" >&5
$as_echo "$as_me: WARNING: cannot enable python interface" >&2;}
fi
fi

if test "${PLUMED_CAN_PYCV}" != yes && test "${CYTHON_FOUND}" != yes; then
#this deactivate python bin if no package was found
PYTHON_BIN=
fi

if test "$af_ocl" = true ; then

found=ko
Expand Down
30 changes: 15 additions & 15 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -844,12 +844,16 @@ if test $fftw = true ; then
PLUMED_CHECK_PACKAGE([fftw3.h],[fftw_execute],[__PLUMED_HAS_FFTW],[fftw3])
fi

if test $pycv = true ; then
if test -n "$PYTHON_BIN"
then
# if PYTHON_BIN is defined, it is expected to be the full path to python
# Otherwise, search from a list of names:
if test -z "$PYTHON_BIN" ; then
AC_CHECK_PROGS([PYTHON_BIN],[python])
fi
if test -n "$PYTHON_BIN" ; then
AC_MSG_NOTICE([Python executable is $PYTHON_BIN])
if test $pycv = true ; then
AC_MSG_CHECKING([pycv: support for required python modules (python3, pybind11, numpy)])
testimport="
testimport="
import numpy
import pybind11
#no need to check for python3, if you have python2, you don't have pybind11 (and vice-versa)
Expand All @@ -870,19 +874,10 @@ import pybind11
else
AC_MSG_WARN([cannot enable pycv])
fi
fi

if test $python = true ; then
# if PYTHON_BIN is defined, it is expected to be the full path to python
# Otherwise, search from a list of names:
if test -z "$PYTHON_BIN" ; then
AC_CHECK_PROGS([PYTHON_BIN],[python])
fi
if test -n "$PYTHON_BIN"
then
AC_MSG_NOTICE([Python executable is $PYTHON_BIN])
if test $python = true ; then
AC_MSG_CHECKING([support for required python modules (python3, setuptools, cython)])
testimport="
testimport="
from setuptools import setup
from setuptools import Extension
from Cython.Build import cythonize
Expand All @@ -903,6 +898,11 @@ if sys.version_info < (3,):
fi
fi

if test "${PLUMED_CAN_PYCV}" != yes && test "${CYTHON_FOUND}" != yes; then
#this deactivate python bin if no package was found
PYTHON_BIN=
fi

if test "$af_ocl" = true ; then
PLUMED_CHECK_PACKAGE([arrayfire.h],[af_is_double],[__PLUMED_HAS_ARRAYFIRE],[afopencl])
PLUMED_CHECK_PACKAGE([arrayfire.h],[af_is_double],[__PLUMED_HAS_ARRAYFIRE_OCL],[afopencl])
Expand Down

0 comments on commit 16acc46

Please sign in to comment.