Update macro to allow linking to libpython.so if libpython#.#.so doesn't exist

FIXME: order of printing nested check messages in macro is sub-optimal


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1323 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2007-10-04 13:59:19 +00:00
parent 989f9a27ef
commit 82f97ffce9
1 changed files with 31 additions and 7 deletions

View File

@ -148,8 +148,34 @@ $ac_distutils_result])
PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \
from string import join; \
print '-L' + get_python_lib(0,1), \
'-lpython';"`$py_version
print '-L' + get_python_lib(0,1);"`
# We could have a versioned library, or an unversioned one,
# even if the second case is discouraged. So, let's check for
# the versioned one first, and fallback on the second later.
LIBS="$ac_save_LIBS $PYTHON_LDFLAGS"
CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
AC_LANG_PUSH([C])
AC_CHECK_LIB([python$py_version], [Py_Initialize],
[PYTHON_LDFLAGS="$PYTHON_LDFLAGS -lpython$py_version"],
AC_CHECK_LIB([python], [Py_Initialize],
[PYTHON_LDFLAGS="$PYTHON_LDFLAGS -lpython"],
[PYTHON_LDFLAGS=""])
)
AC_LANG_POP
if test -z "$PYTHON_LDFLAGS"; then
AC_MSG_ERROR([
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,
via the LDFLAGS environment variable.
Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
])
fi
CPPFLAGS="$ac_save_CPPFLAGS"
LIBS="$ac_save_LIBS"
fi
AC_MSG_RESULT([$PYTHON_LDFLAGS])
AC_SUBST([PYTHON_LDFLAGS])
@ -205,16 +231,14 @@ $ac_distutils_result])
AC_MSG_RESULT([$pythonexists])
if test ! "$pythonexists" = "yes"; then
if test ! "$pythonexists" = "yes"; then
AC_MSG_ERROR([
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,
via the LDFLAGS environment variable.
Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
============================================================================
ERROR!
You probably have to install the development version of the Python package
for your distribution. The exact name of this package varies among them.
Take also a look to config.log. If everything looks all right, please
report the problem to the macro maintainer.
============================================================================
])
PYTHON_VERSION=""