Skip to content

Commit

Permalink
now configure understands if python is embeddable
Browse files Browse the repository at this point in the history
  • Loading branch information
Iximiel committed Dec 13, 2023
1 parent 16acc46 commit 852321f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
25 changes: 18 additions & 7 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -9033,15 +9033,26 @@ 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

if ${python_config} --ldflags --embed 1>/dev/null 2>/dev/null ;then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
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;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"PyCV needs python to be embeddable, please rebuild python\"" >&5
$as_echo "$as_me: WARNING: \"PyCV needs python to be embeddable, please rebuild python\"" >&2;}
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
Expand Down
20 changes: 14 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -859,14 +859,22 @@ 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
AC_MSG_RESULT([yes])

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

if ${python_config} --ldflags --embed 1>/dev/null 2>/dev/null ;then
AC_MSG_RESULT([yes])
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
AC_MSG_RESULT([no])
AC_MSG_WARN([cannot enable pycv])
AC_MSG_WARN(["PyCV needs python to be embeddable, please rebuild python"])
fi
else
AC_MSG_RESULT([no])
AC_MSG_WARN([cannot enable pycv])
Expand Down

0 comments on commit 852321f

Please sign in to comment.