From a2b1b01045f908815090904239f24eb696d9dbd2 Mon Sep 17 00:00:00 2001 From: Mark Asselstine Date: Thu, 5 Jan 2017 16:51:02 -0500 Subject: [PATCH] configure.ac: allow PYTHON values to be passed via env This allows the recipe to specify specific values instead of them being 'discovered' which may lead to host contamination or similar issues. Updated for 4.9.0: Jeremy Puhlman Signed-off-by: Mark Asselstine ---- configure.ac | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/configure.ac b/configure.ac index 37a0f86..9b77c7f 100644 --- a/configure.ac +++ b/configure.ac @@ -106,26 +106,38 @@ fi AC_SUBST(PYTHON) +if test -z "${PYTHON_VERSION}"; then PYTHON_VERSION=`${PYTHON} -c 'from sys import stdout; \ import sysconfig; \ stdout.write(sysconfig.get_config_var("VERSION"))'` +fi +if test -z "${PYTHON_LDVERSION}"; then PYTHON_LDVERSION=`${PYTHON} -c 'from sys import stdout; \ import sysconfig; \ stdout.write(sysconfig.get_config_var("LDVERSION") or "")'` +fi if test x"${PYTHON_LDVERSION}" = x""; then PYTHON_LDVERSION=${PYTHON_VERSION} fi +if test -z "${PYTHON_INCLUDEPY}"; then CPPFLAGS1=`${PYTHON} -c 'from sys import stdout; \ import sysconfig; \ stdout.write("-I" + sysconfig.get_config_var("INCLUDEPY"))'` +else +CPPFLAGS1="${PYTHON_INCLUDEPY}" +fi +if test -z "${PYTHON_CFLAGS}"; then CPPFLAGS2=`${PYTHON} -c 'from sys import stdout; \ import sysconfig; \ stdout.write(" ".join(filter(lambda x: x.startswith("-D"), \ sysconfig.get_config_var("CFLAGS").split())))'` +else +CPPFLAGS2="${PYTHON_CFLAGS}" +fi if test "${ENABLE_EMBEDDED}" != "yes"; then CPPFLAGS3="-DMOD_WSGI_DISABLE_EMBEDDED" @@ -137,22 +149,42 @@ CPPFLAGS="${CPPFLAGS} ${CPPFLAGS1} ${CPPFLAGS2} ${CPPFLAGS3}" AC_SUBST(CPPFLAGS) +if test -z "${PYTHON_LIBDIR}"; then PYTHONLIBDIR=`${PYTHON} -c 'from sys import stdout; \ import sysconfig; \ stdout.write(sysconfig.get_config_var("LIBDIR"))'` +else +PYTHONLIBDIR="${PYTHON_LIBDIR}" +fi +if test -z "${PYTHON_CFGDIR}"; then PYTHONCFGDIR=`${PYTHON} -c 'from sys import stdout; \ import distutils.sysconfig; \ stdout.write(distutils.sysconfig.get_python_lib(plat_specific=1, \ standard_lib=1) +"/config")'` +else +PYTHONCFGDIR="${PYTHON_CFGDIR}" +fi +if test -z "${PYTHON_FRAMEWORKDIR}"; then PYTHONFRAMEWORKDIR=`${PYTHON} -c 'from sys import stdout; \ import sysconfig; \ stdout.write(sysconfig.get_config_var("PYTHONFRAMEWORKDIR"))'` +else +PYTHONFRAMEWORKDIR="${PYTHON_FRAMEWORKDIR}" +fi +if test -z "${PYTHON_FRAMEWORKPREFIX}"; then PYTHONFRAMEWORKPREFIX=`${PYTHON} -c 'from sys import stdout; \ import sysconfig; \ stdout.write(sysconfig.get_config_var("PYTHONFRAMEWORKPREFIX"))'` +else +PYTHONFRAMEWORKPREFIX="${PYTHON_FRAMEWORKPREFIX}" +fi +if test -z "${PYTHON_FRAMEWORK}"; then PYTHONFRAMEWORK=`${PYTHON} -c 'from sys import stdout; \ import sysconfig; \ stdout.write(sysconfig.get_config_var("PYTHONFRAMEWORK"))'` +else +PYTHONFRAMEWORK="${PYTHON_FRAMEWORK}" +fi if test "${PYTHON_LDVERSION}" != "${PYTHON_VERSION}"; then PYTHONCFGDIR="${PYTHONCFGDIR}-${PYTHON_LDVERSION}" @@ -180,12 +212,20 @@ if test "${PYTHONFRAMEWORKDIR}" = "no-framework" -o \ LDLIBS1="-lpython${PYTHON_VERSION}" fi + if test -z "${PYTHON_LIBS}"; then LDLIBS2=`${PYTHON} -c 'from sys import stdout; \ import sysconfig; \ stdout.write(sysconfig.get_config_var("LIBS"))'` + else + LDLIBS2="${PYTHON_LIBS}" + fi + if test -z "${PYTHON_SYSLIBS}"; then LDLIBS3=`${PYTHON} -c 'from sys import stdout; \ import sysconfig; \ stdout.write(sysconfig.get_config_var("SYSLIBS"))'` + else + LDLIBS3="${PYTHON_SYSLIBS}" + fi else LDFLAGS1="-Wl,-F${PYTHONFRAMEWORKPREFIX} -framework ${PYTHONFRAMEWORK}"