From 8768cd09e5fa7500be3ec02d6e7149b256d4b572 Mon Sep 17 00:00:00 2001 From: ellson Date: Sun, 27 Mar 2005 23:43:46 +0000 Subject: [PATCH] add python version check --- configure.ac | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 045142a22..f346ffcbe 100644 --- a/configure.ac +++ b/configure.ac @@ -352,13 +352,27 @@ dnl ----------------------------------- dnl INCLUDES and LIBS for PYTHON AC_CHECK_PROG(PYTHON,python,python) -AM_CONDITIONAL(WITH_PYTHON, [test "x$PYTHON" != "x"]) -if test "x$PYTHON" = "x"; then - HAVE_PYTHON=0 -else - HAVE_PYTHON=1 - PYTHON_INCLUDES=-I/usr/include/python2.4 - PYTHON_LIBS=-lpython2.4 +HAVE_PYTHON=1 +if test "x$PYTHON" != "x"; then + PYTHON_VERSION=`swig -version 2>&1 | grep Version | cut -d ' ' -f 3` + PYTHON_VERSION_MAJOR=`echo $PYTHON_VERSION | cut -d '.' -f 1` + PYTHON_VERSION_MINOR=`echo $PYTHON_VERSION | cut -d '.' -f 2` + if test $PYTHON_VERSION_MAJOR -lt 3; then + if test $PYTHON_VERSION_MAJOR -lt 2; then + HAVE_PYTHON=0 + else + if test $PYTHON_VERSION_MINOR -lt 4; then + HAVE_PYTHON=0 + fi + fi + fi +fi +AC_SUBST(PYTHON_VERSION) +AC_SUBST(HAVE_PYTHON) +AM_CONDITIONAL(WITH_PYTHON, [test "x$HAVE_PYTHON" = "x1"]) +if test "x$HAVE_PYTHON" = "x1"; then + PYTHON_INCLUDES=-I/usr/include/python$PYTHON_VERSION + PYTHON_LIBS=-lpython$PYTHON_VERSION fi AC_SUBST(HAVE_PYTHON) AC_SUBST(PYTHON_INCLUDES) -- 2.40.0