1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05: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
if test -n "$python_prefix" && test -d "$python_prefix/bin"; then
PYTHON_PATH="$python_prefix/bin:$PATH"
else
PYTHON_PATH="$PATH"
fi
AC_PATH_PROG(PYTHON, python, no, $PYTHON_PATH)
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" PYTHON_LIBS="-lpython"
PYTHON_CFLAGS="-I`python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()' 2> /dev/null`" fi
LIBS="$PYTHON_LIBS $LIBS" LIBS="$PYTHON_LIBS $LIBS"
CFLAGS="$PYTHON_CFLAGS $CFLAGS" CFLAGS="$PYTHON_CFLAGS $CFLAGS"
CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS" AC_TRY_LINK([#include <Python.h>],
AC_TRY_LINK([
#include <Python.h>
],
[Py_Initialize();], [Py_Initialize();],
cf_result=yes, cf_result=no) cf_result=yes, cf_result=no)
fi
if test "$cf_result" != "yes"; then if test "$cf_result" != "yes"; then
EL_RESTORE_FLAGS EL_RESTORE_FLAGS
else else
EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python]) EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
CFLAGS="$CFLAGS_X" CFLAGS="$CFLAGS_X"
AC_SUBST(PYTHON_LIBS) AC_SUBST(PYTHON_LIBS)
AC_SUBST(PYTHON_CFLAGS) AC_SUBST(PYTHON_CFLAGS)
fi
fi
fi fi
AC_MSG_CHECKING([for Python])
if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi