1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-27 02:56:18 -04:00

Check for python

This commit is contained in:
2006-01-29 16:48:33 +01:00
parent 87e27b9b3e
commit 5c607c1ce8

View File

@ -740,13 +740,17 @@ dnl Check for Python
dnl =================================================================== dnl ===================================================================
enable_python="no"; enable_python="no";
AC_ARG_WITH(python, [ --with-python enable Python support], AC_ARG_WITH(python, [ --with-python=[prefix] enable Python support],
[ [
if test "$withval" = yes; then if test "$withval" != no; then
# FIXME: If withval is a valid directory append it to PATH # FIXME: If withval is a valid directory append it to PATH
# so that you can specify one of several Python installations. # so that you can specify one of several Python installations.
withval=""; if test "$withval" != yes; then
enable_python=yes; python_prefix="$withval"
else
python_prefix=""
fi
enable_python=yes
cat <<EOF cat <<EOF
*********************************************************************** ***********************************************************************
The Python support is incomplete and not so well integrated to ELinks The Python support is incomplete and not so well integrated to ELinks
@ -758,35 +762,46 @@ EOF
fi fi
]) ])
AC_MSG_CHECKING([for Python])
cf_result=no cf_result=no
EL_SAVE_FLAGS EL_SAVE_FLAGS
if test "$enable_python" = "yes"; then if test "$enable_python" = "yes"; then
PYTHON_LIBS="-lpython" if test -n "$python_prefix" && test -d "$python_prefix/bin"; then
PYTHON_CFLAGS="-I`python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()' 2> /dev/null`" PYTHON_PATH="$python_prefix/bin:$PATH"
LIBS="$PYTHON_LIBS $LIBS" else
CFLAGS="$PYTHON_CFLAGS $CFLAGS" PYTHON_PATH="$PATH"
CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS" fi
AC_TRY_LINK([ AC_PATH_PROG(PYTHON, python, no, $PYTHON_PATH)
#include <Python.h> if test "$PYTHON" = "no" ; then
], cf_result=no
else
PYTHON_CFLAGS="-I`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_python_inc()' 2> /dev/null`"
if test -n "$python_prefix" && test -d "$python_prefix/lib"; then
PYTHON_LIBS="-L$python_prefix/lib -lpython"
else
PYTHON_LIBS="-lpython"
fi
LIBS="$PYTHON_LIBS $LIBS"
CFLAGS="$PYTHON_CFLAGS $CFLAGS"
AC_TRY_LINK([#include <Python.h>],
[Py_Initialize();], [Py_Initialize();],
cf_result=yes, cf_result=no) cf_result=yes, cf_result=no)
if test "$cf_result" != "yes"; then
EL_RESTORE_FLAGS
else
EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
CFLAGS="$CFLAGS_X"
AC_SUBST(PYTHON_LIBS)
AC_SUBST(PYTHON_CFLAGS)
fi
fi
fi fi
if test "$cf_result" != "yes"; then AC_MSG_CHECKING([for Python])
EL_RESTORE_FLAGS
else
EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
CFLAGS="$CFLAGS_X"
AC_SUBST(PYTHON_LIBS)
AC_SUBST(PYTHON_CFLAGS)
fi
if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi