From 1c0406aed67e7284da9997ddd030d4981f609b98 Mon Sep 17 00:00:00 2001 From: James Page Date: Tue, 16 Feb 2016 18:43:05 +0000 Subject: [PATCH] pybind: Ensure correct python flags are passed Cython should use the cflags and ldflags provided by python-config; add checks, population and use of: PYTHON_CFLAGS PYTHON_LDFLAGS resolving linker failures on Ubuntu and Debian. Signed-off-by: James Page --- configure.ac | 8 ++++++++ src/pybind/Makefile.am | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 09d9f64231cc..265843b9ac61 100644 --- a/configure.ac +++ b/configure.ac @@ -213,6 +213,14 @@ if test x"$with_cython" = xyes; then if test x"$CYTHON_CHECK" != xyes; then AC_MSG_FAILURE([cython not found]) fi + AC_CHECK_PROG(PYTHON_CONFIG_CHECK, python-config, yes) + if test x"$PYTHON_CONFIG_CHECK" != xyes; then + AC_MSG_FAILURE([python-config not found]) + fi + PYTHON_CFLAGS=`python-config --cflags` + AC_SUBST(PYTHON_CFLAGS) + PYTHON_LDFLAGS=`python-config --ldflags` + AC_SUBST(PYTHON_LDFLAGS) fi # cond-check if snappy-devel is installed, needed by leveldb that is need by server parts of the project diff --git a/src/pybind/Makefile.am b/src/pybind/Makefile.am index fd23fcb52f48..f590138dfd2e 100644 --- a/src/pybind/Makefile.am +++ b/src/pybind/Makefile.am @@ -7,8 +7,8 @@ if WITH_CYTHON PY_DISTUTILS = \ CPPFLAGS="-iquote \${abs_srcdir}/include ${AM_CPPFLAGS} ${CPPFLAGS}" \ - CFLAGS="-iquote \${abs_srcdir}/include ${AM_CFLAGS} ${CFLAGS}" \ - LDFLAGS="-L\${abs_builddir}/.libs $(subst -pie,,${AM_LDFLAGS}) ${LDFLAGS}" \ + CFLAGS="-iquote \${abs_srcdir}/include ${AM_CFLAGS} ${PYTHON_CFLAGS}" \ + LDFLAGS="-L\${abs_builddir}/.libs $(subst -pie,,${AM_LDFLAGS}) ${PYTHON_LDFLAGS}" \ CYTHON_BUILD_DIR="$(shell readlink -f $(builddir))/build" \ ${PYTHON} ./setup.py -- 2.47.3