Simplify Python detection.

This commit is contained in:
Eric S. Raymond 2008-01-10 14:29:58 +00:00
parent 6ddf569495
commit c18114a09c

View file

@ -412,50 +412,44 @@ if test "x$python" = "xyes"; then
PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
AC_MSG_RESULT([$PYTHON, $PYTHON_VERSION, $PYTHON_PREFIX])
PYTHON_CFLAGS="-DHAVE_PYTHON -I$PYTHON_PREFIX/include/python$PYTHON_VERSION"
OLD_CPPFLAGS="$CPPFLAGS"
OLD_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
CXXFLAGS="$CXXFLAGS $PYTHON_CFLAGS"
AC_CHECK_HEADER([Python.h],
[],
[AC_MSG_WARN([*** Python include files not found! You should install Python development package. Python support disabled]); pythonfound=no])
CPPFLAGS="$OLD_CPPFLAGS"
CXXFLAGS="$OLD_CXXFLAGS"
if test "x$pythonfound" = "xyes"; then
AC_MSG_RESULT(yes)
AC_SUBST([PYTHON_CFLAGS])
PYTHON_CFLAGS="-DHAVE_PYTHON -I$PYTHON_PREFIX/include/python$PYTHON_VERSION"
pythonfound=no
for pylibpath in '/usr/lib' $PYTHON_PREFIX/lib $PYTHON_PREFIX/lib/python$PYTHON_VERSION/config; do
eval `echo unset ac_cv_lib_python$PYTHON_VERSION'___'Py_Finalize | tr '.' '_'`
OLD_CPPFLAGS="$CPPFLAGS"
OLD_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
CXXFLAGS="$CXXFLAGS $PYTHON_CFLAGS"
AC_CHECK_HEADER([Python.h],
[],
[AC_MSG_WARN([*** Python include files not found! You should install Python development package. Python support disabled]); pythonfound=no])
CPPFLAGS="$OLD_CPPFLAGS"
CXXFLAGS="$OLD_CXXFLAGS"
if test "x$pythonfound" = "xyes"; then
AC_SUBST([PYTHON_CFLAGS])
pythonfound=no
for pylibpath in '/usr/lib' $PYTHON_PREFIX/lib $PYTHON_PREFIX/lib/python$PYTHON_VERSION/config; do
eval `echo unset ac_cv_lib_python$PYTHON_VERSION'___'Py_Finalize | tr '.' '_'`
save_LIBS=$LIBS
LIBS="$LIBS -L$pylibpath"
AC_CHECK_LIB(python$PYTHON_VERSION, Py_Finalize, PYTHON_LIBS="-L$pylibpath -lpython$PYTHON_VERSION $PYTHON_DEPS"; pythonfound=yes,,$PYTHON_DEPS)
LIBS=$save_LIBS
if test "x$pythonfound" = "xyes"; then
break
fi
done
if test "x$pythonfound" != "xyes"; then
AC_MSG_WARN(*** Python development libraries required, Python support disabled)
save_LIBS=$LIBS
LIBS="$LIBS -L$pylibpath"
AC_CHECK_LIB(python$PYTHON_VERSION, Py_Finalize, PYTHON_LIBS="-L$pylibpath -lpython$PYTHON_VERSION $PYTHON_DEPS"; pythonfound=yes,,$PYTHON_DEPS)
LIBS=$save_LIBS
if test "x$pythonfound" = "xyes"; then
break
fi
AC_SUBST([PYTHON_LIBS])
done
AC_SUBST(pkgpythondir)
if test "x$python_install" = "xyes"; then
pkgpythondir=$PYTHON_PREFIX"/lib/python"$PYTHON_VERSION"/site-packages/wesnoth"
fi
if test "x$pythonfound" != "xyes"; then
AC_MSG_WARN(*** Python development libraries required, Python support disabled)
fi
AC_SUBST([PYTHON_LIBS])
AC_SUBST(pkgpythondir)
if test "x$python_install" = "xyes"; then
pkgpythondir=$PYTHON_PREFIX"/lib/python"$PYTHON_VERSION"/site-packages/wesnoth"
fi
fi
fi