- Update macro with changes from Alan W. Irwin. Thanks, Alan!

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@579 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-05-14 14:33:01 +00:00
parent 88831f468a
commit 4ca52deb1b
1 changed files with 22 additions and 16 deletions

View File

@ -1,25 +1,26 @@
dnl @synopsis AC_PYTHON_DEVEL([version]) dnl @synopsis AC_PYTHON_DEVEL([version])
dnl dnl
dnl Checks for Python and tries to get the include path to 'Python.h'. dnl Note: Defines as a precious variable "PYTHON_VERSION". Don't
dnl It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) output dnl override it in your configure.ac.
dnl variables. dnl
dnl Also exports $(PYTHON_EXTRA_LIBS) and $(PYTHON_EXTRA_LDFLAGS) dnl This macro checks for Python and tries to get the include path to
dnl 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS)
dnl output variables.
dnl It also exports $(PYTHON_EXTRA_LIBS) and $(PYTHON_EXTRA_LDFLAGS)
dnl for embedding Python in your code. dnl for embedding Python in your code.
dnl dnl
dnl You can search for some particular version of Python by passing a 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 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 Please note that you *have* to pass also an operator along
dnl with the version to 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 single quotes surrounding the version number.
dnl Don't use "PYTHON_VERSION" for this: that environment variable is
dnl declared as precious and thus reserved for the end-user.
dnl dnl
dnl If the user wants to employ a particular version of Python, she can dnl This macro should work for all versions of Python >= 2.1.0. As
dnl now pass to configure the PYTHON_VERSION environment variable. dnl an end user, you can disable the check for the python version
dnl This is only limited by the macro parameter set by the packager. dnl by setting the PYTHON_NOVERSIONCHECK environment variable
dnl dnl to something else than the empty string.
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 to something else
dnl than the empty string.
dnl dnl
dnl If you need to use this macro for an older Python version, please dnl If you need to use this macro for an older Python version, please
dnl contact the authors. We're always open for feedback. dnl contact the authors. We're always open for feedback.
@ -46,6 +47,7 @@ AC_DEFUN([AC_PYTHON_DEVEL],[
AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]]) AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
if test -z "$PYTHON"; then if test -z "$PYTHON"; then
AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path]) AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path])
PYTHON_VERSION=""
fi fi
# #
@ -66,7 +68,7 @@ variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,
PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
Moreover, to disable this check, set PYTHON_NOVERSIONCHECK Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
to something else than an empty string. to something else than an empty string.
])dnl ])
else else
AC_MSG_RESULT([skip at user request]) AC_MSG_RESULT([skip at user request])
fi fi
@ -90,7 +92,8 @@ to something else than an empty string.
If you have it installed, but it isn't the default Python If you have it installed, but it isn't the default Python
interpreter in your system path, please pass the PYTHON_VERSION interpreter in your system path, please pass the PYTHON_VERSION
variable to configure. See ``configure --help'' for reference. variable to configure. See ``configure --help'' for reference.
])dnl ])
PYTHON_VERSION=""
fi fi
fi fi
@ -106,6 +109,7 @@ variable to configure. See ``configure --help'' for reference.
AC_MSG_ERROR([cannot import Python module "distutils". AC_MSG_ERROR([cannot import Python module "distutils".
Please check your Python installation. The error was: Please check your Python installation. The error was:
$ac_distutils_result]) $ac_distutils_result])
PYTHON_VERSION=""
fi fi
# #
@ -188,7 +192,7 @@ $ac_distutils_result])
# #
# final check to see if everything compiles alright # final check to see if everything compiles alright
# #
AC_MSG_CHECKING([whether collected informations are consistent]) AC_MSG_CHECKING([consistency of all components of python development environment])
AC_LANG_PUSH([C]) AC_LANG_PUSH([C])
# save current global flags # save current global flags
LIBS="$ac_save_LIBS $PYTHON_LDFLAGS" LIBS="$ac_save_LIBS $PYTHON_LDFLAGS"
@ -206,12 +210,14 @@ $ac_distutils_result])
Could not link test program to Python. Maybe the main Python library has been Could not link test program to Python. Maybe the main Python library has been
installed in some non-standard library path. If so, pass it to configure, installed in some non-standard library path. If so, pass it to configure,
via the LDFLAGS environment variable. via the LDFLAGS environment variable.
Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
============================================================================ ============================================================================
ERROR! ERROR!
You probably have to install the development version of the Python package You probably have to install the development version of the Python package
for your distribution. The exact name of this package varies among them. for your distribution. The exact name of this package varies among them.
============================================================================ ============================================================================
]) ])
PYTHON_VERSION=""
fi fi
AC_LANG_POP AC_LANG_POP
# turn back to default flags # turn back to default flags