2013-11-04 08:16:52 +00:00
|
|
|
AC_ARG_WITH(python,
|
|
|
|
[ --with-python[=DIR] interface to R language],
|
|
|
|
if test "$withval" = yes; then
|
|
|
|
yap_cv_python=yes
|
|
|
|
elif test "$withval" = no; then
|
|
|
|
yap_cv_python=no
|
|
|
|
else
|
|
|
|
yap_cv_python=$withval
|
|
|
|
fi,
|
|
|
|
[yap_cv_python=no])
|
|
|
|
|
|
|
|
if test "$yap_cv_python" = "no"; then
|
|
|
|
PYTHON_TARGET="dummy"
|
2014-02-10 23:30:21 +00:00
|
|
|
PKG_PYTHON=""
|
2013-11-04 08:16:52 +00:00
|
|
|
elif test -e "$srcdir"/packages/python/Makefile.in ; then
|
|
|
|
PYTHON_TARGET="pitf"
|
2014-02-10 23:30:21 +00:00
|
|
|
PKG_PYTHON="packages/python"
|
2013-11-04 08:16:52 +00:00
|
|
|
if test "$yap_cv_python" = "yes"
|
|
|
|
then
|
|
|
|
AC_CHECK_PROGS(PYTHON, python, "none")
|
|
|
|
else
|
|
|
|
PYTHON="$yap_cv_python"
|
|
|
|
fi
|
2014-01-23 01:46:16 +00:00
|
|
|
if test $i_am_cross_compiling = yes
|
|
|
|
then
|
|
|
|
#mingw
|
|
|
|
PYTHON_DIR=`dirname "$PYTHON"`
|
|
|
|
PYTHON_DLL=`echo "$PYTHON_DIR"/python*.dll`
|
|
|
|
PYTHON_LIBS="\"$PYTHON_DLL\""
|
|
|
|
PYTHON_INCLUDES="-I \"$PYTHON_DIR\"/include"
|
|
|
|
else
|
2014-01-22 09:44:42 +00:00
|
|
|
PYTHONHOME=`$PYTHON -c'import sys; sys.stdout.write(sys.prefix)'`
|
|
|
|
PYTHONVERSION=`"$PYTHON" -c "import sys; sys.stdout.write(sys.version[[:3]])"`
|
2013-11-11 10:35:50 +00:00
|
|
|
if test -d "$PYTHONHOME/libs"; then
|
|
|
|
dnl windows
|
|
|
|
PYTHONV=`echo "$PYTHONVERSION"|sed -e 's/\.//g'`
|
2014-01-22 09:44:42 +00:00
|
|
|
PYTHON_LIBS="-L $PYTHONHOME/libs"
|
2013-11-11 10:35:50 +00:00
|
|
|
elif test -d "$PYTHONHOME/lib"; then
|
2014-01-22 09:44:42 +00:00
|
|
|
PYTHON_LIBS="-L $PYTHONHOME/lib"
|
2013-11-11 10:35:50 +00:00
|
|
|
else
|
2014-01-22 09:44:42 +00:00
|
|
|
echo "Could not find libraries for Python"
|
2014-02-10 23:30:21 +00:00
|
|
|
PKG_PYTHON=""
|
2013-11-11 10:35:50 +00:00
|
|
|
fi
|
2014-01-22 09:44:42 +00:00
|
|
|
OLIBS=$LIBS
|
|
|
|
LIBS=$PYTHON_LIBS
|
|
|
|
AC_SEARCH_LIBS(Py_Initialize, [python"$PYTHONVERSION" python"$PYTHONVERSION"m],,[echo "Could not find libraries for Python";
|
|
|
|
ENABLE_PYTHON="@# "],"$OLIBS")
|
|
|
|
PYTHON_LIBS=$LIBS
|
|
|
|
LIBS=$OLIBS
|
2013-11-11 10:35:50 +00:00
|
|
|
if test -d "$PYTHONHOME/include/python$PYTHONVERSION"; then
|
|
|
|
PYTHON_INCLUDES="-I $PYTHONHOME/include/python$PYTHONVERSION"
|
2014-01-22 09:44:42 +00:00
|
|
|
elif test -d "$PYTHONHOME/include/python$PYTHONVERSION"m; then
|
|
|
|
PYTHON_INCLUDES="-I $PYTHONHOME/include/python$PYTHONVERSION"m
|
2013-11-11 10:35:50 +00:00
|
|
|
elif test -d "$PYTHONHOME/include"; then
|
|
|
|
PYTHON_INCLUDES="-I $PYTHONHOME/include"
|
|
|
|
else
|
|
|
|
echo "Could not find includes for Python"
|
2014-02-10 23:30:21 +00:00
|
|
|
PKG_PYTHON=""
|
2013-11-11 10:35:50 +00:00
|
|
|
fi
|
2014-01-23 01:46:16 +00:00
|
|
|
fi
|
2013-11-04 08:16:52 +00:00
|
|
|
else
|
|
|
|
PYTHON_TARGET="dummy"
|
2014-02-10 23:30:21 +00:00
|
|
|
PKG_PYTHON=""
|
2013-11-04 08:16:52 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(PYTHON_TARGET)
|
2014-02-10 23:30:21 +00:00
|
|
|
AC_SUBST(PKG_PYTHON)
|
2013-11-04 08:16:52 +00:00
|
|
|
AC_SUBST(PYTHON_INCLUDES)
|
|
|
|
AC_SUBST(PYTHON_LIBS)
|
|
|
|
|
2014-02-10 23:30:21 +00:00
|
|
|
if test "$PKG_PYTHON" != ""; then
|
2013-11-04 08:16:52 +00:00
|
|
|
AC_CONFIG_FILES([ packages/python/Makefile ])
|
|
|
|
fi
|
|
|
|
|