diff --git a/m4/ac_python_devel.m4 b/m4/ac_python_devel.m4 index a851233..da8dfc2 100644 --- a/m4/ac_python_devel.m4 +++ b/m4/ac_python_devel.m4 @@ -9,7 +9,7 @@ dnl dnl You can search for some particular version of Python by passing a dnl parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". dnl Please note that you *have* to pass also an operator along -dnl with the version match, and pay special attention to the +dnl with the version to match, and pay special attention to the dnl single quotes surrounding the version number. dnl dnl If the user wants to employ a particular version of Python, she can @@ -18,7 +18,8 @@ dnl This is only limited by the macro parameter set by the packager. dnl dnl This macro should work for all versions of Python >= 2.1.0. You can dnl disable the check for the python version by setting the -dnl PYTHON_NOVERSIONCHECK environment variable. +dnl PYTHON_NOVERSIONCHECK environment variable to something else +dnl than the empty string. dnl dnl If you need to use this macro for an older Python version, please dnl contact the authors. We're always open for feedback. @@ -112,10 +113,24 @@ variable to configure. See ``configure --help'' for reference. # AC_MSG_CHECKING([for Python library path]) if test -z "$PYTHON_LDFLAGS"; then + # (makes two attempts to ensure we've got a version number + # from the interpreter) + py_version=`$PYTHON -c "from distutils.sysconfig import *; \ + from string import join; \ + print join(get_config_vars('VERSION'))"` + if test "$py_version" == "[None]"; then + if test -n "$PYTHON_VERSION"; then + py_version=$PYTHON_VERSION + else + py_version=`$PYTHON -c "import sys; \ + print sys.version[[:3]]"` + fi + fi + PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \ from string import join; \ print '-L' + get_python_lib(0,1), \ - '-lpython' + join(get_config_vars('VERSION'));"` + '-lpython';"`$py_version fi AC_MSG_RESULT([$PYTHON_LDFLAGS]) AC_SUBST([PYTHON_LDFLAGS])