Merging to remove bad branch
This commit is contained in:
parent
0f4ceaa200
commit
7d2cac9ea4
@ -19,7 +19,7 @@ DIR_LIST=${DEP} ${AUTO} ${EXE} ${OBJ} ${LIB} ${DEP}/auto ${OBJ}/auto
|
||||
|
||||
EXE_LIST=${EXE}/telegram-cli
|
||||
|
||||
TG_OBJECTS=${OBJ}/main.o ${OBJ}/loop.o ${OBJ}/interface.o ${OBJ}/lua-tg.o
|
||||
TG_OBJECTS=${OBJ}/main.o ${OBJ}/loop.o ${OBJ}/interface.o ${OBJ}/lua-tg.o ${OBJ}/python-tg.o
|
||||
|
||||
INCLUDE=-I. -I${srcdir}
|
||||
CC=@CC@
|
||||
|
@ -158,6 +158,9 @@
|
||||
/* use lua */
|
||||
#undef USE_LUA
|
||||
|
||||
/* use python */
|
||||
#undef USE_PYTHON
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef gid_t
|
||||
|
||||
|
515
configure
vendored
515
configure
vendored
@ -622,6 +622,20 @@ ac_includes_default="\
|
||||
ac_subst_vars='LTLIBOBJS
|
||||
EXTRA_LIBS
|
||||
LIBOBJS
|
||||
PYTHON_CFLAGS
|
||||
PYTHON_LIBS
|
||||
pkgpyexecdir
|
||||
pyexecdir
|
||||
pkgpythondir
|
||||
pythondir
|
||||
PYTHON_PLATFORM
|
||||
PYTHON_EXEC_PREFIX
|
||||
PYTHON_PREFIX
|
||||
PYTHON_VERSION
|
||||
PYTHON
|
||||
PYTHON_LIB
|
||||
PYTHON_INCLUDE_DIR
|
||||
PYTHON_BIN
|
||||
LUA_LIB
|
||||
LUA_INCLUDE
|
||||
pkgluaexecdir
|
||||
@ -694,6 +708,7 @@ with_zlib
|
||||
enable_libconfig
|
||||
enable_extf
|
||||
enable_liblua
|
||||
enable_python
|
||||
with_progname
|
||||
'
|
||||
ac_precious_vars='build_alias
|
||||
@ -707,7 +722,8 @@ CPPFLAGS
|
||||
CPP
|
||||
LUA
|
||||
LUA_INCLUDE
|
||||
LUA_LIB'
|
||||
LUA_LIB
|
||||
PYTHON'
|
||||
|
||||
|
||||
# Initialize some variables set by options.
|
||||
@ -1320,6 +1336,7 @@ Optional Features:
|
||||
--enable-libconfig/--disable-libconfig
|
||||
--enable-extf/--disable-extf
|
||||
--enable-liblua/--disable-liblua
|
||||
--enable-python/--disable-python
|
||||
|
||||
Optional Packages:
|
||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
@ -1342,6 +1359,7 @@ Some influential environment variables:
|
||||
LUA The Lua interpreter, e.g. /usr/bin/lua5.1
|
||||
LUA_INCLUDE The Lua includes, e.g. -I/usr/include/lua5.1
|
||||
LUA_LIB The Lua library, e.g. -llua5.1
|
||||
PYTHON the Python interpreter
|
||||
|
||||
Use these variables to override the choices made by `configure' or to help
|
||||
it to find libraries and programs with nonstandard names/locations.
|
||||
@ -2389,6 +2407,62 @@ ac_config_headers="$ac_config_headers config.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_python.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_PYTHON
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro does a complete Python development environment check.
|
||||
#
|
||||
# It recurses through several python versions (from 2.1 to 2.6 in this
|
||||
# version), looking for an executable. When it finds an executable, it
|
||||
# looks to find the header files and library.
|
||||
#
|
||||
# It sets PYTHON_BIN to the name of the python executable,
|
||||
# PYTHON_INCLUDE_DIR to the directory holding the header files, and
|
||||
# PYTHON_LIB to the name of the Python library.
|
||||
#
|
||||
# This macro calls AC_SUBST on PYTHON_BIN (via AC_CHECK_PROG),
|
||||
# PYTHON_INCLUDE_DIR and PYTHON_LIB.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Michael Tindal
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation; either version 2 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 14
|
||||
|
||||
|
||||
# ===========================================================================
|
||||
@ -5860,6 +5934,445 @@ $as_echo "#define USE_LUA 1" >>confdefs.h
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
|
||||
# Check whether --enable-python was given.
|
||||
if test "${enable_python+set}" = set; then :
|
||||
enableval=$enable_python;
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python build information" >&5
|
||||
$as_echo_n "checking for python build information... " >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
|
||||
$as_echo "" >&6; }
|
||||
for python in python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python; do
|
||||
for ac_prog in $python
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_prog_PYTHON_BIN+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test -n "$PYTHON_BIN"; then
|
||||
ac_cv_prog_PYTHON_BIN="$PYTHON_BIN" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_PYTHON_BIN="$ac_prog"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
fi
|
||||
fi
|
||||
PYTHON_BIN=$ac_cv_prog_PYTHON_BIN
|
||||
if test -n "$PYTHON_BIN"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_BIN" >&5
|
||||
$as_echo "$PYTHON_BIN" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
test -n "$PYTHON_BIN" && break
|
||||
done
|
||||
|
||||
ax_python_bin=$PYTHON_BIN
|
||||
if test x$ax_python_bin != x; then
|
||||
as_ac_Lib=`$as_echo "ac_cv_lib_$ax_python_bin''_main" | $as_tr_sh`
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -l$ax_python_bin" >&5
|
||||
$as_echo_n "checking for main in -l$ax_python_bin... " >&6; }
|
||||
if eval \${$as_ac_Lib+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-l$ax_python_bin $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return main ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
eval "$as_ac_Lib=yes"
|
||||
else
|
||||
eval "$as_ac_Lib=no"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
eval ac_res=\$$as_ac_Lib
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
|
||||
ax_python_lib=$ax_python_bin
|
||||
else
|
||||
ax_python_lib=no
|
||||
fi
|
||||
|
||||
if test x$ax_python_lib == xno; then
|
||||
as_ac_Lib=`$as_echo "ac_cv_lib_${ax_python_bin}m''_main" | $as_tr_sh`
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -l${ax_python_bin}m" >&5
|
||||
$as_echo_n "checking for main in -l${ax_python_bin}m... " >&6; }
|
||||
if eval \${$as_ac_Lib+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-l${ax_python_bin}m $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return main ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
eval "$as_ac_Lib=yes"
|
||||
else
|
||||
eval "$as_ac_Lib=no"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
eval ac_res=\$$as_ac_Lib
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
|
||||
ax_python_lib=${ax_python_bin}m
|
||||
else
|
||||
ax_python_lib=no
|
||||
fi
|
||||
|
||||
fi
|
||||
if test x$ax_python_lib != xno; then
|
||||
ax_python_header=`$ax_python_bin -c "from distutils.sysconfig import *; print(get_config_var('CONFINCLUDEPY'))"`
|
||||
if test x$ax_python_header != x; then
|
||||
break;
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if test x$ax_python_bin = x; then
|
||||
ax_python_bin=no
|
||||
fi
|
||||
if test x$ax_python_header = x; then
|
||||
ax_python_header=no
|
||||
fi
|
||||
if test x$ax_python_lib = x; then
|
||||
ax_python_lib=no
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: results of the Python check:" >&5
|
||||
$as_echo " results of the Python check:" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Binary: $ax_python_bin" >&5
|
||||
$as_echo " Binary: $ax_python_bin" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Library: $ax_python_lib" >&5
|
||||
$as_echo " Library: $ax_python_lib" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Include Dir: $ax_python_header" >&5
|
||||
$as_echo " Include Dir: $ax_python_header" >&6; }
|
||||
|
||||
if test x$ax_python_header != xno; then
|
||||
PYTHON_INCLUDE_DIR=$ax_python_header
|
||||
|
||||
fi
|
||||
if test x$ax_python_lib != xno; then
|
||||
PYTHON_LIB=$ax_python_lib
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if test -n "$PYTHON"; then
|
||||
# If the user set $PYTHON, use it and don't search something else.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version is >= 2.7.0" >&5
|
||||
$as_echo_n "checking whether $PYTHON version is >= 2.7.0... " >&6; }
|
||||
prog="import sys
|
||||
# split strings by '.' and convert to numeric. Append some zeros
|
||||
# because we need at least 4 digits for the hex conversion.
|
||||
# map returns an iterator in Python 3.0 and a list in 2.x
|
||||
minver = list(map(int, '2.7.0'.split('.'))) + [0, 0, 0]
|
||||
minverhex = 0
|
||||
# xrange is not present in Python 3.0 and range returns an iterator
|
||||
for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i]
|
||||
sys.exit(sys.hexversion < minverhex)"
|
||||
if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5
|
||||
($PYTHON -c "$prog") >&5 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
as_fn_error $? "Python interpreter is too old" "$LINENO" 5
|
||||
fi
|
||||
am_display_PYTHON=$PYTHON
|
||||
else
|
||||
# Otherwise, try each interpreter until we find one that satisfies
|
||||
# VERSION.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= 2.7.0" >&5
|
||||
$as_echo_n "checking for a Python interpreter with version >= 2.7.0... " >&6; }
|
||||
if ${am_cv_pathless_PYTHON+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
for am_cv_pathless_PYTHON in python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do
|
||||
test "$am_cv_pathless_PYTHON" = none && break
|
||||
prog="import sys
|
||||
# split strings by '.' and convert to numeric. Append some zeros
|
||||
# because we need at least 4 digits for the hex conversion.
|
||||
# map returns an iterator in Python 3.0 and a list in 2.x
|
||||
minver = list(map(int, '2.7.0'.split('.'))) + [0, 0, 0]
|
||||
minverhex = 0
|
||||
# xrange is not present in Python 3.0 and range returns an iterator
|
||||
for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i]
|
||||
sys.exit(sys.hexversion < minverhex)"
|
||||
if { echo "$as_me:$LINENO: $am_cv_pathless_PYTHON -c "$prog"" >&5
|
||||
($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; then :
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_pathless_PYTHON" >&5
|
||||
$as_echo "$am_cv_pathless_PYTHON" >&6; }
|
||||
# Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
|
||||
if test "$am_cv_pathless_PYTHON" = none; then
|
||||
PYTHON=:
|
||||
else
|
||||
# Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args.
|
||||
set dummy $am_cv_pathless_PYTHON; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_path_PYTHON+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
case $PYTHON in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
PYTHON=$ac_cv_path_PYTHON
|
||||
if test -n "$PYTHON"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
|
||||
$as_echo "$PYTHON" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
am_display_PYTHON=$am_cv_pathless_PYTHON
|
||||
fi
|
||||
|
||||
|
||||
if test "$PYTHON" = :; then
|
||||
as_fn_error $? "no suitable Python interpreter found" "$LINENO" 5
|
||||
else
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5
|
||||
$as_echo_n "checking for $am_display_PYTHON version... " >&6; }
|
||||
if ${am_cv_python_version+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"`
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5
|
||||
$as_echo "$am_cv_python_version" >&6; }
|
||||
PYTHON_VERSION=$am_cv_python_version
|
||||
|
||||
|
||||
|
||||
PYTHON_PREFIX='${prefix}'
|
||||
|
||||
PYTHON_EXEC_PREFIX='${exec_prefix}'
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5
|
||||
$as_echo_n "checking for $am_display_PYTHON platform... " >&6; }
|
||||
if ${am_cv_python_platform+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5
|
||||
$as_echo "$am_cv_python_platform" >&6; }
|
||||
PYTHON_PLATFORM=$am_cv_python_platform
|
||||
|
||||
|
||||
# Just factor out some code duplication.
|
||||
am_python_setup_sysconfig="\
|
||||
import sys
|
||||
# Prefer sysconfig over distutils.sysconfig, for better compatibility
|
||||
# with python 3.x. See automake bug#10227.
|
||||
try:
|
||||
import sysconfig
|
||||
except ImportError:
|
||||
can_use_sysconfig = 0
|
||||
else:
|
||||
can_use_sysconfig = 1
|
||||
# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs:
|
||||
# <https://github.com/pypa/virtualenv/issues/118>
|
||||
try:
|
||||
from platform import python_implementation
|
||||
if python_implementation() == 'CPython' and sys.version[:3] == '2.7':
|
||||
can_use_sysconfig = 0
|
||||
except ImportError:
|
||||
pass"
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5
|
||||
$as_echo_n "checking for $am_display_PYTHON script directory... " >&6; }
|
||||
if ${am_cv_python_pythondir+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test "x$prefix" = xNONE
|
||||
then
|
||||
am_py_prefix=$ac_default_prefix
|
||||
else
|
||||
am_py_prefix=$prefix
|
||||
fi
|
||||
am_cv_python_pythondir=`$PYTHON -c "
|
||||
$am_python_setup_sysconfig
|
||||
if can_use_sysconfig:
|
||||
sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
|
||||
else:
|
||||
from distutils import sysconfig
|
||||
sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
|
||||
sys.stdout.write(sitedir)"`
|
||||
case $am_cv_python_pythondir in
|
||||
$am_py_prefix*)
|
||||
am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
|
||||
am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"`
|
||||
;;
|
||||
*)
|
||||
case $am_py_prefix in
|
||||
/usr|/System*) ;;
|
||||
*)
|
||||
am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5
|
||||
$as_echo "$am_cv_python_pythondir" >&6; }
|
||||
pythondir=$am_cv_python_pythondir
|
||||
|
||||
|
||||
|
||||
pkgpythondir=\${pythondir}/$PACKAGE
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5
|
||||
$as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; }
|
||||
if ${am_cv_python_pyexecdir+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test "x$exec_prefix" = xNONE
|
||||
then
|
||||
am_py_exec_prefix=$am_py_prefix
|
||||
else
|
||||
am_py_exec_prefix=$exec_prefix
|
||||
fi
|
||||
am_cv_python_pyexecdir=`$PYTHON -c "
|
||||
$am_python_setup_sysconfig
|
||||
if can_use_sysconfig:
|
||||
sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'})
|
||||
else:
|
||||
from distutils import sysconfig
|
||||
sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix')
|
||||
sys.stdout.write(sitedir)"`
|
||||
case $am_cv_python_pyexecdir in
|
||||
$am_py_exec_prefix*)
|
||||
am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
|
||||
am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"`
|
||||
;;
|
||||
*)
|
||||
case $am_py_exec_prefix in
|
||||
/usr|/System*) ;;
|
||||
*)
|
||||
am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5
|
||||
$as_echo "$am_cv_python_pyexecdir" >&6; }
|
||||
pyexecdir=$am_cv_python_pyexecdir
|
||||
|
||||
|
||||
|
||||
pkgpyexecdir=\${pyexecdir}/$PACKAGE
|
||||
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'`
|
||||
|
||||
|
||||
EXTRA_LIBS="${EXTRA_LIBS} -l${PYTHON_LIB}"
|
||||
CPPFLAGS="${CPPFLAGS} -I${PYTHON_INCLUDE_DIR}"
|
||||
|
||||
|
||||
$as_echo "#define USE_PYTHON 1" >>confdefs.h
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
27
interface.c
27
interface.c
@ -59,6 +59,10 @@
|
||||
# include "lua-tg.h"
|
||||
#endif
|
||||
|
||||
#ifdef USE_PYTHON
|
||||
# include "python-tg.h"
|
||||
#endif
|
||||
|
||||
//#include "mtproto-common.h"
|
||||
|
||||
#include <tgl/tgl.h>
|
||||
@ -1116,6 +1120,7 @@ extern char *downloads_directory;
|
||||
extern char *config_directory;
|
||||
extern char *binlog_file_name;
|
||||
extern char *lua_file;
|
||||
extern char *python_file;
|
||||
extern struct event *term_ev;
|
||||
|
||||
void do_clear (int arg_num, struct arg args[], struct in_ev *ev) {
|
||||
@ -1130,6 +1135,7 @@ void do_clear (int arg_num, struct arg args[], struct in_ev *ev) {
|
||||
free (config_directory);
|
||||
free (binlog_file_name);
|
||||
free (lua_file);
|
||||
free (python_file);
|
||||
clear_history ();
|
||||
event_free (term_ev);
|
||||
event_base_free (TLS->ev_base);
|
||||
@ -1933,6 +1939,9 @@ void print_message_gw (struct tgl_state *TLSR, struct tgl_message *M) {
|
||||
#ifdef USE_LUA
|
||||
lua_new_msg (M);
|
||||
#endif
|
||||
#ifdef USE_PYTHON
|
||||
py_new_msg (M);
|
||||
#endif
|
||||
if (!binlog_read) { return; }
|
||||
if (tgl_get_peer_type (M->to_id) == TGL_PEER_ENCR_CHAT) {
|
||||
write_secret_chat_file ();
|
||||
@ -1952,6 +1961,9 @@ void our_id_gw (struct tgl_state *TLSR, int id) {
|
||||
#ifdef USE_LUA
|
||||
lua_our_id (id);
|
||||
#endif
|
||||
#ifdef USE_PYTHON
|
||||
py_our_id (id);
|
||||
#endif
|
||||
}
|
||||
|
||||
void print_peer_updates (struct in_ev *ev, int flags) {
|
||||
@ -2004,7 +2016,10 @@ void user_update_gw (struct tgl_state *TLSR, struct tgl_user *U, unsigned flags)
|
||||
#ifdef USE_LUA
|
||||
lua_user_update (U, flags);
|
||||
#endif
|
||||
|
||||
#ifdef USE_PYTHON
|
||||
py_user_update (U, flags);
|
||||
#endif
|
||||
|
||||
if (disable_output && !notify_ev) { return; }
|
||||
if (!binlog_read) { return; }
|
||||
struct in_ev *ev = notify_ev;
|
||||
@ -2031,7 +2046,10 @@ void chat_update_gw (struct tgl_state *TLSR, struct tgl_chat *U, unsigned flags)
|
||||
#ifdef USE_LUA
|
||||
lua_chat_update (U, flags);
|
||||
#endif
|
||||
|
||||
#ifdef USE_PYTHON
|
||||
py_chat_update (U, flags);
|
||||
#endif
|
||||
|
||||
if (disable_output && !notify_ev) { return; }
|
||||
if (!binlog_read) { return; }
|
||||
struct in_ev *ev = notify_ev;
|
||||
@ -2058,7 +2076,12 @@ void secret_chat_update_gw (struct tgl_state *TLSR, struct tgl_secret_chat *U, u
|
||||
#ifdef USE_LUA
|
||||
lua_secret_chat_update (U, flags);
|
||||
#endif
|
||||
#ifdef USE_PYTHON
|
||||
py_secret_chat_update (U, flags);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
if ((flags & TGL_UPDATE_WORKING) || (flags & TGL_UPDATE_DELETED)) {
|
||||
write_secret_chat_file ();
|
||||
}
|
||||
|
20
main.c
20
main.c
@ -74,6 +74,10 @@
|
||||
# include "lua-tg.h"
|
||||
#endif
|
||||
|
||||
#ifdef USE_PYTHON
|
||||
# include "python-tg.h"
|
||||
#endif
|
||||
|
||||
#include <tgl/tgl.h>
|
||||
|
||||
#define PROGNAME "telegram-cli"
|
||||
@ -106,6 +110,7 @@ char *downloads_directory;
|
||||
char *config_directory;
|
||||
char *binlog_file_name;
|
||||
char *lua_file;
|
||||
char *python_file;
|
||||
int binlog_enabled;
|
||||
extern int log_level;
|
||||
int sync_from_start;
|
||||
@ -378,6 +383,10 @@ void parse_config (void) {
|
||||
parse_config_val (&conf, &lua_file, "lua_script", 0, config_directory);
|
||||
}
|
||||
|
||||
if (!python_file) {
|
||||
parse_config_val (&conf, &python_file, "python_script", 0, config_directory);
|
||||
}
|
||||
|
||||
strcpy (buf + l, "binlog_enabled");
|
||||
config_lookup_bool (&conf, buf, &binlog_enabled);
|
||||
|
||||
@ -640,6 +649,11 @@ void args_parse (int argc, char **argv) {
|
||||
break;
|
||||
#endif
|
||||
case 'W':
|
||||
#ifdef USE_PYTHON
|
||||
case 'Z':
|
||||
python_file = strdup (optarg);
|
||||
break;
|
||||
#endif
|
||||
wait_dialog_list = 1;
|
||||
break;
|
||||
case 'C':
|
||||
@ -878,6 +892,12 @@ int main (int argc, char **argv) {
|
||||
lua_init (lua_file);
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_PYTHON
|
||||
if (python_file) {
|
||||
py_init (python_file);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
inner_main ();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user