[lcd4linux @ 2005-05-02 10:29:20 by reinelt]

preparations for python bindings and python plugin

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@536 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
This commit is contained in:
reinelt
2005-05-02 10:29:20 +00:00
parent dfcd00a79b
commit 0849d874e7
9 changed files with 636 additions and 30 deletions

View File

@@ -6,14 +6,11 @@ DRIVERS=@DRIVERS@
PLUGINS=@PLUGINS@
bin_PROGRAMS = lcd4linux
#lib_LTLIBRARIES = liblcd4linux.la
AM_CFLAGS = $(X_CFLAGS) -D_GNU_SOURCE -Wall -W
lcd4linux_LDFLAGS = $(X_LIBS)
lcd4linux_LDADD = @DRIVERS@ @PLUGINS@ @DRVLIBS@ @PLUGINLIBS@
#lcd4linux_LDADD = liblcd4linux.la @DRVLIBS@
#remove next line for liblcd4linux
lcd4linux_DEPENDENCIES = @DRIVERS@ @PLUGINS@
lcd4linux_SOURCES = \
@@ -42,12 +39,6 @@ plugin_string.c \
plugin_test.c \
plugin_time.c
#liblcd4linux_la_DEPENDENCIES = @DRIVERS@
#liblcd4linux_la_LDFLAGS = -version-info 9:12:9
#liblcd4linux_la_LIBADD = @DRIVERS@
#liblcd4linux_la_SOURCES =
EXTRA_lcd4linux_SOURCES= \
drv_generic_text.c \
drv_generic_text.h \
@@ -96,6 +87,7 @@ plugin_netdev.c \
plugin_pop3.c \
plugin_ppp.c \
plugin_proc_stat.c \
plugin_python.c \
plugin_seti.c \
plugin_statfs.c \
plugin_uname.c \

View File

@@ -73,7 +73,20 @@ LTLIB = @LTLIB@
MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@
PLUGINLIBS = @PLUGINLIBS@
PYTHON = @PYTHON@
PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
PYTHON_VERSION = @PYTHON_VERSION@
VERSION = @VERSION@
pkgpyexecdir = @pkgpyexecdir@
pkgpythondir = @pkgpythondir@
pyexecdir = @pyexecdir@
pythondir = @pythondir@
AUTOMAKE_OPTIONS = gnu
CLEANFILES = *~
@@ -81,26 +94,17 @@ DRIVERS = @DRIVERS@
PLUGINS = @PLUGINS@
bin_PROGRAMS = lcd4linux
#lib_LTLIBRARIES = liblcd4linux.la
AM_CFLAGS = $(X_CFLAGS) -D_GNU_SOURCE -Wall -W
lcd4linux_LDFLAGS = $(X_LIBS)
lcd4linux_LDADD = @DRIVERS@ @PLUGINS@ @DRVLIBS@ @PLUGINLIBS@
#lcd4linux_LDADD = liblcd4linux.la @DRVLIBS@
#remove next line for liblcd4linux
lcd4linux_DEPENDENCIES = @DRIVERS@ @PLUGINS@
lcd4linux_SOURCES = lcd4linux.c cfg.c cfg.h debug.c debug.h drv.c drv.h evaluator.c evaluator.h hash.c hash.h layout.c layout.h pid.c pid.h timer.c timer.h thread.c thread.h udelay.c udelay.h qprintf.c qprintf.h widget.c widget.h widget_text.c widget_text.h widget_bar.c widget_bar.h widget_icon.c widget_icon.h plugin.c plugin.h plugin_cfg.c plugin_math.c plugin_string.c plugin_test.c plugin_time.c
#liblcd4linux_la_DEPENDENCIES = @DRIVERS@
#liblcd4linux_la_LDFLAGS = -version-info 9:12:9
#liblcd4linux_la_LIBADD = @DRIVERS@
#liblcd4linux_la_SOURCES =
EXTRA_lcd4linux_SOURCES = drv_generic_text.c drv_generic_text.h drv_generic_graphic.c drv_generic_graphic.h drv_generic_serial.c drv_generic_serial.h drv_generic_parport.c drv_generic_parport.h drv_generic_i2c.c drv_generic_i2c.h drv_BeckmannEgle.c drv_BWCT.c drv_Crystalfontz.c drv_Curses.c drv_Cwlinux.c drv_HD44780.c drv_Image.c drv_LCDLinux.c drv_LCDTerm.c drv_M50530.c drv_MatrixOrbital.c drv_MilfordInstruments.c drv_NULL.c drv_RouterBoard.c drv_SimpleLCD.c drv_T6963.c drv_Trefon.c drv_USBLCD.c drv_X11.c font_6x8.h plugin_apm.c plugin_cpuinfo.c plugin_diskstats.c plugin_dvb.c plugin_exec.c plugin_i2c_sensors.c plugin_imon.c plugin_isdn.c plugin_loadavg.c plugin_meminfo.c plugin_mysql.c plugin_netdev.c plugin_pop3.c plugin_ppp.c plugin_proc_stat.c plugin_seti.c plugin_statfs.c plugin_uname.c plugin_uptime.c plugin_wireless.c plugin_xmms.c
EXTRA_lcd4linux_SOURCES = drv_generic_text.c drv_generic_text.h drv_generic_graphic.c drv_generic_graphic.h drv_generic_serial.c drv_generic_serial.h drv_generic_parport.c drv_generic_parport.h drv_generic_i2c.c drv_generic_i2c.h drv_BeckmannEgle.c drv_BWCT.c drv_Crystalfontz.c drv_Curses.c drv_Cwlinux.c drv_HD44780.c drv_Image.c drv_LCDLinux.c drv_LCDTerm.c drv_M50530.c drv_MatrixOrbital.c drv_MilfordInstruments.c drv_NULL.c drv_RouterBoard.c drv_SimpleLCD.c drv_T6963.c drv_Trefon.c drv_USBLCD.c drv_X11.c font_6x8.h plugin_apm.c plugin_cpuinfo.c plugin_diskstats.c plugin_dvb.c plugin_exec.c plugin_i2c_sensors.c plugin_imon.c plugin_isdn.c plugin_loadavg.c plugin_meminfo.c plugin_mysql.c plugin_netdev.c plugin_pop3.c plugin_ppp.c plugin_proc_stat.c plugin_python.c plugin_seti.c plugin_statfs.c plugin_uname.c plugin_uptime.c plugin_wireless.c plugin_xmms.c
EXTRA_DIST = lcd4linux.conf.sample lcd4kde.conf lcd4linux.kdelnk lcd4linux.xpm lcd4linux.lsm curses.m4 AUTHORS CREDITS FAQ NEWS TODO README README.Drivers README.Plugins README.KDE plugin_sample.c
@@ -154,12 +158,12 @@ DEP_FILES = .deps/cfg.P .deps/debug.P .deps/drv.P .deps/drv_BWCT.P \
.deps/plugin_imon.P .deps/plugin_isdn.P .deps/plugin_loadavg.P \
.deps/plugin_math.P .deps/plugin_meminfo.P .deps/plugin_mysql.P \
.deps/plugin_netdev.P .deps/plugin_pop3.P .deps/plugin_ppp.P \
.deps/plugin_proc_stat.P .deps/plugin_seti.P .deps/plugin_statfs.P \
.deps/plugin_string.P .deps/plugin_test.P .deps/plugin_time.P \
.deps/plugin_uname.P .deps/plugin_uptime.P .deps/plugin_wireless.P \
.deps/plugin_xmms.P .deps/qprintf.P .deps/thread.P .deps/timer.P \
.deps/udelay.P .deps/widget.P .deps/widget_bar.P .deps/widget_icon.P \
.deps/widget_text.P
.deps/plugin_proc_stat.P .deps/plugin_python.P .deps/plugin_seti.P \
.deps/plugin_statfs.P .deps/plugin_string.P .deps/plugin_test.P \
.deps/plugin_time.P .deps/plugin_uname.P .deps/plugin_uptime.P \
.deps/plugin_wireless.P .deps/plugin_xmms.P .deps/qprintf.P \
.deps/thread.P .deps/timer.P .deps/udelay.P .deps/widget.P \
.deps/widget_bar.P .deps/widget_icon.P .deps/widget_text.P
SOURCES = $(lcd4linux_SOURCES) $(EXTRA_lcd4linux_SOURCES)
OBJECTS = $(lcd4linux_OBJECTS)

View File

@@ -284,6 +284,9 @@
/* proc_stat plugin */
#undef PLUGIN_PROC_STAT
/* python plugin */
#undef PLUGIN_PYTHON
/* seti plugin */
#undef PLUGIN_SETI

283
configure vendored
View File

@@ -311,7 +311,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP LN_S CURSES_LIBS CURSES_INCLUDEDIR EGREP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS DRIVERS DRVLIBS PLUGINS PLUGINLIBS LIBOBJS POW_LIB LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP LN_S CURSES_LIBS CURSES_INCLUDEDIR EGREP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS PYTHON PYTHON_VERSION PYTHON_PREFIX PYTHON_EXEC_PREFIX PYTHON_PLATFORM pythondir pkgpythondir pyexecdir pkgpyexecdir PYTHON_CPPFLAGS PYTHON_LDFLAGS PYTHON_SITE_PKG PYTHON_EXTRA_LIBS DRIVERS DRVLIBS PLUGINS PLUGINLIBS LIBOBJS POW_LIB LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -5523,6 +5523,255 @@ fi
done
# check for python
## ------------------------
## Python file handling
## From Andrew Dalke
## Updated by James Henstridge
## ------------------------
# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# 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, 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# AM_PATH_PYTHON([MINIMUM-VERSION])
# Adds support for distributing Python modules and packages. To
# install modules, copy them to $(pythondir), using the python_PYTHON
# automake variable. To install a package with the same name as the
# automake package, install to $(pkgpythondir), or use the
# pkgpython_PYTHON automake variable.
# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
# locations to install python extension modules (shared libraries).
# Another macro is required to find the appropriate flags to compile
# extension modules.
# If your package is configured with a different prefix to python,
# users will have to add the install directory to the PYTHONPATH
# environment variable, or create a .pth file (see the python
# documentation for details).
# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
# cause an error if the version of python installed on the system
# doesn't meet the requirement. MINIMUM-VERSION should consist of
# numbers and dots only.
# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
# ---------------------------------------------------------------------------
# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
# Run ACTION-IF-FALSE otherwise.
# This test uses sys.hexversion instead of the string equivalent (first
# word of sys.version), in order to cope with versions such as 2.2c1.
# hexversion has been introduced in Python 1.5.2; it's probably not
# worth to support older versions (1.5.1 was released on October 31, 1998).
# Find any Python interpreter.
for ac_prog in python python2 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_PYTHON+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
;;
esac
fi
PYTHON=$ac_cv_path_PYTHON
if test -n "$PYTHON"; then
echo "$as_me:$LINENO: result: $PYTHON" >&5
echo "${ECHO_T}$PYTHON" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$PYTHON" && break
done
am_display_PYTHON=python
echo "$as_me:$LINENO: checking for $am_display_PYTHON version" >&5
echo $ECHO_N "checking for $am_display_PYTHON version... $ECHO_C" >&6
if test "${am_cv_python_version+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
am_cv_python_version=`$PYTHON -c "import sys; print sys.version[:3]"`
fi
echo "$as_me:$LINENO: result: $am_cv_python_version" >&5
echo "${ECHO_T}$am_cv_python_version" >&6
PYTHON_VERSION=$am_cv_python_version
PYTHON_PREFIX='${prefix}'
PYTHON_EXEC_PREFIX='${exec_prefix}'
echo "$as_me:$LINENO: checking for $am_display_PYTHON platform" >&5
echo $ECHO_N "checking for $am_display_PYTHON platform... $ECHO_C" >&6
if test "${am_cv_python_platform+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`
fi
echo "$as_me:$LINENO: result: $am_cv_python_platform" >&5
echo "${ECHO_T}$am_cv_python_platform" >&6
PYTHON_PLATFORM=$am_cv_python_platform
echo "$as_me:$LINENO: checking for $am_display_PYTHON script directory" >&5
echo $ECHO_N "checking for $am_display_PYTHON script directory... $ECHO_C" >&6
if test "${am_cv_python_pythondir+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null ||
echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`
fi
echo "$as_me:$LINENO: result: $am_cv_python_pythondir" >&5
echo "${ECHO_T}$am_cv_python_pythondir" >&6
pythondir=$am_cv_python_pythondir
pkgpythondir=\${pythondir}/$PACKAGE
echo "$as_me:$LINENO: checking for $am_display_PYTHON extension module directory" >&5
echo $ECHO_N "checking for $am_display_PYTHON extension module directory... $ECHO_C" >&6
if test "${am_cv_python_pyexecdir+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null ||
echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`
fi
echo "$as_me:$LINENO: result: $am_cv_python_pyexecdir" >&5
echo "${ECHO_T}$am_cv_python_pyexecdir" >&6
pyexecdir=$am_cv_python_pyexecdir
pkgpyexecdir=\${pyexecdir}/$PACKAGE
#
# should allow for checking of python version here...
#
# Check for Python include path
echo "$as_me:$LINENO: checking for Python include path" >&5
echo $ECHO_N "checking for Python include path... $ECHO_C" >&6
python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
for i in "$python_path/include/python$PYTHON_VERSION/" "$python_path/include/python/" "$python_path/" ; do
python_path=`find $i -type f -name Python.h -print | sed "1q"`
if test -n "$python_path" ; then
break
fi
done
python_path=`echo $python_path | sed "s,/Python.h$,,"`
echo "$as_me:$LINENO: result: $python_path" >&5
echo "${ECHO_T}$python_path" >&6
if test -z "$python_path" ; then
{ { echo "$as_me:$LINENO: error: cannot find Python include path" >&5
echo "$as_me: error: cannot find Python include path" >&2;}
{ (exit 1); exit 1; }; }
fi
PYTHON_CPPFLAGS=-I$python_path
# Check for Python library path
echo "$as_me:$LINENO: checking for Python library path" >&5
echo $ECHO_N "checking for Python library path... $ECHO_C" >&6
python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
for i in "$python_path/lib/python$PYTHON_VERSION/config/" "$python_path/lib/python$PYTHON_VERSION/" "$python_path/lib/python/config/" "$python_path/lib/python/" "$python_path/" ; do
python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"`
if test -n "$python_path" ; then
break
fi
done
python_path=`echo $python_path | sed "s,/libpython.*$,,"`
echo "$as_me:$LINENO: result: $python_path" >&5
echo "${ECHO_T}$python_path" >&6
if test -z "$python_path" ; then
{ { echo "$as_me:$LINENO: error: cannot find Python library path" >&5
echo "$as_me: error: cannot find Python library path" >&2;}
{ (exit 1); exit 1; }; }
fi
PYTHON_LDFLAGS="-L$python_path -lpython$PYTHON_VERSION"
#
python_site=`echo $python_path | sed "s/config/site-packages/"`
PYTHON_SITE_PKG=$python_site
#
# libraries which must be linked in when embedding
#
echo "$as_me:$LINENO: checking python extra libraries" >&5
echo $ECHO_N "checking python extra libraries... $ECHO_C" >&6
PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
conf = distutils.sysconfig.get_config_var; \
print conf('LOCALMODLIBS')+' '+conf('LIBS')"
echo "$as_me:$LINENO: result: $PYTHON_EXTRA_LIBS" >&5
echo "${ECHO_T}$PYTHON_EXTRA_LIBS" >&6`
# drivers
echo "$as_me:$LINENO: checking which drivers to compile" >&5
@@ -6005,6 +6254,7 @@ echo "$as_me: error: run ./configure --with-plugins=..." >&2;}
PLUGIN_POP3="yes"
PLUGIN_PPP="yes"
PLUGIN_PROC_STAT="yes"
PLUGIN_PYTHON="yes"
PLUGIN_SETI="yes"
PLUGIN_STATFS="yes"
PLUGIN_UNAME="yes"
@@ -6057,6 +6307,9 @@ echo "$as_me: error: run ./configure --with-plugins=..." >&2;}
proc_stat)
PLUGIN_PROC_STAT=$val
;;
python)
PLUGIN_PYTHON=$val
;;
seti)
PLUGIN_SETI=$val
;;
@@ -6884,7 +7137,7 @@ fi
done
if test "$has_ppp_header" = "true"; then
PLUGINS="$PLUGINS plugin_ppp.o"
PLUGINS="$PLUGINS plugin_ppp.o"
cat >>confdefs.h <<\_ACEOF
#define PLUGIN_PPP 1
@@ -6902,6 +7155,19 @@ cat >>confdefs.h <<\_ACEOF
#define PLUGIN_PROC_STAT 1
_ACEOF
fi
if test "$PLUGIN_PYTHON" = "yes"; then
if test -z "$python_path"; then
{ echo "$as_me:$LINENO: WARNING: python headers not found: python plugin disabled" >&5
echo "$as_me: WARNING: python headers not found: python plugin disabled" >&2;}
else
PLUGINS="$PLUGINS plugin_python.o"
cat >>confdefs.h <<\_ACEOF
#define PLUGIN_PYTHON 1
_ACEOF
fi
fi
if test "$PLUGIN_SETI" = "yes"; then
PLUGINS="$PLUGINS plugin_seti.o"
@@ -10617,6 +10883,19 @@ s,@X_CFLAGS@,$X_CFLAGS,;t t
s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t
s,@X_LIBS@,$X_LIBS,;t t
s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t
s,@PYTHON@,$PYTHON,;t t
s,@PYTHON_VERSION@,$PYTHON_VERSION,;t t
s,@PYTHON_PREFIX@,$PYTHON_PREFIX,;t t
s,@PYTHON_EXEC_PREFIX@,$PYTHON_EXEC_PREFIX,;t t
s,@PYTHON_PLATFORM@,$PYTHON_PLATFORM,;t t
s,@pythondir@,$pythondir,;t t
s,@pkgpythondir@,$pkgpythondir,;t t
s,@pyexecdir@,$pyexecdir,;t t
s,@pkgpyexecdir@,$pkgpyexecdir,;t t
s,@PYTHON_CPPFLAGS@,$PYTHON_CPPFLAGS,;t t
s,@PYTHON_LDFLAGS@,$PYTHON_LDFLAGS,;t t
s,@PYTHON_SITE_PKG@,$PYTHON_SITE_PKG,;t t
s,@PYTHON_EXTRA_LIBS@,$PYTHON_EXTRA_LIBS,;t t
s,@DRIVERS@,$DRIVERS,;t t
s,@DRVLIBS@,$DRVLIBS,;t t
s,@PLUGINS@,$PLUGINS,;t t

View File

@@ -64,6 +64,10 @@ AC_CHECK_HEADERS(linux/compiler.h linux/i2c.h linux/i2c-dev.h,[has_i2c="true"],[
# endif
])
# check for python
sinclude(python.m4)
AC_PYTHON_DEVEL
# drivers
sinclude(drivers.m4)

View File

@@ -1,4 +1,4 @@
/* $Id: plugin.c,v 1.36 2005/04/03 07:07:51 reinelt Exp $
/* $Id: plugin.c,v 1.37 2005/05/02 10:29:20 reinelt Exp $
*
* plugin handler for the Evaluator
*
@@ -23,6 +23,9 @@
*
*
* $Log: plugin.c,v $
* Revision 1.37 2005/05/02 10:29:20 reinelt
* preparations for python bindings and python plugin
*
* Revision 1.36 2005/04/03 07:07:51 reinelt
* added statfs plugin
*
@@ -238,6 +241,8 @@ int plugin_init_ppp (void);
void plugin_exit_ppp (void);
int plugin_init_proc_stat (void);
void plugin_exit_proc_stat (void);
int plugin_init_python (void);
void plugin_exit_python (void);
int plugin_init_seti(void);
void plugin_exit_seti(void);
int plugin_init_statfs(void);
@@ -305,6 +310,9 @@ int plugin_init (void)
#ifdef PLUGIN_PROC_STAT
plugin_init_proc_stat();
#endif
#ifdef PLUGIN_PYTHON
plugin_init_python();
#endif
#ifdef PLUGIN_SETI
plugin_init_seti();
#endif
@@ -374,6 +382,9 @@ void plugin_exit(void) {
#ifdef PLUGIN_PROC_STAT
plugin_exit_proc_stat();
#endif
#ifdef PLUGIN_PYTHON
plugin_exit_python();
#endif
#ifdef PLUGIN_SETI
plugin_exit_seti();
#endif

70
plugin_python.c Normal file
View File

@@ -0,0 +1,70 @@
/* $Id: plugin_python.c,v 1.1 2005/05/02 10:29:20 reinelt Exp $
*
* Python plugin
*
* Copyright 2005 Fixme!
* Copyright 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
*
* This file is part of LCD4Linux.
*
* LCD4Linux 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, or (at your option)
* any later version.
*
* LCD4Linux 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, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
* $Log: plugin_python.c,v $
* Revision 1.1 2005/05/02 10:29:20 reinelt
* preparations for python bindings and python plugin
*
*/
/*
* exported functions:
*
* int plugin_init_python (void)
* adds a python interpreter
*
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include "debug.h"
#include "plugin.h"
#include "hash.h"
// Fixme: #include "lcd4linux_wrap.h"
static void my_exec (RESULT *result, RESULT *arg1)
{
#if 0
const char* value = pyt_exec_str(R2S(arg1));
#else
const char *value = "Fixme";
#endif
SetResult(&result, R_STRING, value);
}
int plugin_init_python (void)
{
AddFunction ("python::exec", 1, my_exec);
return 0;
}
void plugin_exit_python (void)
{
/* empty */
}

View File

@@ -64,6 +64,7 @@ for plugin in $plugins; do
PLUGIN_POP3="yes"
PLUGIN_PPP="yes"
PLUGIN_PROC_STAT="yes"
PLUGIN_PYTHON="yes"
PLUGIN_SETI="yes"
PLUGIN_STATFS="yes"
PLUGIN_UNAME="yes"
@@ -116,6 +117,9 @@ for plugin in $plugins; do
proc_stat)
PLUGIN_PROC_STAT=$val
;;
python)
PLUGIN_PYTHON=$val
;;
seti)
PLUGIN_SETI=$val
;;
@@ -216,8 +220,8 @@ fi
if test "$PLUGIN_PPP" = "yes"; then
AC_CHECK_HEADERS(net/if_ppp.h, [has_ppp_header="true"], [has_ppp_header="false"])
if test "$has_ppp_header" = "true"; then
PLUGINS="$PLUGINS plugin_ppp.o"
AC_DEFINE(PLUGIN_PPP,1,[ppp plugin])
PLUGINS="$PLUGINS plugin_ppp.o"
AC_DEFINE(PLUGIN_PPP,1,[ppp plugin])
else
AC_MSG_WARN(net/if_ppp.h header not found: ppp plugin disabled)
fi
@@ -226,6 +230,14 @@ if test "$PLUGIN_PROC_STAT" = "yes"; then
PLUGINS="$PLUGINS plugin_proc_stat.o"
AC_DEFINE(PLUGIN_PROC_STAT,1,[proc_stat plugin])
fi
if test "$PLUGIN_PYTHON" = "yes"; then
if test -z "$python_path"; then
AC_MSG_WARN(python headers not found: python plugin disabled)
else
PLUGINS="$PLUGINS plugin_python.o"
AC_DEFINE(PLUGIN_PYTHON,1,[python plugin])
fi
fi
if test "$PLUGIN_SETI" = "yes"; then
PLUGINS="$PLUGINS plugin_seti.o"
AC_DEFINE(PLUGIN_SETI,1,[seti plugin])

231
python.m4 Normal file
View File

@@ -0,0 +1,231 @@
## ------------------------
## Python file handling
## From Andrew Dalke
## Updated by James Henstridge
## ------------------------
# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# 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, 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# AM_PATH_PYTHON([MINIMUM-VERSION])
# Adds support for distributing Python modules and packages. To
# install modules, copy them to $(pythondir), using the python_PYTHON
# automake variable. To install a package with the same name as the
# automake package, install to $(pkgpythondir), or use the
# pkgpython_PYTHON automake variable.
# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
# locations to install python extension modules (shared libraries).
# Another macro is required to find the appropriate flags to compile
# extension modules.
# If your package is configured with a different prefix to python,
# users will have to add the install directory to the PYTHONPATH
# environment variable, or create a .pth file (see the python
# documentation for details).
# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
# cause an error if the version of python installed on the system
# doesn't meet the requirement. MINIMUM-VERSION should consist of
# numbers and dots only.
AC_DEFUN([AM_PATH_PYTHON],
[
dnl Find a Python interpreter. Python versions prior to 1.5 are not
dnl supported because the default installation locations changed from
dnl $prefix/lib/site-python in 1.4 to $prefix/lib/python1.5/site-packages
dnl in 1.5.
m4_define([_AM_PYTHON_INTERPRETER_LIST],
[python python2 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5])
m4_if([$1],[],[
dnl No version check is needed.
# Find any Python interpreter.
AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST)
am_display_PYTHON=python
], [
dnl A version check is needed.
if test -n "$PYTHON"; then
# If the user set $PYTHON, use it and don't search something else.
AC_MSG_CHECKING([whether $PYTHON version >= $1])
AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
[AC_MSG_RESULT(yes)],
[AC_MSG_ERROR(too old)])
else
# Otherwise, try each interpreter until we find one that satisfies
# VERSION.
AC_CACHE_CHECK([for a Python interpreter with version >= $1],
[am_cv_pathless_PYTHON],[
for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST : ; do
if test "$am_cv_pathless_PYTHON" = : ; then
AC_MSG_ERROR([no suitable Python interpreter found])
fi
AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
done])
# Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
am_display_PYTHON=$am_cv_pathless_PYTHON
fi
])
dnl Query Python for its version number. Getting [:3] seems to be
dnl the best way to do this; it's what "site.py" does in the standard
dnl library.
AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
[am_cv_python_version=`$PYTHON -c "import sys; print sys.version[[:3]]"`])
AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
dnl Use the values of $prefix and $exec_prefix for the corresponding
dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made
dnl distinct variables so they can be overridden if need be. However,
dnl general consensus is that you shouldn't need this ability.
AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
dnl At times (like when building shared libraries) you may want
dnl to know which OS platform Python thinks this is.
AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
[am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`])
AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
dnl Set up 4 directories:
dnl pythondir -- where to install python scripts. This is the
dnl site-packages directory, not the python standard library
dnl directory like in previous automake betas. This behavior
dnl is more consistent with lispdir.m4 for example.
dnl Query distutils for this directory. distutils does not exist in
dnl Python 1.5, so we fall back to the hardcoded directory if it
dnl doesn't work.
AC_CACHE_CHECK([for $am_display_PYTHON script directory],
[am_cv_python_pythondir],
[am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null ||
echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`])
AC_SUBST([pythondir], [$am_cv_python_pythondir])
dnl pkgpythondir -- $PACKAGE directory under pythondir. Was
dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
dnl more consistent with the rest of automake.
AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
dnl pyexecdir -- directory for installing python extension modules
dnl (shared libraries)
dnl Query distutils for this directory. distutils does not exist in
dnl Python 1.5, so we fall back to the hardcoded directory if it
dnl doesn't work.
AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
[am_cv_python_pyexecdir],
[am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null ||
echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`])
AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
])
# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
# ---------------------------------------------------------------------------
# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
# Run ACTION-IF-FALSE otherwise.
# This test uses sys.hexversion instead of the string equivalent (first
# word of sys.version), in order to cope with versions such as 2.2c1.
# hexversion has been introduced in Python 1.5.2; it's probably not
# worth to support older versions (1.5.1 was released on October 31, 1998).
AC_DEFUN([AM_PYTHON_CHECK_VERSION],
[prog="import sys, string
# split strings by '.' and convert to numeric. Append some zeros
# because we need at least 4 digits for the hex conversion.
minver = map(int, string.split('$2', '.')) + [[0, 0, 0]]
minverhex = 0
for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]]
sys.exit(sys.hexversion < minverhex)"
AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
dnl @synopsis AC_PYTHON_DEVEL
dnl
dnl Checks for Python and tries to get the include path to 'Python.h'.
dnl It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) output
dnl variable.
dnl
dnl @category InstalledPackages
dnl @author Sebastian Huber <sebastian-huber@web.de>
dnl @author Alan W. Irwin <irwin@beluga.phys.uvic.ca>
dnl @author Rafael Laboissiere <laboissiere@psy.mpg.de>
dnl @author Andrew Collier <colliera@nu.ac.za>
dnl @version 2004-07-14
dnl @license GPLWithACException
AC_DEFUN([AC_PYTHON_DEVEL],[
#
# should allow for checking of python version here...
#
AC_REQUIRE([AM_PATH_PYTHON])
# Check for Python include path
AC_MSG_CHECKING([for Python include path])
python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
for i in "$python_path/include/python$PYTHON_VERSION/" "$python_path/include/python/" "$python_path/" ; do
python_path=`find $i -type f -name Python.h -print | sed "1q"`
if test -n "$python_path" ; then
break
fi
done
python_path=`echo $python_path | sed "s,/Python.h$,,"`
AC_MSG_RESULT([$python_path])
if test -z "$python_path" ; then
AC_MSG_ERROR([cannot find Python include path])
fi
AC_SUBST([PYTHON_CPPFLAGS],[-I$python_path])
# Check for Python library path
AC_MSG_CHECKING([for Python library path])
python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
for i in "$python_path/lib/python$PYTHON_VERSION/config/" "$python_path/lib/python$PYTHON_VERSION/" "$python_path/lib/python/config/" "$python_path/lib/python/" "$python_path/" ; do
python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"`
if test -n "$python_path" ; then
break
fi
done
python_path=`echo $python_path | sed "s,/libpython.*$,,"`
AC_MSG_RESULT([$python_path])
if test -z "$python_path" ; then
AC_MSG_ERROR([cannot find Python library path])
fi
AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$PYTHON_VERSION"])
#
python_site=`echo $python_path | sed "s/config/site-packages/"`
AC_SUBST([PYTHON_SITE_PKG],[$python_site])
#
# libraries which must be linked in when embedding
#
AC_MSG_CHECKING(python extra libraries)
PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
conf = distutils.sysconfig.get_config_var; \
print conf('LOCALMODLIBS')+' '+conf('LIBS')"
AC_MSG_RESULT($PYTHON_EXTRA_LIBS)`
AC_SUBST(PYTHON_EXTRA_LIBS)
])