From 091df02f920b5f5a658962d3add6f965d84375ac Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Mon, 21 Sep 2009 16:33:03 -0400 Subject: Make configure script compatible with older python versions Older python versions (such as that used in RHEL5) do not have a python-config executable to report CFLAGS and LIBS. In order to support such versions of python, we will duplicate the logic that python-config would have performed directly in our configure script --- server/external/python.m4 | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'server') diff --git a/server/external/python.m4 b/server/external/python.m4 index 37eeac24f..db5986385 100644 --- a/server/external/python.m4 +++ b/server/external/python.m4 @@ -1,17 +1,26 @@ dnl Check for python-config and substitute needed CFLAGS and LDFLAGS dnl Usage: dnl AM_PYTHON_CONFIG + AC_DEFUN([AM_PYTHON_CONFIG], [ AC_SUBST(PYTHON_CFLAGS) AC_SUBST(PYTHON_LIBS) - AC_PATH_PROG(PYTHON_CONFIG, python-config) - AC_MSG_CHECKING(for working python-config) - if test -x "$PYTHON_CONFIG"; then - PYTHON_CFLAGS="`$PYTHON_CONFIG --includes`" - PYTHON_CFLAGS=$PYTHON_CFLAGS" -fno-strict-aliasing" - PYTHON_LIBS="`$PYTHON_CONFIG --libs`" - AC_MSG_RESULT([yes]) +dnl We need to check for python build flags using distutils.sysconfig +dnl We cannot use python-config, as it was not available on older +dnl versions of python + AC_PATH_PROG(PYTHON, python) + AC_MSG_CHECKING([for working python]) + if test -x "$PYTHON"; then + PYTHON_CFLAGS="`$PYTHON -c \"from distutils import sysconfig; \ + print '-I' + sysconfig.get_python_inc() + \ + ' -I' + sysconfig.get_python_inc(plat_specific=True) + ' ' + \ + sysconfig.get_config_var('BASECFLAGS')\"`" + PYTHON_LIBS="`$PYTHON -c \"from distutils import sysconfig; \ + print \\\" \\\".join(sysconfig.get_config_var('LIBS').split() + \ + sysconfig.get_config_var('SYSLIBS').split()) + \ + ' -lpython' + sysconfig.get_config_var('VERSION')\"`" + AC_MSG_RESULT([yes]) else AC_MSG_ERROR([no. Please install python devel package]) fi -- cgit