/* $Id: pid.h,v 1.4 2005/05/08 04:32:44 reinelt Exp $ * * PID file handling * * Copyright (C) 2003 Michael Reinelt * Copyright (C) 2004 The LCD4Linux Team * * 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: pid.h,v $ * Revision 1.4 2005/05/08 04:32:44 reinelt * CodingStyle added and applied * * Revision 1.3 2005/01/18 06:30:23 reinelt * added (C) to all copyright statements * * Revision 1.2 2003/10/05 17:58:50 reinelt * libtool junk; copyright messages cleaned up * * Revision 1.1 2003/08/08 08:05:23 reinelt * added PID file handling * */ #ifndef _PID_H_ #define _PID_H_ int pid_init(const char *pidfile); int pid_exit(const char *pidfile); #endif '>treecommitdiffstats
blob: ce38a93b0516e8764b449d89dede8f2b9818a583 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
pre { line-height: 125%; margin: 0; }
td.linenos pre { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
span.linenos { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/* $Id$
 * $URL$
 *
 * PID file handling
 *
 * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at>
 *
 * 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.
 *
 */

/* 
 * exported functions:
 * 
 * int pid_init (const char *pidfile)
 *   returns 0 if PID file could be successfully created
 *   returns PID of an already running process
 *   returns -1 in case of an error

 * int pid_exit (const char *pidfile)
 *   returns 0 if PID file could be successfully deleted
 *   otherwise returns error from unlink() call
 *
 */


#include "config.h"

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>

#include "debug.h"
#include "pid.h"
#include "qprintf.h"

#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif


int pid_init(const char *pidfile)
{
    char tmpfile[256];
    char buffer[16];
    int fd, len, pid;

    qprintf(tmpfile, sizeof(tmpfile), "%s.%s", pidfile, "XXXXXX");

    if ((fd = mkstemp(tmpfile)) == -1) {
	error("mkstemp(%s) failed: %s", tmpfile, strerror(errno));
	return -1;
    }

    if (fchmod(fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) == -1) {
	error("fchmod(%s) failed: %s", tmpfile, strerror(errno));
	close(fd);
	unlink(tmpfile);
	return -1;
    }

    qprintf(buffer, sizeof(buffer), "%d\n", (int) getpid());
    len = strlen(buffer);
    if (write(fd, buffer, len) != len) {
	error("write(%s) failed: %s", tmpfile, strerror(errno));
	close(fd);
	unlink(tmpfile);
	return -1;
    }
    close(fd);


    while (link(tmpfile, pidfile) == -1) {

	if (errno != EEXIST) {
	    error("link(%s, %s) failed: %s", tmpfile, pidfile, strerror(errno));
	    unlink(tmpfile);
	    return -1;
	}

	if ((fd = open(pidfile, O_RDONLY)) == -1) {
	    if (errno == ENOENTpre { line-height: 125%; margin: 0; }
td.linenos pre { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
span.linenos { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
dnl $Id$
dnl $URL$


dnl LCD4Linux Plugins conf part
dnl
dnl Copyright (C) 1999, 2000, 2001, 2002, 2003 Michael Reinelt <michael@reinelt.co.at>
dnl Copyright (C) 2004, 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
dnl
dnl This file is part of LCD4Linux.
dnl
dnl LCD4Linux is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2, or (at your option)
dnl any later version.
dnl
dnl LCD4Linux is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl GNU General Public License for more 
[ --with-plugins=<list> choose which plugins to compile.] [ type --with-plugins=list for a list] [ of avaible plugins] [ plugins may be excluded with 'all,!<plugin>',] [ (try 'all,\!<plugin>' if your shell complains...)], plugins=$withval, plugins=all ) plugins=`echo $plugins|sed 's/,/ /g'` for plugin in $plugins; do case $plugin in !*) val="no" plugin=`echo $plugin|cut -c 2-` ;; *) val="yes" ;; esac case "$plugin" in list) AC_MSG_RESULT( [available plugins:] [ apm,asterisk,button_exec,cpuinfo,dbus,diskstats,dvb,exec,event,] [ fifo,file,gps,hddtemp,huawei,i2c_sensors,iconv,imon,isdn,kvv,] [ loadavg,meminfo,mpd,mpris_dbus,mysql,netdev,netinfo,pop3,ppp,] [ proc_stat,python,qnaplog,sample,seti,statfs,uname,uptime,] [ w1retap,wireless,xmms]) AC_MSG_ERROR([run ./configure --with-plugins=...]) ;; all) PLUGIN_APM="yes" PLUGIN_ASTERISK="yes" PLUGIN_BUTTON_EXEC="yes" PLUGIN_CPUINFO="yes" PLUGIN_DBUS="yes" PLUGIN_DISKSTATS="yes" PLUGIN_DVB="yes" PLUGIN_EXEC="yes" PLUGIN_EVENT="yes" PLUGIN_FIFO="yes" PLUGIN_FILE="yes" PLUGIN_GPS="yes" PLUGIN_HDDTEMP="yes" PLUGIN_HUAWEI="yes" PLUGIN_I2C_SENSORS="yes" PLUGIN_ICONV="yes" PLUGIN_IMON="yes" PLUGIN_ISDN="yes" PLUGIN_KVV="yes" PLUGIN_LOADAVG="yes" PLUGIN_MEMINFO="yes" PLUGIN_MPD="yes" PLUGIN_MPRIS_DBUS="yes" PLUGIN_MYSQL="yes" PLUGIN_NETDEV="yes" PLUGIN_NETINFO="yes" PLUGIN_POP3="yes" PLUGIN_PPP="yes" PLUGIN_PROC_STAT="yes" PLUGIN_PYTHON=$with_python PLUGIN_QNAPLOG="yes" PLUGIN_SAMPLE="yes" PLUGIN_SETI="yes" PLUGIN_STATFS="yes" PLUGIN_UNAME="yes" PLUGIN_UPTIME="yes" PLUGIN_W1RETAP="yes" PLUGIN_WIRELESS="yes" PLUGIN_XMMS="yes" ;; apm) PLUGIN_APM=$val ;; button_exec) PLUGIN_BUTTON_EXEC=$val ;; asterisk) PLUGIN_ASTERISK=$val ;; cpuinfo) PLUGIN_CPUINFO=$val ;; dbus) PLUGIN_DBUS=$val ;; diskstats) PLUGIN_DISKSTATS=$val ;; dvb) PLUGIN_DVB=$val ;; exec) PLUGIN_EXEC=$val ;; event) PLUGIN_EVENT=$val ;; fifo) PLUGIN_FIFO=$val ;; file) PLUGIN_FILE=$val ;; gps) PLUGIN_GPS=$val ;; hddtemp) PLUGIN_HDDTEMP=$val ;; huawei) PLUGIN_HUAWEI=$val ;; i2c_sensors) PLUGIN_I2C_SENSORS=$val ;; iconv) PLUGIN_ICONV=$val ;; imon) PLUGIN_IMON=$val ;; isdn) PLUGIN_ISDN=$val ;; kvv) PLUGIN_KVV=$val ;; loadavg) PLUGIN_LOADAVG=$val ;; meminfo) PLUGIN_MEMINFO=$val ;; mpd) PLUGIN_MPD=$val ;; mpris_dbus) PLUGIN_MPRIS_DBUS=$val ;; mysql) PLUGIN_MYSQL=$val ;; netdev) PLUGIN_NETDEV=$val ;; netinfo) PLUGIN_NETINFO=$val ;; pop3) PLUGIN_POP3=$val ;; ppp) PLUGIN_PPP=$val ;; proc_stat) PLUGIN_PROC_STAT=$val ;; python) PLUGIN_PYTHON=$val ;; qnaplog) PLUGIN_QNAPLOG=$val ;; sample) PLUGIN_SAMPLE=$val ;; seti) PLUGIN_SETI=$val ;; statfs) PLUGIN_STATFS=$val ;; uname) PLUGIN_UNAME=$val ;; uptime) PLUGIN_UPTIME=$val ;; w1retap) PLUGIN_W1RETAP=$val ;; wireless) PLUGIN_WIRELESS=$val ;; xmms) PLUGIN_XMMS=$val ;; *) AC_MSG_ERROR([Unknown plugin '$plugin']) ;; esac done AC_MSG_RESULT([done]) # Advanced Power Management if test "$PLUGIN_APM" = "yes"; then AC_CHECK_HEADERS(asm/types.h, [has_asm_types="true"], [has_asm_types="false"]) if test "$has_asm_types" = "true"; then PLUGINS="$PLUGINS plugin_apm.o" AC_DEFINE(PLUGIN_APM,1,[apm plugin]) else AC_MSG_WARN(asm/types.h header not found: apm plugin disabled) fi fi if test "$PLUGIN_BUTTON_EXEC" = "yes"; then PLUGINS="$PLUGINS plugin_button_exec.o" AC_DEFINE(PLUGIN_BUTTON_EXEC,1,[button_exec plugin]) fi if test "$PLUGIN_ASTERISK" = "yes"; then PLUGINS="$PLUGINS plugin_asterisk.o" AC_DEFINE(PLUGIN_ASTERISK,1,[asterisk plugin]) fi # /proc/cpuinfo if test "$PLUGIN_CPUINFO" = "yes"; then PLUGINS="$PLUGINS plugin_cpuinfo.o" AC_DEFINE(PLUGIN_CPUINFO,1,[cpuinfo plugin]) fi #DBus if test "$PLUGIN_DBUS" = "yes"; then PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0.0, HAVE_DBUS="yes", HAVE_DBUS="no") if test "x$HAVE_DBUS" == "xyes"; then PLUGINS="$PLUGINS plugin_dbus.o" PLUGINLIBS="$PLUGINLIBS $DBUS_LIBS" CPPFLAGS="$CPPFLAGS $DBUS_CFLAGS" AC_DEFINE(PLUGIN_DBUS,1,[dbus plugin]) DBUS_VERSION=$($PKG_CONFIG --modversion dbus-1) DBUS_VERSION_MAJOR=$(echo $DBUS_VERSION | cut -d . -f 1) DBUS_VERSION_MINOR=$(echo $DBUS_VERSION | cut -d . -f 2) DBUS_VERSION_MICRO=$(echo $DBUS_VERSION | cut -d . -f 3) AC_DEFINE_UNQUOTED(DBUS_VERSION_MAJOR, $DBUS_VERSION_MAJOR, [DBus Major Version]) AC_DEFINE_UNQUOTED(DBUS_VERSION_MINOR, $DBUS_VERSION_MINOR, [DBus Minor Version]) AC_DEFINE_UNQUOTED(DBUS_VERSION_MICRO, $DBUS_VERSION_MICRO, [DBus Micro Version]) else AC_MSG_WARN(dbus-1 not found check that PKG_CONFIG_PATH is set correctly: dbus plugin disabled) fi fi # /proc/diskstat if test "$PLUGIN_DISKSTATS" = "yes"; then PLUGINS="$PLUGINS plugin_diskstats.o" AC_DEFINE(PLUGIN_DISKSTATS,1,[diskstats plugin]) fi # Digital Video Broadcasting if test "$PLUGIN_DVB" = "yes"; then AC_CHECK_HEADERS(asm/types.h, [has_asm_types="true"], [has_asm_types="false"]) if test "$has_asm_types" = "true"; then AC_CHECK_HEADERS(linux/dvb/frontend.h, [has_dvb_header="true"], [has_dvb_header="false"]) if test "$has_dvb_header" = "true"; then PLUGINS="$PLUGINS plugin_dvb.o" AC_DEFINE(PLUGIN_DVB,1,[dvb plugin]) else PLUGINS="$PLUGINS plugin_dvb.o" AC_MSG_WARN(linux/dvb/frontend.h header not found: using ioctl) fi else AC_MSG_WARN(asm/types.h header not found: dvb plugin disabled) fi fi # start external commands (exec) if test "$PLUGIN_EXEC" = "yes"; then PLUGINS="$PLUGINS plugin_exec.o" AC_DEFINE(PLUGIN_EXEC,1,[exec plugin]) fi # event if test "$PLUGIN_EVENT" = "yes"; then PLUGINS="$PLUGINS plugin_event.o" AC_DEFINE(PLUGIN_EVENT,1,[event plugin]) fi # file if test "$PLUGIN_FILE" = "yes"; then PLUGINS="$PLUGINS plugin_file.o" AC_DEFINE(PLUGIN_FILE,1,[file plugin]) fi # FIFO if test "$PLUGIN_FIFO" = "yes"; then PLUGINS="$PLUGINS plugin_fifo.o" AC_DEFINE(PLUGIN_FIFO,1,[fifo plugin]) fi # GPS if test "$PLUGIN_GPS" = "yes"; then AC_CHECK_HEADERS(nmeap.h, [has_nmeap_header="true"], [has_nmeap_header="false"]) if test "$has_nmeap_header" = "true"; then AC_CHECK_LIB(nmeap, nmeap_init, [has_libnmeap_lib="true"], [has_libnmeap_lib="false"]) if test "$has_libnmeap_lib" = "true"; then PLUGINS="$PLUGINS plugin_gps.o" PLUGINLIBS="$PLUGINLIBS -lnmeap" AC_DEFINE(PLUGIN_GPS,1,[gps plugin]) else AC_MSG_WARN(libnmeap lib not found: gps plugin disabled) fi else AC_MSG_WARN(nmeap.h header not found: gps plugin disabled) fi fi # hddtemp if test "$PLUGIN_HDDTEMP" = "yes"; then PLUGINS="$PLUGINS plugin_hddtemp.o" AC_DEFINE(PLUGIN_HDDTEMP,1,[hddtemp plugin]) fi # Huawei if test "$PLUGIN_HUAWEI" = "yes"; then PLUGINS="$PLUGINS plugin_huawei.o" AC_DEFINE(PLUGIN_HUAWEI,1,[huawei plugin]) fi # I2C if test "$PLUGIN_I2C_SENSORS" = "yes"; then PLUGINS="$PLUGINS plugin_i2c_sensors.o" AC_DEFINE(PLUGIN_I2C_SENSORS,1,[i2c sensors plugin]) fi # IConv if test "$PLUGIN_ICONV" = "yes"; then AM_ICONV if test "$am_cv_func_iconv" = "yes"; then PLUGINS="$PLUGINS plugin_iconv.o" PLUGINLIBS="$PLUGINLIBS $LIBICONV" AC_DEFINE(PLUGIN_ICONV,1,[iconv charset converter plugin]) else AC_MSG_WARN(iconv not found: iconv plugin disabled) fi fi # ISDN monitor if test "$PLUGIN_IMON" = "yes"; then AC_CHECK_HEADERS(linux/errno.h, [has_linux_errno="true"], [has_linux_errno="false"]) if test "$has_linux_errno" = "true"; then PLUGINS="$PLUGINS plugin_imon.o" AC_DEFINE(PLUGIN_IMON,1,[imon plugin]) else AC_MSG_WARN(linux/errno.h header not found: imon plugin disabled) fi fi # ISDN if test "$PLUGIN_ISDN" = "yes"; then AC_CHECK_HEADERS(linux/isdn.h, [has_isdn_header="true"], [has_isdn_header="false"]) if test "$has_dvb_header" = "false"; then AC_MSG_WARN(linux/isdn.h header not found: isdn plugin CPS disabled) fi PLUGINS="$PLUGINS plugin_isdn.o" AC_DEFINE(PLUGIN_ISDN,1,[ISDN plugin]) fi # Karlsruher Verkehrsverbund if test "$PLUGIN_KVV" = "yes"; then PLUGINS="$PLUGINS plugin_kvv.o" AC_DEFINE(PLUGIN_KVV,1,[kvv plugin]) fi # load average if test "$PLUGIN_LOADAVG" = "yes"; then PLUGINS="$PLUGINS plugin_loadavg.o" AC_DEFINE(PLUGIN_LOADAVG,1,[loadavg plugin]) fi # meminfo if test "$PLUGIN_MEMINFO" = "yes"; then PLUGINS="$PLUGINS plugin_meminfo.o" AC_DEFINE(PLUGIN_MEMINFO,1,[meminfo plugin]) fi # MPD if test "$PLUGIN_MPD" = "yes"; then AC_CHECK_LIB(libmpd, [mpd_newConnection], [has_mpd_header="true"], [has_mpd_header="false"]) if test "$has_mpd_header" = "true"; then PLUGINS="$PLUGINS plugin_mpd.o" PLUGINLIBS="$PLUGINLIBS `pkg-config libmpd --libs`" CPPFLAGS="$CPPFLAGS `pkg-config libmpd --cflags`" AC_DEFINE(PLUGIN_MPD,1,[mpd plugin]) else AC_MSG_WARN(libmpdclient.h header not found: mpd plugin disabled) AC_MSG_WARN(get libmpdclient.h from http://www.musicpd.org/libmpdclient.shtml) AC_MSG_WARN(and copy those 2 files in the lcd4linux directory.) fi fi # MPRIS D-Bus if test "$PLUGIN_MPRIS_DBUS" = "yes"; then AC_CHECK_HEADERS(dbus/dbus.h, [has_dbus_header="true"], [has_dbus_header="false"]) if test "$has_dbus_header" = "true"; then AC_CHECK_LIB(dbus-1, dbus_bus_get, [has_libdbus1_lib="true"], [has_libdbus1_lib="false"]) if test "$has_libdbus1_lib" = "true"; then PLUGINS="$PLUGINS plugin_mpris_dbus.o" PLUGINLIBS="$PLUGINLIBS -ldbus-1" AC_DEFINE(PLUGIN_MPRIS_DBUS,1,[mpris_dbus plugin]) else AC_MSG_WARN(libdbus-1 lib not found: mpris_dbus plugin disabled) fi else AC_MSG_WARN(dbus/dbus.h header not found: mpris_dbus plugin disabled) fi fi # MySQL if test "$PLUGIN_MYSQL" = "yes"; then AC_CHECK_HEADERS(mysql/mysql.h, [has_mysql_header="true"], [has_mysql_header="false"]) if test "$has_mysql_header" = "true"; then AC_CHECK_LIB(mysqlclient, mysql_init, [has_mysql_lib="true"], [has_mysql_lib="false"]) if test "$has_mysql_lib" = "true"; then PLUGINS="$PLUGINS plugin_mysql.o" PLUGINLIBS="$PLUGINLIBS -lmysqlclient" AC_DEFINE(PLUGIN_MYSQL,1,[mysql plugin]) else AC_MSG_WARN(mysqlclient lib not found: mysql plugin disabled) fi else AC_MSG_WARN(mysql/mysql.h header not found: mysql plugin disabled) fi fi # /proc/net/dev if test "$PLUGIN_NETDEV" = "yes"; then PLUGINS="$PLUGINS plugin_netdev.o" AC_DEFINE(PLUGIN_NETDEV,1,[netdev plugin]) fi # configuration of network devices if test "$PLUGIN_NETINFO" = "yes"; then PLUGINS="$PLUGINS plugin_netinfo.o" AC_DEFINE(PLUGIN_NETINFO,1,[netinfo plugin]) fi # POP3 if test "$PLUGIN_POP3" = "yes"; then PLUGINS="$PLUGINS plugin_pop3.o" AC_DEFINE(PLUGIN_POP3,1,[POP3 plugin]) fi # PPP 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]) else AC_MSG_WARN(net/if_ppp.h header not found: ppp plugin disabled) fi fi # /proc/stat if test "$PLUGIN_PROC_STAT" = "yes"; then PLUGINS="$PLUGINS plugin_proc_stat.o" AC_DEFINE(PLUGIN_PROC_STAT,1,[proc_stat plugin]) fi # python if test "$PLUGIN_PYTHON" = "yes"; then if test "$with_python" != "yes"; then AC_MSG_WARN(python support not enabled: python plugin disabled (use --with-python to enable)) else if test -z "$python_path"; then AC_MSG_WARN(python headers not found: python plugin disabled) else PLUGINS="$PLUGINS plugin_python.o" CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS" PLUGINLIBS="$PLUGINLIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LIBS" AC_DEFINE(PLUGIN_PYTHON,1,[python plugin]) fi fi fi # Qnaplog if test "$PLUGIN_QNAPLOG" = "yes"; then AC_CHECK_HEADERS(sqlite3.h, [has_sqlite3_header="true"], [has_sqlite3_header="false"]) if test "$has_sqlite3_header" = "true"; then AC_CHECK_LIB(sqlite3, sqlite3_initialize, [has_sqlite3_lib="true"], [has_sqlite3_lib="false"]) if test "$has_sqlite3_lib" = "true"; then PLUGINS="$PLUGINS plugin_qnaplog.o" PLUGINLIBS="$PLUGINLIBS -lsqlite3" AC_DEFINE(PLUGIN_QNAPLOG,1,[qnaplog plugin]) else AC_MSG_WARN(sqlite3 lib not found: qnaplog plugin disabled) fi else AC_MSG_WARN(sqlite3.h header not found: qnaplog plugin disabled) fi fi # sample if test "$PLUGIN_SAMPLE" = "yes"; then PLUGINS="$PLUGINS plugin_sample.o" AC_DEFINE(PLUGIN_SAMPLE,1,[sample plugin]) fi # SETI if test "$PLUGIN_SETI" = "yes"; then PLUGINS="$PLUGINS plugin_seti.o" AC_DEFINE(PLUGIN_SETI,1,[seti plugin]) fi # statfs() if test "$PLUGIN_STATFS" = "yes"; then AC_CHECK_HEADERS(sys/vfs.h, [has_vfs_header="true"], [has_vfs_header="false"]) if test "$has_vfs_header" = "true"; then PLUGINS="$PLUGINS plugin_statfs.o" AC_DEFINE(PLUGIN_STATFS,1,[statfs plugin]) else AC_MSG_WARN(sys/vfs.h header not found: statfs plugin disabled) fi fi # uname if test "$PLUGIN_UNAME" = "yes"; then PLUGINS="$PLUGINS plugin_uname.o" AC_DEFINE(PLUGIN_UNAME,1,[uname plugin]) fi # uptime if test "$PLUGIN_UPTIME" = "yes"; then PLUGINS="$PLUGINS plugin_uptime.o" AC_DEFINE(PLUGIN_UPTIME,1,[uptime plugin]) fi if test "$PLUGIN_W1RETAP" = "yes"; then PLUGINS="$PLUGINS plugin_w1retap.o" AC_DEFINE(PLUGIN_W1RETAP,1,[w1retap plugin]) fi # WLAN if test "$PLUGIN_WIRELESS" = "yes"; then AC_CHECK_HEADERS(linux/wireless.h, [has_wireless_header="true"], [has_wireless_header="false"]) if test "$has_wireless_header" = "true"; then PLUGINS="$PLUGINS plugin_wireless.o" AC_DEFINE(PLUGIN_WIRELESS,1,[wireless plugin]) else AC_MSG_WARN(linux/wireless.h header not found: wireless plugin disabled) fi fi # XMMS if test "$PLUGIN_XMMS" = "yes"; then PLUGINS="$PLUGINS plugin_xmms.o" AC_DEFINE(PLUGIN_XMMS,1,[xmms plugin]) fi if test "$PLUGINS" = ""; then AC_MSG_ERROR([You should include at least one plugin...]) fi AC_SUBST(PLUGINS) AC_SUBST(PLUGINLIBS)