Initial revision
authorBrenden Matthews <brenden1@rty.ca>
Wed, 20 Jul 2005 00:30:40 +0000 (00:30 +0000)
committerBrenden Matthews <brenden1@rty.ca>
Wed, 20 Jul 2005 00:30:40 +0000 (00:30 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@5 7f574dfc-610e-0410-a909-a81674777703

46 files changed:
AUTHORS [new file with mode: 0644]
COPYING [new file with mode: 0644]
ChangeLog [new file with mode: 0644]
INSTALL [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
Makefile.in [new file with mode: 0644]
NEWS [new file with mode: 0644]
README [new file with mode: 0644]
TODO [new file with mode: 0644]
aclocal.m4 [new file with mode: 0644]
app-admin/conky/conky-1.2.ebuild [new file with mode: 0755]
cairo.c [new file with mode: 0644]
changelog.html [new file with mode: 0644]
changelog2html.py [new file with mode: 0644]
common.c [new file with mode: 0644]
config.h.in [new file with mode: 0644]
configure [new file with mode: 0755]
configure.in [new file with mode: 0644]
conky.1 [new file with mode: 0644]
conky.c [new file with mode: 0644]
conky.h [new file with mode: 0644]
conky.x [new file with mode: 0644]
conkyrc.sample [new file with mode: 0644]
depcomp [new file with mode: 0644]
freebsd.c [new file with mode: 0644]
fs.c [new file with mode: 0644]
ftp.c [new file with mode: 0644]
ftp.h [new file with mode: 0644]
install-sh [new file with mode: 0644]
libmpdclient.c [new file with mode: 0644]
libmpdclient.h [new file with mode: 0644]
linux.c [new file with mode: 0644]
mail.c [new file with mode: 0644]
metarinfo.c [new file with mode: 0644]
metarinfo.h [new file with mode: 0644]
missing [new file with mode: 0644]
mixer.c [new file with mode: 0644]
mkinstalldirs [new file with mode: 0644]
mldonkey.c [new file with mode: 0644]
mpd.c [new file with mode: 0644]
netbsd.c [new file with mode: 0644]
seti.c [new file with mode: 0644]
solaris.c [new file with mode: 0644]
top.c [new file with mode: 0644]
top.h [new file with mode: 0644]
x11.c [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..c07f306
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,91 @@
+Authors of conky in alphapetical order (please, send mail if I forgot
+somebody or email address / name is wrong):
+
+adi <razorbladeworks at yahoo dot com>
+  Outline stuff
+  ACPI fan & adapter
+
+affinity <affy at users dot sourceforge dot net>
+  X-Mozilla-Status support
+
+Bobby Beckmann <bbeckmann at users dot sourceforge dot net>
+  Interface IP and Wireless Quality patch
+
+Brenden Matthews <brenden at rty dot ca>
+  project maintainer
+
+Bruce Merry <bmerry at cs dot uct dot ac dot za>
+  Xdbe (double buffering)
+
+dan-h <dan-h at users dot sourceforge dot net>
+  adt746x fix
+
+David McCabe
+  utime
+
+Dennis Frommknecht
+  NVCtrl, temperature monitoring for nvdia-based graphics cards
+
+Dennis Kaandorp <addict at quicknet dot nl>
+  adt746x stuff
+
+Falk Feuersenger <lumberjack at users dot sourceforge dot net>
+  I2C divisor from a file
+
+Gwenhael LE MOINE <cycojesus at yahoo dot fr>
+  Manual setting of the position
+  WM_CLASS for window when drawing to own window
+
+Hannu Saransaari <hipo at users dot sourceforge dot net>
+  Main code
+
+Jarmo Hekkanen
+  SETI stuff
+
+Jeremy Burch <ascii021 at yahoo dot com>
+  $cached and $buffers
+
+JL Farinacci
+  pad_percents
+
+jolapache <jolapache at free dot fr>
+  maildir format
+
+Jørgen P. Tjernø <daxxar at mental dot mine dot nu>
+  Restores default settings before loading new config file in SIGHUP
+  Some cleaning and commenting apparently :)
+  SIGHUP config file reload
+
+killfire
+  fs_used_perc and fs_bar_free patch
+
+Lauri Hakkarainen <b10nik at users dot sourceforge dot net>
+  Some translating, web and other stuff
+
+Leszek Krupiñski <leszek at wafel dot com>
+  Battery number for ACPI battery
+  Load average bug fix
+
+Lucas Brutschy <lbrutschy at users dot sourceforge dot net>
+  MLDonkey patch
+  if constructs patch
+
+Moncelier Camille <pixdamix at users dot sourceforge dot net>
+  METAR patch
+
+roiban adi <adiroiban at users dot sourceforge dot net>
+  hex colour patch
+
+Rui Paulo <rpaulo at netbsd-pt dot org>
+  NetBSD support
+
+Roman Bogorodskiy <bogorodskiy at inbox dot ru>
+  FreeBSD support
+  more FreeBSD fixes
+
+Szymon Boniecki
+  Reads current LC_TIME
+
+William DiPlacido <bimbasaari at yahoo dot com>
+  Frequency from /proc/cpuinfo
+  Some other SETI stuff
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..5da7191
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,26 @@
+Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+    * this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+    * notice, this list of conditions and the following disclaimer in the
+    * documentation and/or other materials provided with the distribution.
+    * Neither the name of the <ORGANIZATION> nor the names of its
+    * contributors may be used to endorse or promote products derived from
+    * this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..d0134af
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,197 @@
+2005-07-17
+       * Fixed a pile of bugs in configure script
+       * Added proper checking for headers in configure script
+       * Made METAR shit threaded so it would stop being retarded, also made
+       it try more then once to update
+       * Added $metar_tempf and ${i2c tempf} for americans
+
+2005-07-16
+       * Added option for Conky to update N times and quit, see
+       total_run_times in conkyrc.sample
+       * Added metar code for weather info, thanks to somebody on sf.net
+       * Added $alignr and $alignc for right and centre alignment
+       * Added wireless info and IP addr patch, thanks Bobby Beckmann,
+       options $addr and $linkstatus (please test!), as well as fixed a mem
+       leak in this patch
+       * adt746x fix, thanks to dan-h on sf.net
+       * Added mldonkey support patch, thanks Lucas Brutschy on sf.net 
+       * Added patch to allow hex colour values, thanks roiban adi on sf.net
+       * Added if constructs patch, thanks Lucas Brutschy on sf.net
+       * Fixed bug in tab code (hopefully for the last time)
+       * Added option to sort by cpu or memory for top, see top_sort_cpu
+
+2005-07-12
+       * Added fix for battery charged state (thanks to Lukas Zapletal
+       <lzap@seznam.cz>)
+
+2005-07-05
+       * Conky 1.1 released
+
+2005-07-03
+       * Added $mpd_bar and $mpd_bitrate
+       * Some minor code cleanups prior to release
+       * Fixed problem with Conky not compiling when XFT disabled
+       * Fixed configure.in problems with Xdbe
+
+2005-07-01
+       * Fixed memory leak in MPD code
+       * Added new $tail object (see conkyrc.sample) which loves to suck CPU
+       and memory
+       * Fixed more mem leaks
+
+2005-06-30
+       * Added use_spacer to config
+       * Added $mpd_status
+       * Added small fix for i2c from Filedil on forums.gentoo.org
+
+2005-06-28
+       * Made it possible to use tabs to right-justify (just add a bunch)
+       * Added ${execbar} (see conkyrc.sample)
+
+2005-06-26
+       * Added memory % to top output
+       * Added initial cairo backend (it's really quite useless at this stage actually, and I'm not sure if there is even any point to it)
+
+2005-06-25
+       * Conky now recognizes the tab character correctly
+       * Added simple config option to print to stdout (out_to_console
+       <yes/no>)
+
+2005-06-23
+       * Added top output.  Check the sample config.
+       * Cleaned up code.
+
+2005-06-22
+       * Finished MPD support ($mpd_title, $mpd_artist, $mpd_album, $mpd_vol)
+       * Removed NVCtrl code
+       * Added noswap and i2c patches
+
+2005-06-21
+       * Version 1.0. Conky is born from the ashes of torsmo. Main site: http://conky.rty.ca/
+       * Added xwin patch
+       * Added new feature for sample averaging of CPU and net info
+
+2004-12-22
+       * Version 0.18 released
+
+2004-12-21
+       * Fixed some double buffer + Xft stuff
+       * Applied X-Mozilla-Status patch (thanks affinity)
+       * Applied NVCtrl patch and modified it a bit (temperature monitoring
+         for nvdia-based graphics cards) (I couldn't test this so it may or
+         may not work or even compile) (thanks Dennis Frommknecht)
+       * Applied fs_used_perc and fs_bar_free patch (thanks killfire [send me
+         mail, I didn't catch your name from sourceforge])
+       * Applied patch that supports mailbox that is in some 'maildir' format
+         (thanks jolapache [send mail, I didn't catch your name from
+         sourceforge])
+       * min -> m
+       * Applied pad_percents patch (thanks JL Farinacci)
+       * Fixed some stuff in acpi fan and acpi ac adapter
+       * Optional XFT even when compiled in
+
+2004-11-30
+       * Applied utime patch (UTC time) (thanks David McCabe)
+
+2004-11-29
+       * Applied Xdbe patch, this includes double_buffer configuration and
+         -b command line option (thanks Bruce Merry)
+       * Applied some other seti patch, not tested (thanks William DiPlacido)
+
+2004-08-25
+       * Applied netbsd patch (thanks Rui Paulo)
+       * Applied cpu frequency patch (thanks William DiPlacido)
+       * Applied adt746x patch (thanks Dennis Kaandorp)
+       * Applied some other FreeBSD patch by the same guy
+
+2004-07-31
+       * Applied FreeBSD patch (thanks Roman Bogorodskiy)
+
+2004-07-25
+       * Xft support and xftfont configuration
+       * rewrote some stuff, there might be some new bugs in old places
+
+2004-07-24
+       * I2C divisor from a file (thanks Falk Feuersenger)
+
+2004-07-20
+       * changed battery thing to ${battery <filename in
+         /proc/acpi/battery/>}
+       * SETI@Home stuff (thanks Jarski)
+
+2004-07-05
+       * changed signal for config file reloading to SIGUSR1
+       * mixer stuff, $mixer, $mixerl, $mixerr, $mixerbar, $mixerlbar,
+         $mixerrbar
+
+2004-06-03
+       * maybe fixed acpi battery thing when "present rate" isn't known
+
+2004-06-01
+       * fixed width for all bars, use like ${cpubar 4,50}
+
+2004-05-25
+       * Version 0.17 released
+
+2004-05-23
+       * battery number for ACPI battery (thanks Leszek Krupiñski)
+       * default battery is now BAT0 instead of BAT1, set ${battery 1} if
+         the old battery thing worked
+       * bug fix on load average reporting (thanks Leszek Krupiñski)
+       * outlines to text, draw_outline and default_outline_color
+         configurations and $outlinecolor (thanks adi)
+       * $acpifan, $acpiacadapter, $uptime_short (thanks adi)
+
+2004-05-19
+       * fixed a bug when starting after Opera (and some other programs)
+       * sticky window
+       * minimum_size
+
+2004-05-18
+       * added border_width configuration
+
+2004-05-16
+       * fixed zero length bar bug
+
+2004-05-15
+       * file system stats, $fs_bar, $fs_free, $fs_free_perc, $fs_size,
+         $fs_used
+       * leaves ACPI temperature file open (faster)
+       * -a option to change alignment on command line
+
+2004-05-14
+       * fixed ACPI temperature bug
+       * border_margin configuration
+       * ${execi <interval> <command>}, execute with specific interval
+       * added possibility to manually set the position (-x and -y options)
+         (thanks to Gwenhael LE MOINE)
+       * $buffers and $cached (thanks to Jeremy Burch)
+       * WM_CLASS when drawing to own window (thanks to Gwenhael LE MOINE)
+
+2004-05-14
+       * Version 0.16 released
+
+2004-05-13
+       * $pre_exec, execute a shell command one time
+       * preparsing of text (faster but more memory usage)
+       * less system calls (faster)
+       * APM things to $battery (untested)
+
+2004-05-12
+       * added $new_mails changed $mails to tell total mail count
+
+2004-05-11
+       * transparent window, own_window configuration, -o cmdline option
+       * $exec, execute a shell command
+       * $acpitemp, $battery - acpi stuff (not really tested)
+
+2004-05-10
+       * $loadavg, load average
+       * $mails, unread local mails, mail_spool configuration
+
+2004-05-09
+       * Version 0.15 released
+
+2004-05-06
+       * SIGHUP reloads config file (thanks Jørgen P. Tjernø)
+       * Some other stuff
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..f420f3e
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,184 @@
+Basic Installation
+==================
+
+   These are generic installation instructions.
+
+   NOTE: If you use Gentoo, see the README about using the included ebuild.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+   The file `configure.in' is used to create `configure' by a program
+called `autoconf'.  You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  You can give `configure'
+initial values for variables by setting them in the environment.  Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory.  After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on.  Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+     CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+   If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+     Use and save the results of the tests in FILE instead of
+     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
+     debugging `configure'.
+
+`--help'
+     Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--version'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..8086230
--- /dev/null
@@ -0,0 +1,61 @@
+bin_PROGRAMS = conky
+
+if BUILD_SETI
+seti = seti.c
+endif
+
+if BUILD_MPD
+mpd = mpd.c libmpdclient.c
+endif
+
+if BUILD_LINUX
+linux = linux.c
+endif
+
+if BUILD_SOLARIS
+solaris = solaris.c
+endif
+
+if BUILD_FREEBSD
+freebsd = freebsd.c
+endif
+
+if BUILD_NETBSD
+netbsd = netbsd.c
+endif
+
+if BUILD_CAIRO
+cairo = cairo.c
+endif
+
+if BUILD_METAR
+metar = ftp.c metarinfo.c
+METAR_LIBS = -lmetar
+endif
+
+if BUILD_MLDONKEY
+mldonkey = mldonkey.c
+endif
+
+conky_SOURCES = common.c fs.c top.c $(linux) mail.c mixer.c $(seti) $(mpd) \
+$(solaris) $(freebsd) $(netbsd) $(cairo) conky.c conky.h x11.c $(metar) $(mldonkey)
+
+conky_LDFLAGS = $(X11_LIBS) $(XFT_LIBS) $(CAIRO_LIBS)
+
+conky_LDADD = $(METAR_LIBS)
+
+man_MANS = conky.1
+
+LIBS = -lm -lpthread -lX11 -lXext
+
+if HAVE_HELP2MAN
+conky.1: conky conky.x
+       help2man -h -h -v -V -i conky.x -o conky.1 -N ./conky
+endif
+
+# conky.1 is in EXTRA_DIST in case that someone doesn't have help2man
+EXTRA_DIST = changelog.html conkyrc.sample conky.1 conky.x \
+             changelog2html.py app-admin/conky/conky-1.2.ebuild
+
+EXTRA_conky_SOURCES = seti.c linux.c solaris.c freebsd.c netbsd.c mpd.c libmpdclient.c \
+cairo.c libmpdclient.h top.h mldonkey.c ftp.c metarinfo.c ftp.h metarinfo.h
\ No newline at end of file
diff --git a/Makefile.in b/Makefile.in
new file mode 100644 (file)
index 0000000..a8e0834
--- /dev/null
@@ -0,0 +1,669 @@
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SOURCES = $(conky_SOURCES) $(EXTRA_conky_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = conky$(EXEEXT)
+subdir = .
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+       $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
+       TODO depcomp install-sh missing mkinstalldirs
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am__conky_SOURCES_DIST = common.c fs.c top.c linux.c mail.c mixer.c \
+       seti.c mpd.c libmpdclient.c solaris.c freebsd.c netbsd.c \
+       cairo.c conky.c conky.h x11.c ftp.c metarinfo.c mldonkey.c
+@BUILD_LINUX_TRUE@am__objects_1 = linux.$(OBJEXT)
+@BUILD_SETI_TRUE@am__objects_2 = seti.$(OBJEXT)
+@BUILD_MPD_TRUE@am__objects_3 = mpd.$(OBJEXT) libmpdclient.$(OBJEXT)
+@BUILD_SOLARIS_TRUE@am__objects_4 = solaris.$(OBJEXT)
+@BUILD_FREEBSD_TRUE@am__objects_5 = freebsd.$(OBJEXT)
+@BUILD_NETBSD_TRUE@am__objects_6 = netbsd.$(OBJEXT)
+@BUILD_CAIRO_TRUE@am__objects_7 = cairo.$(OBJEXT)
+@BUILD_METAR_TRUE@am__objects_8 = ftp.$(OBJEXT) metarinfo.$(OBJEXT)
+@BUILD_MLDONKEY_TRUE@am__objects_9 = mldonkey.$(OBJEXT)
+am_conky_OBJECTS = common.$(OBJEXT) fs.$(OBJEXT) top.$(OBJEXT) \
+       $(am__objects_1) mail.$(OBJEXT) mixer.$(OBJEXT) \
+       $(am__objects_2) $(am__objects_3) $(am__objects_4) \
+       $(am__objects_5) $(am__objects_6) $(am__objects_7) \
+       conky.$(OBJEXT) x11.$(OBJEXT) $(am__objects_8) \
+       $(am__objects_9)
+conky_OBJECTS = $(am_conky_OBJECTS)
+am__DEPENDENCIES_1 =
+conky_DEPENDENCIES = $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(conky_SOURCES) $(EXTRA_conky_SOURCES)
+DIST_SOURCES = $(am__conky_SOURCES_DIST) $(EXTRA_conky_SOURCES)
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man_MANS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  { test ! -d $(distdir) \
+    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CAIRO_FALSE = @BUILD_CAIRO_FALSE@
+BUILD_CAIRO_TRUE = @BUILD_CAIRO_TRUE@
+BUILD_FREEBSD_FALSE = @BUILD_FREEBSD_FALSE@
+BUILD_FREEBSD_TRUE = @BUILD_FREEBSD_TRUE@
+BUILD_LINUX_FALSE = @BUILD_LINUX_FALSE@
+BUILD_LINUX_TRUE = @BUILD_LINUX_TRUE@
+BUILD_METAR_FALSE = @BUILD_METAR_FALSE@
+BUILD_METAR_TRUE = @BUILD_METAR_TRUE@
+BUILD_MLDONKEY_FALSE = @BUILD_MLDONKEY_FALSE@
+BUILD_MLDONKEY_TRUE = @BUILD_MLDONKEY_TRUE@
+BUILD_MPD_FALSE = @BUILD_MPD_FALSE@
+BUILD_MPD_TRUE = @BUILD_MPD_TRUE@
+BUILD_NETBSD_FALSE = @BUILD_NETBSD_FALSE@
+BUILD_NETBSD_TRUE = @BUILD_NETBSD_TRUE@
+BUILD_SETI_FALSE = @BUILD_SETI_FALSE@
+BUILD_SETI_TRUE = @BUILD_SETI_TRUE@
+BUILD_SOLARIS_FALSE = @BUILD_SOLARIS_FALSE@
+BUILD_SOLARIS_TRUE = @BUILD_SOLARIS_TRUE@
+CAIROCONFIG = @CAIROCONFIG@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+HAVE_HELP2MAN_FALSE = @HAVE_HELP2MAN_FALSE@
+HAVE_HELP2MAN_TRUE = @HAVE_HELP2MAN_TRUE@
+HELP2MAN = @HELP2MAN@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = -lm -lpthread -lX11 -lXext
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+X11_LIBS = @X11_LIBS@
+XFTCONFIG = @XFTCONFIG@
+XFT_LIBS = @XFT_LIBS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+@BUILD_SETI_TRUE@seti = seti.c
+@BUILD_MPD_TRUE@mpd = mpd.c libmpdclient.c
+@BUILD_LINUX_TRUE@linux = linux.c
+@BUILD_SOLARIS_TRUE@solaris = solaris.c
+@BUILD_FREEBSD_TRUE@freebsd = freebsd.c
+@BUILD_NETBSD_TRUE@netbsd = netbsd.c
+@BUILD_CAIRO_TRUE@cairo = cairo.c
+@BUILD_METAR_TRUE@metar = ftp.c metarinfo.c
+@BUILD_METAR_TRUE@METAR_LIBS = -lmetar
+@BUILD_MLDONKEY_TRUE@mldonkey = mldonkey.c
+conky_SOURCES = common.c fs.c top.c $(linux) mail.c mixer.c $(seti) $(mpd) \
+$(solaris) $(freebsd) $(netbsd) $(cairo) conky.c conky.h x11.c $(metar) $(mldonkey)
+
+conky_LDFLAGS = $(X11_LIBS) $(XFT_LIBS) $(CAIRO_LIBS)
+conky_LDADD = $(METAR_LIBS)
+man_MANS = conky.1
+
+# conky.1 is in EXTRA_DIST in case that someone doesn't have help2man
+EXTRA_DIST = changelog.html conkyrc.sample conky.1 conky.x \
+             changelog2html.py app-admin/conky/conky-1.2.ebuild
+
+EXTRA_conky_SOURCES = seti.c linux.c solaris.c freebsd.c netbsd.c mpd.c libmpdclient.c \
+cairo.c libmpdclient.h top.h mldonkey.c ftp.c metarinfo.c ftp.h metarinfo.h
+
+all: config.h
+       $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+am--refresh:
+       @:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+             cd $(srcdir) && $(AUTOMAKE) --gnu  \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           echo ' $(SHELL) ./config.status'; \
+           $(SHELL) ./config.status;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+config.h: stamp-h1
+       @if test ! -f $@; then \
+         rm -f stamp-h1; \
+         $(MAKE) stamp-h1; \
+       else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+       @rm -f stamp-h1
+       cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in:  $(am__configure_deps) 
+       cd $(top_srcdir) && $(AUTOHEADER)
+       rm -f stamp-h1
+       touch $@
+
+distclean-hdr:
+       -rm -f config.h stamp-h1
+install-binPROGRAMS: $(bin_PROGRAMS)
+       @$(NORMAL_INSTALL)
+       test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         if test -f $$p \
+         ; then \
+           f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+          echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+         else :; fi; \
+       done
+
+uninstall-binPROGRAMS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+         echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+         rm -f "$(DESTDIR)$(bindir)/$$f"; \
+       done
+
+clean-binPROGRAMS:
+       -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+conky$(EXEEXT): $(conky_OBJECTS) $(conky_DEPENDENCIES) 
+       @rm -f conky$(EXEEXT)
+       $(LINK) $(conky_LDFLAGS) $(conky_OBJECTS) $(conky_LDADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conky.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/freebsd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmpdclient.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mail.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metarinfo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mixer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mldonkey.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netbsd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seti.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/solaris.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/top.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-man1: $(man1_MANS) $(man_MANS)
+       @$(NORMAL_INSTALL)
+       test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
+       @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+       l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+       for i in $$l2; do \
+         case "$$i" in \
+           *.1*) list="$$list $$i" ;; \
+         esac; \
+       done; \
+       for i in $$list; do \
+         if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+         else file=$$i; fi; \
+         ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+         case "$$ext" in \
+           1*) ;; \
+           *) ext='1' ;; \
+         esac; \
+         inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+         inst=`echo $$inst | sed -e 's/^.*\///'`; \
+         inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+         echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+         $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+       done
+uninstall-man1:
+       @$(NORMAL_UNINSTALL)
+       @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+       l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+       for i in $$l2; do \
+         case "$$i" in \
+           *.1*) list="$$list $$i" ;; \
+         esac; \
+       done; \
+       for i in $$list; do \
+         ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+         case "$$ext" in \
+           1*) ;; \
+           *) ext='1' ;; \
+         esac; \
+         inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+         inst=`echo $$inst | sed -e 's/^.*\///'`; \
+         inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+         echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+         rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+       done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       $(am__remove_distdir)
+       mkdir $(distdir)
+       $(mkdir_p) $(distdir)/app-admin/conky
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+       -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+         ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+         ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+         ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+       || chmod -R a+r $(distdir)
+dist-gzip: distdir
+       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       $(am__remove_distdir)
+
+dist-bzip2: distdir
+       tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+       $(am__remove_distdir)
+
+dist-tarZ: distdir
+       tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+       $(am__remove_distdir)
+
+dist-shar: distdir
+       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       $(am__remove_distdir)
+
+dist-zip: distdir
+       -rm -f $(distdir).zip
+       zip -rq $(distdir).zip $(distdir)
+       $(am__remove_distdir)
+
+dist dist-all: distdir
+       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+       case '$(DIST_ARCHIVES)' in \
+       *.tar.gz*) \
+         GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+       *.tar.bz2*) \
+         bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+       *.tar.Z*) \
+         uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+       *.shar.gz*) \
+         GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+       *.zip*) \
+         unzip $(distdir).zip ;;\
+       esac
+       chmod -R a-w $(distdir); chmod a+w $(distdir)
+       mkdir $(distdir)/_build
+       mkdir $(distdir)/_inst
+       chmod a-w $(distdir)
+       dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+         && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+         && cd $(distdir)/_build \
+         && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+           $(DISTCHECK_CONFIGURE_FLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) dvi \
+         && $(MAKE) $(AM_MAKEFLAGS) check \
+         && $(MAKE) $(AM_MAKEFLAGS) install \
+         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+         && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+         && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+               distuninstallcheck \
+         && chmod -R a-w "$$dc_install_base" \
+         && ({ \
+              (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+                   distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+             } || { rm -rf "$$dc_destdir"; exit 1; }) \
+         && rm -rf "$$dc_destdir" \
+         && $(MAKE) $(AM_MAKEFLAGS) dist \
+         && rm -rf $(DIST_ARCHIVES) \
+         && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+       $(am__remove_distdir)
+       @(echo "$(distdir) archives ready for distribution: "; \
+         list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+         sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+       @cd $(distuninstallcheck_dir) \
+       && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+          || { echo "ERROR: files left after uninstall:" ; \
+               if test -n "$(DESTDIR)"; then \
+                 echo "  (check DESTDIR support)"; \
+               fi ; \
+               $(distuninstallcheck_listfiles) ; \
+               exit 1; } >&2
+distcleancheck: distclean
+       @if test '$(srcdir)' = . ; then \
+         echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+         exit 1 ; \
+       fi
+       @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+         || { echo "ERROR: files left in build directory after distclean:" ; \
+              $(distcleancheck_listfiles) ; \
+              exit 1; } >&2
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(MANS) config.h
+installdirs:
+       for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-hdr distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man: install-man1
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -rf $(top_srcdir)/autom4te.cache
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man
+
+uninstall-man: uninstall-man1
+
+.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
+       clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \
+       dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \
+       distclean-compile distclean-generic distclean-hdr \
+       distclean-tags distcleancheck distdir distuninstallcheck dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-binPROGRAMS install-data install-data-am install-exec \
+       install-exec-am install-info install-info-am install-man \
+       install-man1 install-strip installcheck installcheck-am \
+       installdirs maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
+       ps ps-am tags uninstall uninstall-am uninstall-binPROGRAMS \
+       uninstall-info-am uninstall-man uninstall-man1
+
+
+@HAVE_HELP2MAN_TRUE@conky.1: conky conky.x
+@HAVE_HELP2MAN_TRUE@   help2man -h -h -v -V -i conky.x -o conky.1 -N ./conky
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..027da00
--- /dev/null
+++ b/README
@@ -0,0 +1,316 @@
+  Conky (http://conky.rty.ca)
+
+  WHAT IS CONKY?
+
+   Conky is a system monitor for Linux that sits in the corner of your
+   desktop. Conky renders itself on the root window (on the desktop) or to
+   its own transparent window any special eyecandy.
+   Conky can show lots of info about your system, including:
+
+     * kernel version
+     * uptime
+     * network interface information
+     * memory and swap usage
+     * hostname
+     * machine, i686 for example
+     * system name, Linux for example
+     * temperatures from i2c-sensors
+
+  THINGS YOU SHOULD KNOW
+
+   Conky is generally very good on resources.  However, certain objects in
+   Conky are harder on resources then others.  In particular, the $tail and
+   $top objects are quite costly in comparison to the rest of Conky.
+   If you do use them, please do not complain about memory or CPU usage,
+   because you will simply be ignored.
+   
+   With that out of the way, if you have a better way of doing something,
+   please submit a patch for Conky.  I know I am certainly not the world's
+   best programmer, and I still have a lot to learn.
+
+  COMPILING
+
+   To compile and run Conky with all optional components (If you run Gentoo, see the "Ebuild" Section below):
+
+         ./configure --prefix=/usr --enable-xft --enable-mpd --enable-seti --enable-double-buffer --enable-own-window --enable-proc-uptime 
+         make
+         ./conky
+
+   Conky doesn't probably compile with other compilers than gcc and icc. It
+   doesn't compile with C89 compiler and not even with pure C99. It uses few
+   things that might not exist: strdup(), strcasecmp(), strncasecmp(), optarg
+   variable with getopt() and long long (not in C89). Crashes in file system
+   statistics stuff when compiled with icc, I don't know exactly why.
+
+   You can disable 'drawing to own window' feature in case you don't need it
+   by passing --disable-own-window to configure -script.
+
+  EBUILD
+
+   Conky is in Gentoo's Portage.  Simply use "emerge conky" to install conky.
+
+  CONFIGURING
+
+   Default configuration file is $HOME/.conkyrc (can be changed from
+   conky.c among other things). See conkyrc.sample. You might want to copy
+   it to $HOME/.conkyrc and then start modifying it.
+
+    Configuration file confs
+
+           Conf                                Meaning                        
+   alignment             Aligned position on screen, may be top_left,         
+                         top_right, bottom_left, bottom_right                 
+   background            Boolean value, if true, Conky will be forked to     
+                         background when started                              
+   border_margin         Border margin in pixels                              
+   border_width          Border width in pixels                               
+   cpu_avg_samples       The number of samples to average for CPU monitoring
+   default_color         Default color and border color                       
+   default_shade_color   Default shading color and border's shading color     
+   default_outline_color Default outline color                                
+                         Use the Xdbe extension? (eliminates flicker) It is   
+   double_buffer         highly recommended to use own window with this one   
+                         so double buffer won't be so big.                    
+   draw_borders          Draw borders around text?                            
+   draw_shades           Draw shades?                                         
+   draw_outline          Draw outlines?                                       
+   font                  Font name in X, xfontsel can be used to get a nice   
+                         font                                                 
+   gap_x                 Gap between right or left border of screen           
+   gap_y                 Gap between top or bottom border of screen           
+   no_buffers            Substract (file system) buffers from used memory?    
+   mail_spool            Mail spool for mail checking                         
+   metar_station         METAR station code for weather, see
+                         http://www.wrh.noaa.gov/ if you need to find
+                        your code.
+   metar_server          Define a custom METAR ftp server
+   metar_path            Path on server to use
+   minimum_size          Minimum size of window                               
+   mldonkey_hostname     Hostname for mldonkey stuff, defaults to localhost
+   mldonkey_port         Mldonkey port, 4001 default
+   mldonkey_login        Mldonkey login, default none
+   mldonkey_password     Mldonkey password, default none
+   net_avg_samples       The number of samples to average for net data
+   own_window            Boolean, create own window to draw?                  
+   pad_percents          Pad percentages to this many decimals (0 = no        
+                         padding)                                             
+   stippled_borders      Border stippling (dashing) in pixels                 
+   top_sort_cpu          Set to yes to sort top output by cpu
+                         set to no to sort by mem usage
+   total_run_times       Total number of times for Conky to update before
+                         quitting.  Zero makes Conky run forever
+   update_interval       Update interval in seconds                           
+   uppercase             Boolean value, if true, text is rendered in upper    
+                         case                                                 
+   use_spacer            Adds spaces after certain objects to stop them
+                         from moving other things around.  Note that
+                        this only helps if you are using a mono font,
+                        such as Bitstream Vera Sans Mono.
+   use_xft               Use Xft (anti-aliased font and stuff)                
+   text                  After this begins text to be formatted on screen     
+
+   Boolean variable without value in text means yes. Value may be also yes,
+   true or any negative or positive integer meaning yes. No, false or zero
+   meaning no.
+   There may be some variables in text. Variable is given either in format
+   $variable or in ${variable}. Latter allows characters right after the
+   variable and must be used in some stuff because of arguments.
+
+    Command line options
+
+     Argument                          Description                        
+   -V           Prints version and exits                                  
+   -a ALIGNMENT Text alignment on screen, {top,bottom}_{left,right}       
+   -b           Use double buffering (eliminates flicker)                 
+   -c FILE      Config file to load instead of $HOME/.conkyrc            
+   -d           Daemonize, fork to background                             
+   -f FONT      Font to use                                               
+   -h           Prints command line help and exits                        
+   -o           Create own window to draw                                 
+   -t TEXT      Text to render, remember single quotes, like -t '$uptime' 
+   -u SECS      Update interval                                           
+   -w WIN_ID    Window id to draw                                         
+   -x X         X position                                                
+   -y Y         Y position                                                
+
+   Command line options override configurations defined in configuration
+   file.
+
+    Variables in text
+
+       Variable          Arguments                   Description              
+
+  addr              (interface)     IP address for an interface
+  acpiacadapter                     ACPI ac adapter state.                   
+  acpifan                           ACPI fan state                           
+  acpitemp                          ACPI temperature.                        
+  adt746xcpu                        CPU temperature from therm_adt746x       
+  adt746xfan                        Fan speed from therm_adt746x             
+  alignr            (num)           Right-justify text, with space of N
+  alignc                            Align text to centre
+  battery           (num)           Remaining capasity in ACPI or APM        
+                                    battery. ACPI battery number can be      
+                                    given as argument (default is BAT0).     
+  buffers                           Amount of memory buffered                
+  cached                            Amount of memory cached                  
+  color             (color)         Change drawing color to color            
+  cpu                               CPU usage in percents                    
+  cpubar            (height)        Bar that shows CPU usage, height is      
+                                    bar's height in pixels                   
+  downspeed         net             Download speed in kilobytes              
+  downspeedf        net             Download speed in kilobytes with one     
+                                    decimal                                  
+  exec              shell command   Executes a shell command and displays    
+                                    the output in conky. warning: this      
+                                    takes a lot more resources than other    
+                                    variables. I'd recommend coding wanted   
+                                    behaviour in C and posting a patch :-).  
+  execbar           shell command   Same as exec, except if the first value
+                                    return is a value between 0-100, it
+                                    will use that number for a bar.
+                                    The size for the bar is currently fixed,
+                                    but that may change in the future.
+  execi             interval, shell Same as exec but with specific interval. 
+                    command         Interval can't be less than              
+                                    update_interval in configuration.        
+  fs_bar            (height), (fs)  Bar that shows how much space is used on 
+                                    a file system. height is the height in   
+                                    pixels. fs is any file on that file      
+                                    system.                                  
+  fs_free           (fs)            Free space on a file system available    
+                                    for users.                               
+  fs_free_perc      (fs)            Free percentage of space on a file       
+                                    system available for users.              
+  fs_size           (fs)            File system size                         
+  fs_used           (fs)            File system used space                   
+  hr                (height)        Horizontal line, height is the height in 
+                                    pixels                                   
+  i2c               (dev), type, n  I2C sensor from sysfs (Linux 2.6). dev   
+                                    may be omitted if you have only one I2C  
+                                    device. type is either in (or vol)       
+                                    meaning voltage, fan meaning fan or
+                                   temp/tempf (first in C, second in F)
+                                    meaning temperature. n is number of the  
+                                    sensor. See /sys/bus/i2c/devices/ on     
+                                    your local computer.                     
+  if_running        (process)       if PROCESS is running, display
+                                    everything if_running and the matching $endif
+  if_existing       (file)          if FILE exists, display everything between
+                                    if_existing and the matching $endif
+  if_mounted        (mountpoint)    if MOUNTPOINT is mounted, display everything between
+                                    if_mounted and the matching $endif
+  else                              Text to show if any of the above are not true
+  kernel                            Kernel version                          
+  linkstatus        (interface)     Get the link status for wireless connections
+  loadavg           (1), (2), (3)   System load average, 1 is for past 1     
+                                    minute, 2 for past 5 minutes and 3 for   
+                                    past 15 minutes.                         
+  machine                           Machine, i686 for example                
+  mails                             Mail count in mail spool. You can use    
+                                    program like fetchmail to get mails from 
+                                    some server using your favourite         
+                                    protocol. See also new_mails.            
+  mem                               Amount of memory in use                  
+  membar            (height)        Bar that shows amount of memory in use   
+  memmax                            Total amount of memory                   
+  memperc                           Percentage of memory in use
+  
+  metar_ob_time
+  metar_temp
+  metar_tempf                      Temp in F
+  metar_windchill
+  metar_dew_point                   There are a bunch of these
+  metar_rh                          and they are self-explanatory
+  metar_windspeed
+  metar_winddir
+  metar_swinddir
+  metar_cloud
+  metar_u2d_time
+
+  ml_upload_counter                 total session upload in mb
+  ml_download_counter               total session download in mb
+  ml_nshared_files                  number of shared files
+  ml_shared_counter                 total session shared in mb, buggy
+                                    in some mldonkey versions
+  ml_tcp_upload_rate                tcp upload rate in kb/s
+  ml_tcp_download_rate              tcp download rate in kb/s
+  ml_udp_upload_rate                udp upload rate in kb/s
+  ml_udp_download_rate              udp download rate in kb/s
+  ml_ndownloaded_files              number of completed files
+  ml_ndownloading_files             number of downloading files
+  
+  mpd_artist                       Artist in current MPD song
+                                    (must be enabled at compile)
+  mpd_album                        Album in current MPD song
+  mpd_bar           (height)        Bar of mpd's progress
+  mpd_bitrate                       Bitrate of current song
+  mpd_status                        Playing, stopped, et cetera.
+  mpd_title                        Title of current MPD song
+  mpd_vol                          MPD's volume
+  new_mails                         Unread mail count in mail spool.         
+  nodename                          Hostname                                 
+  outlinecolor      (color)         Change outline color                     
+  pre_exec          shell command   Executes a shell command one time before 
+                                    conky displays anything and puts output 
+                                    as text.                                 
+  processes                         Total processes (sleeping and running)   
+  running_processes                 Running processes (not sleeping),        
+                                    requires Linux 2.6                       
+  shadecolor        (color)         Change shading color                     
+  stippled_hr       (space),        Stippled (dashed) horizontal line        
+                    (height)        
+  swapbar           (height)        Bar that shows amount of swap in use     
+  swap                              Amount of swap in use                    
+  swapmax                           Total amount of swap                     
+  swapperc                          Percentage of swap in use                
+  sysname                           System name, Linux for example           
+  tail              logfile, lines (interval)
+                                    Displays last N lines of supplied text
+                                    text file.  If interval is not supplied,
+                                    Conky assumes 2x Conky's interval.
+                                    Max of 30 lines.
+                                    Max of 30 lines can be displayed.
+  time              (format)        Local time, see man strftime to get more 
+                                    information about format                 
+  totaldown         net             Total download, overflows at 4 GB on     
+                                    Linux with 32-bit arch and there doesn't 
+                                    seem to be a way to know how many times  
+                                    it has already done that before conky   
+                                    has started.                            
+  top               type, num      This takes arguments in the form:
+                                    top <name> <number>
+                                    Basically, processes are ranked from 
+                                    highest to lowest in terms of cpu
+                                    usage, which is what <num> represents.
+                                    The types are: "name", "pid", "cpu", and
+                                    "mem".
+                                    There can be a max of 10 processes listed.
+  totalup           net             Total upload, this one too, may overflow 
+  updates                           Number of updates (for debugging)        
+  upspeed           net             Upload speed in kilobytes                
+  upspeedf          net             Upload speed in kilobytes with one       
+                                    decimal                                  
+  uptime                            Uptime                                   
+  uptime_short                      Uptime in a shorter format               
+
+  seti_prog                         Seti@home current progress
+  seti_progbar      (height)        Seti@home current progress bar
+  seti_credit                       Seti@hoome total user credit
+
+
+   colors are parsed using XParsecolor(), there might be a list of them:
+   /usr/X11R6/lib/X11/rgb.txt. color can be also in #rrggbb format (hex).
+
+   Note that when displaying bytes, power is 1024 and not 1000 so 1M really
+   means 1024*1024 bytes and not 1000*1000.
+
+  KNOWN PROBLEMS
+
+   Drawing to root or some other desktop window directly doesn't work with
+   all window managers. Especially doesn't work well with Gnome and it has
+   been reported that it doesn't work with KDE either. Nautilus can be
+   disabled from drawing to desktop with program gconf-editor. Uncheck
+   show_desktop in /apps/nautilus/preferences/. There is -w switch in Conky
+   to set some specific window id. You might find xwininfo -tree useful to
+   find the window to draw to. You can also use -o argument which makes
+   Conky to create its own window.
diff --git a/TODO b/TODO
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644 (file)
index 0000000..74de4a1
--- /dev/null
@@ -0,0 +1,862 @@
+# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005  Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+        [AM_AUTOMAKE_VERSION([1.9.5])])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 7
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`AS_DIRNAME("$mf")`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`AS_DIRNAME(["$file"])`
+    AS_MKDIR_P([$dirpart/$fdir])
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+                            [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                  [_AM_DEPENDENCIES(CC)],
+                  [define([AC_PROG_CC],
+                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                  [_AM_DEPENDENCIES(CXX)],
+                  [define([AC_PROG_CXX],
+                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $1 | $1:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes.                 -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+#
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake.  There are at least two reasons why we must not
+# use `-m 0755':
+#   - it causes special bits like SGID to be ignored,
+#   - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out.  Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
diff --git a/app-admin/conky/conky-1.2.ebuild b/app-admin/conky/conky-1.2.ebuild
new file mode 100755 (executable)
index 0000000..c1d23ce
--- /dev/null
@@ -0,0 +1,65 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header$
+
+inherit eutils
+
+DESCRIPTION="minimalist system monitor for X based on torsmo"
+HOMEPAGE="http://conky.rty.ca"
+SRC_URI="http://conky.rty.ca/${P}.tar.bz2"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+IUSE="truetype seti metar"
+
+RDEPEND="virtual/libc
+       virtual/x11
+       truetype? ( >=media-libs/freetype-2 )
+       seti? ( sci-astronomy/setiathome )
+       metar? ( dev-libs/mdsplib )"
+
+DEPEND="truetype? ( >=media-libs/freetype-2 )
+       virtual/x11
+       >=sys-devel/automake-1.4
+       sys-devel/autoconf
+       sys-apps/grep
+       sys-apps/sed
+       sys-devel/gcc
+       >=sys-process/procps-3.2.5
+       "
+
+
+src_compile() {
+       local myconf
+       myconf="--enable-double-buffer --enable-own-window --enable-proc-uptime
+       --enable-mpd"
+       econf \
+          ${myconf} \
+          $(use_enable truetype xft) \
+          $(use_enable metar) \
+          $(use_enable seti) || die "econf failed"
+       emake || die "compile failed"
+}
+
+src_install() {
+       emake DESTDIR=${D} install || die "make install failed"
+       dodoc ChangeLog AUTHORS README conkyrc.sample
+}
+
+pkg_postinst() {
+       einfo 'default configuration file is "~/.conkyrc"'
+       einfo "you can find a sample configuration file in"
+       einfo "/usr/share/doc/${PF}/conkyrc.sample.gz"
+       einfo
+       einfo "For more info on Conky's new features,"
+       einfo "please look at the README and ChangeLog:"
+       einfo "/usr/share/doc/${PF}/README.gz"
+       einfo "/usr/share/doc/${PF}/ChangeLog.gz"
+       einfo
+       einfo "Comment out temperature info lines if you have no kernel"
+       einfo "support for it."
+       einfo
+       ewarn "Conky doesn't work with window managers that"
+       ewarn "take control over root window such as Gnome's nautilus."
+}
diff --git a/cairo.c b/cairo.c
new file mode 100644 (file)
index 0000000..ce05e5d
--- /dev/null
+++ b/cairo.c
@@ -0,0 +1,230 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
+/* Small example demonstrating emulating knockout-groups as in PDF-1.4
+ * using cairo_set_operator().
+ *
+ * Owen Taylor,
+
+ * v0.1  30 November  2002
+ * v0.2   1 December  2002 - typo fixes from Keith Packard
+ * v0.3  17 April     2003 - Tracking changes in Xr, (Removal of Xr{Push,Pop}Group)
+ * v0.4  29 September 2003 - Use cairo_rectangle rather than private rect_path
+ *                          Use cairo_arc for oval_path
+ * Keeping log of changes in ChangeLog/CVS now. (2003-11-19) Carl Worth
+ */
+#include "conky.h"
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <cairo.h>
+#include <cairo-xlib.h>
+#include <math.h>
+#include <stdio.h>
+
+/* Fill the given area with checks in the standard style
+ * for showing compositing effects.
+ */
+static void
+               fill_checks (cairo_t *cr,
+                            int x,     int y,
+                            int width, int height)
+{
+       cairo_surface_t *check;
+       cairo_pattern_t *check_pattern;
+    
+       cairo_save (cr);
+
+#define CHECK_SIZE 32
+
+    check = cairo_surface_create_similar (cairo_current_target_surface (cr),
+                                         CAIRO_FORMAT_RGB24,
+                                         2 * CHECK_SIZE, 2 * CHECK_SIZE);
+    cairo_surface_set_repeat (check, 1);
+
+    /* Draw the check */
+    {
+           cairo_save (cr);
+
+           cairo_set_target_surface (cr, check);
+
+           cairo_set_operator (cr, CAIRO_OPERATOR_SRC);
+
+           cairo_set_rgb_color (cr, 0.4, 0.4, 0.4);
+
+           cairo_rectangle (cr, 0, 0, 2 * CHECK_SIZE, 2 * CHECK_SIZE);
+           cairo_fill (cr);
+
+           cairo_set_rgb_color (cr, 0.7, 0.7, 0.7);
+
+           cairo_rectangle (cr, x, y, CHECK_SIZE, CHECK_SIZE);
+           cairo_fill (cr);
+           cairo_rectangle (cr, x + CHECK_SIZE, y + CHECK_SIZE, CHECK_SIZE, CHECK_SIZE);
+           cairo_fill (cr);
+
+           cairo_restore (cr);
+    }
+
+    /* Fill the whole surface with the check */
+
+    check_pattern = cairo_pattern_create_for_surface (check);
+    cairo_set_pattern (cr, check_pattern);
+    cairo_rectangle (cr, 0, 0, width, height);
+    cairo_fill (cr);
+
+    cairo_pattern_destroy (check_pattern);
+    cairo_surface_destroy (check);
+
+    cairo_restore (cr);
+}
+
+static void draw_pee (cairo_t *cr, double xc, double yc)
+{
+       cairo_set_rgb_color (cr, 0, 0, 0);
+       cairo_show_text (cr, "Conky");
+}
+
+static void
+               draw (cairo_t *cr,
+                     int      width,
+                     int      height)
+{
+       cairo_surface_t *overlay;
+
+       /* Fill the background */
+       double xc = width / 2.;
+       double yc = height / 2.;
+
+       overlay = cairo_surface_create_similar (cairo_current_target_surface (cr),
+                       CAIRO_FORMAT_ARGB32,
+                       width, height);
+       if (overlay == NULL)
+               return;
+
+       fill_checks (cr, 0, 0, width, height);
+
+       cairo_save (cr);
+       cairo_set_target_surface (cr, overlay);
+
+       cairo_set_alpha (cr, 0.5);
+       cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+       draw_pee (cr, xc, yc);
+
+       cairo_restore (cr);
+
+       cairo_show_surface (cr, overlay, width, height);
+
+       cairo_surface_destroy (overlay);
+}
+
+int
+               do_it (void)
+{
+       Display *dpy;
+       int screen;
+       Window w;
+       Pixmap pixmap;
+       char *title = "cairo: Knockout Groups";
+       unsigned int quit_keycode;
+       int needs_redraw;
+       GC gc;
+       XWMHints *wmhints;
+       XSizeHints *normalhints;
+       XClassHint *classhint;
+  
+       int width = 400;
+       int height = 400;
+  
+       dpy = XOpenDisplay (NULL);
+       screen = DefaultScreen (dpy);
+
+       w = XCreateSimpleWindow (dpy, RootWindow (dpy, screen),
+                                0, 0, width, height, 0,
+                                BlackPixel (dpy, screen), WhitePixel (dpy, screen));
+
+       normalhints = XAllocSizeHints ();
+       normalhints->flags = 0;
+       normalhints->x = 0;
+       normalhints->y = 0;
+       normalhints->width = width;
+       normalhints->height = height;
+
+       classhint = XAllocClassHint ();
+       classhint->res_name = "cairo-knockout";
+       classhint->res_class = "Cairo-knockout";
+    
+       wmhints = XAllocWMHints ();
+       wmhints->flags = InputHint;
+       wmhints->input = True;
+    
+       XmbSetWMProperties (dpy, w, title, "cairo-knockout", 0, 0, 
+                           normalhints, wmhints, classhint);
+       XFree (wmhints);
+       XFree (classhint);
+       XFree (normalhints);
+
+       pixmap = XCreatePixmap (dpy, w, width, height, DefaultDepth (dpy, screen));
+       gc = XCreateGC (dpy, pixmap, 0, NULL);
+
+       quit_keycode = XKeysymToKeycode(dpy, XStringToKeysym("Q"));
+
+       XSelectInput (dpy, w, ExposureMask | StructureNotifyMask | ButtonPressMask | KeyPressMask);
+       XMapWindow (dpy, w);
+  
+       needs_redraw = 1;
+
+       while (1) {
+               XEvent xev;
+
+      /* Only do the redraw if there are no events pending.  This
+               * avoids us getting behind doing several redraws for several
+               * consecutive resize events for example.
+      */
+               if (!XPending (dpy) && needs_redraw) {
+                       cairo_t *cr = cairo_create ();
+
+                       cairo_set_target_drawable (cr, dpy, pixmap);
+
+                       draw (cr, width, height);
+
+                       cairo_destroy (cr);
+
+                       XCopyArea (dpy, pixmap, w, gc,
+                                  0, 0,
+                                  width, height,
+                                  0, 0);
+
+                       needs_redraw = 0;
+               }
+      
+               XNextEvent (dpy, &xev);
+
+               switch (xev.xany.type) {
+                       case ButtonPress:
+                               /* A click on the canvas ends the program */
+                               goto DONE;
+                       case KeyPress:
+                               if (xev.xkey.keycode == quit_keycode)
+                                       goto DONE;
+                               break;
+                       case ConfigureNotify:
+                               /* Note new size and create new pixmap. */
+                               width = xev.xconfigure.width;
+                               height = xev.xconfigure.height;
+                               XFreePixmap (dpy, pixmap);
+                               pixmap = XCreatePixmap (dpy, w, width, height, DefaultDepth (dpy, screen));
+                               needs_redraw = 1;
+                               break;
+                       case Expose:
+                               XCopyArea (dpy, pixmap, w, gc,
+                                          xev.xexpose.x, xev.xexpose.y,
+                                          xev.xexpose.width, xev.xexpose.height,
+                                          xev.xexpose.x, xev.xexpose.y);
+                               break;
+               }
+       }
+  DONE:
+
+                 XFreeGC (dpy, gc);
+  XCloseDisplay (dpy);
+
+  return 0;
+}
diff --git a/changelog.html b/changelog.html
new file mode 100644 (file)
index 0000000..ac5130f
--- /dev/null
@@ -0,0 +1,351 @@
+<H3>2005-07-17</H3>
+<UL>
+  <LI>Fixed a pile of bugs in configure script
+  <LI>Added proper checking for headers in configure script
+  <LI>Made METAR shit threaded so it would stop being retarded, also made
+      it try more then once to update
+  <LI>Added $metar_temp_f and ${i2c tempf} for americans
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2005-07-16</H3>
+<UL>
+  <LI>Added option for Conky to update N times and quit, see
+      total_run_times in conkyrc.sample
+  <LI>Added metar code for weather info, thanks to somebody on sf.net
+  <LI>Added $alignr and $alignc for right and centre alignment
+  <LI>Added wireless info and IP addr patch, thanks Bobby Beckmann,
+      options $addr and $linkstatus (please test!), as well as fixed a mem
+      leak in this patch
+  <LI>adt746x fix, thanks to dan-h on sf.net
+  <LI>Added mldonkey support patch, thanks Lucas Brutschy on sf.net
+  <LI>Added patch to allow hex colour values, thanks roiban adi on sf.net
+  <LI>Added if constructs patch, thanks Lucas Brutschy on sf.net
+  <LI>Fixed bug in tab code (hopefully for the last time)
+  <LI>Added option to sort by cpu or memory for top, see top_sort_cpu
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2005-07-12</H3>
+<UL>
+  <LI>Added fix for battery charged state (thanks to Lukas Zapletal
+      <lzap@seznam.cz>)
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2005-07-05</H3>
+<UL>
+  <LI>Conky 1.1 released
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2005-07-03</H3>
+<UL>
+  <LI>Added $mpd_bar and $mpd_bitrate
+  <LI>Some minor code cleanups prior to release
+  <LI>Fixed problem with Conky not compiling when XFT disabled
+  <LI>Fixed configure.in problems with Xdbe
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2005-07-01</H3>
+<UL>
+  <LI>Fixed memory leak in MPD code
+  <LI>Added new $tail object (see conkyrc.sample) which loves to suck CPU
+      and memory
+  <LI>Fixed more mem leaks
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2005-06-30</H3>
+<UL>
+  <LI>Added use_spacer to config
+  <LI>Added $mpd_status
+  <LI>Added small fix for i2c from Filedil on forums.gentoo.org
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2005-06-28</H3>
+<UL>
+  <LI>Made it possible to use tabs to right-justify (just add a bunch)
+  <LI>Added ${execbar} (see conkyrc.sample)
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2005-06-26</H3>
+<UL>
+  <LI>Added memory % to top output
+  <LI>Added initial cairo backend (it's really quite useless at this stage actually, and I'm not sure if there is even any point to it)
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2005-06-25</H3>
+<UL>
+  <LI>Conky now recognizes the tab character correctly
+  <LI>Added simple config option to print to stdout (out_to_console
+      <yes/no>)
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2005-06-23</H3>
+<UL>
+  <LI>Added top output.  Check the sample config.
+  <LI>Cleaned up code.
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2005-06-22</H3>
+<UL>
+  <LI>Finished MPD support ($mpd_title, $mpd_artist, $mpd_album, $mpd_vol)
+  <LI>Removed NVCtrl code
+  <LI>Added noswap and i2c patches
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2005-06-21</H3>
+<UL>
+  <LI>Version 1.0. Conky is born from the ashes of torsmo. Main site: http://conky.rty.ca/
+  <LI>Added xwin patch
+  <LI>Added new feature for sample averaging of CPU and net info
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-12-22</H3>
+<UL>
+  <LI>Version 0.18 released
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-12-21</H3>
+<UL>
+  <LI>Fixed some double buffer + Xft stuff
+  <LI>Applied X-Mozilla-Status patch (thanks affinity)
+  <LI>Applied NVCtrl patch and modified it a bit (temperature monitoring
+      for nvdia-based graphics cards) (I couldn't test this so it may or
+      may not work or even compile) (thanks Dennis Frommknecht)
+  <LI>Applied fs_used_perc and fs_bar_free patch (thanks killfire [send me
+      mail, I didn't catch your name from sourceforge])
+  <LI>Applied patch that supports mailbox that is in some 'maildir' format
+      (thanks jolapache [send mail, I didn't catch your name from
+      sourceforge])
+  <LI>min -&gt; m
+  <LI>Applied pad_percents patch (thanks JL Farinacci)
+  <LI>Fixed some stuff in acpi fan and acpi ac adapter
+  <LI>Optional XFT even when compiled in
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-11-30</H3>
+<UL>
+  <LI>Applied utime patch (UTC time) (thanks David McCabe)
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-11-29</H3>
+<UL>
+  <LI>Applied Xdbe patch, this includes double_buffer configuration and
+      -b command line option (thanks Bruce Merry)
+  <LI>Applied some other seti patch, not tested (thanks William DiPlacido)
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-08-25</H3>
+<UL>
+  <LI>Applied netbsd patch (thanks Rui Paulo)
+  <LI>Applied cpu frequency patch (thanks William DiPlacido)
+  <LI>Applied adt746x patch (thanks Dennis Kaandorp)
+  <LI>Applied some other FreeBSD patch by the same guy
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-07-31</H3>
+<UL>
+  <LI>Applied FreeBSD patch (thanks Roman Bogorodskiy)
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-07-25</H3>
+<UL>
+  <LI>Xft support and xftfont configuration
+  <LI>rewrote some stuff, there might be some new bugs in old places
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-07-24</H3>
+<UL>
+  <LI>I2C divisor from a file (thanks Falk Feuersenger)
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-07-20</H3>
+<UL>
+  <LI>changed battery thing to ${battery &lt;filename in
+      /proc/acpi/battery/>}
+  <LI>SETI@Home stuff (thanks Jarski)
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-07-05</H3>
+<UL>
+  <LI>changed signal for config file reloading to SIGUSR1
+  <LI>mixer stuff, $mixer, $mixerl, $mixerr, $mixerbar, $mixerlbar,
+      $mixerrbar
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-06-03</H3>
+<UL>
+  <LI>maybe fixed acpi battery thing when "present rate" isn't known
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-06-01</H3>
+<UL>
+  <LI>fixed width for all bars, use like ${cpubar 4,50}
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-05-25</H3>
+<UL>
+  <LI>Version 0.17 released
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-05-23</H3>
+<UL>
+  <LI>battery number for ACPI battery (thanks Leszek Krupiñski)
+  <LI>default battery is now BAT0 instead of BAT1, set ${battery 1} if
+      the old battery thing worked
+  <LI>bug fix on load average reporting (thanks Leszek Krupiñski)
+  <LI>outlines to text, draw_outline and default_outline_color
+      configurations and $outlinecolor (thanks adi)
+  <LI>$acpifan, $acpiacadapter, $uptime_short (thanks adi)
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-05-19</H3>
+<UL>
+  <LI>fixed a bug when starting after Opera (and some other programs)
+  <LI>sticky window
+  <LI>minimum_size
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-05-18</H3>
+<UL>
+  <LI>added border_width configuration
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-05-16</H3>
+<UL>
+  <LI>fixed zero length bar bug
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-05-15</H3>
+<UL>
+  <LI>file system stats, $fs_bar, $fs_free, $fs_free_perc, $fs_size,
+      $fs_used
+  <LI>leaves ACPI temperature file open (faster)
+  <LI>-a option to change alignment on command line
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-05-14</H3>
+<UL>
+  <LI>fixed ACPI temperature bug
+  <LI>border_margin configuration
+  <LI>${execi &lt;interval&gt; &lt;command&gt;}, execute with specific interval
+  <LI>added possibility to manually set the position (-x and -y options)
+      (thanks to Gwenhael LE MOINE)
+  <LI>$buffers and $cached (thanks to Jeremy Burch)
+  <LI>WM_CLASS when drawing to own window (thanks to Gwenhael LE MOINE)
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-05-14</H3>
+<UL>
+  <LI>Version 0.16 released
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-05-13</H3>
+<UL>
+  <LI>$pre_exec, execute a shell command one time
+  <LI>preparsing of text (faster but more memory usage)
+  <LI>less system calls (faster)
+  <LI>APM things to $battery (untested)
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-05-12</H3>
+<UL>
+  <LI>added $new_mails changed $mails to tell total mail count
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-05-11</H3>
+<UL>
+  <LI>transparent window, own_window configuration, -o cmdline option
+  <LI>$exec, execute a shell command
+  <LI>$acpitemp, $battery - acpi stuff (not really tested)
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-05-10</H3>
+<UL>
+  <LI>$loadavg, load average
+  <LI>$mails, unread local mails, mail_spool configuration
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-05-09</H3>
+<UL>
+  <LI>Version 0.15 released
+</UL>
+<H3></H3>
+<UL>
+</UL>
+<H3>2004-05-06</H3>
+<UL>
+  <LI>SIGHUP reloads config file (thanks Jørgen P. Tjernø)
+  <LI>Some other stuff
+</UL>
diff --git a/changelog2html.py b/changelog2html.py
new file mode 100644 (file)
index 0000000..31df336
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+import sys
+
+if len(sys.argv) <= 1:
+  print >> sys.stderr, "Usage: ./changelog2html.py [changelog file]"
+  sys.exit(1)
+
+f = sys.argv[1]
+
+blah = 0
+
+for i in open(f).read().splitlines():
+  # ignore empty lines
+
+  if i and i[0].isspace():
+    if not '*' in i:
+      print '      ' + i.strip()
+    else:
+      s = i.split('*', 1)[1].strip()
+      print '  <LI>' + s.replace('<', '&lt;').replace('>', '&gt;')
+  else:
+    if blah:
+      print '</UL>'
+    print '<H3>%s</H3>' % i.strip()
+    print '<UL>'
+    blah = 1
+
+if blah:
+  print '</UL>'
diff --git a/common.c b/common.c
new file mode 100644 (file)
index 0000000..e4b9564
--- /dev/null
+++ b/common.c
@@ -0,0 +1,237 @@
+#include "conky.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <sys/time.h>
+
+struct information info;
+
+void update_uname()
+{
+       uname(&info.uname_s);
+}
+
+double get_time()
+{
+       struct timeval tv;
+       gettimeofday(&tv, 0);
+       return tv.tv_sec + tv.tv_usec / 1000000.0;
+}
+
+FILE *open_file(const char *file, int *reported)
+{
+       FILE *fp = fopen(file, "r");
+       if (!fp) {
+               if (!reported || *reported == 0) {
+                       ERR("can't open %s: %s", file, strerror(errno));
+                       if (reported)
+                               *reported = 1;
+               }
+               return 0;
+       }
+
+       return fp;
+}
+
+void variable_substitute(const char *s, char *dest, unsigned int n)
+{
+       while (*s && n > 1) {
+               if (*s == '$') {
+                       s++;
+                       if (*s != '$') {
+                               char buf[256];
+                               const char *a, *var;
+                               unsigned int len;
+
+                               /* variable is either $foo or ${foo} */
+                               if (*s == '{') {
+                                       s++;
+                                       a = s;
+                                       while (*s && *s != '}')
+                                               s++;
+                               } else {
+                                       a = s;
+                                       while (*s
+                                              && (isalnum((int) *s)
+                                                  || *s == '_'))
+                                               s++;
+                               }
+
+                               /* copy variable to buffer and look it up */
+                               len = (s - a > 255) ? 255 : (s - a);
+                               strncpy(buf, a, len);
+                               buf[len] = '\0';
+
+                               if (*s == '}')
+                                       s++;
+
+                               var = getenv(buf);
+
+                               if (var) {
+                                       /* add var to dest */
+                                       len = strlen(var);
+                                       if (len >= n)
+                                               len = n - 1;
+                                       strncpy(dest, var, len);
+                                       dest += len;
+                                       n -= len;
+                               }
+                               continue;
+                       }
+               }
+
+               *dest++ = *s++;
+               n--;
+       }
+
+       *dest = '\0';
+}
+
+/* network interface stuff */
+
+static struct net_stat netstats[16];
+
+struct net_stat *get_net_stat(const char *dev)
+{
+       unsigned int i;
+
+       if (!dev)
+               return 0;
+
+       /* find interface stat */
+       for (i = 0; i < 16; i++) {
+               if (netstats[i].dev && strcmp(netstats[i].dev, dev) == 0)
+                       return &netstats[i];
+       }
+
+       /* wasn't found? add it */
+       if (i == 16) {
+               for (i = 0; i < 16; i++) {
+                       if (netstats[i].dev == 0) {
+                               netstats[i].dev = strdup(dev);
+                               return &netstats[i];
+                       }
+               }
+       }
+
+       CRIT_ERR("too many interfaces used (limit is 16)");
+       return 0;
+}
+
+void format_seconds(char *buf, unsigned int n, long t)
+{
+       if (t >= 24 * 60 * 60)  /* hours necessary when there are days? */
+               snprintf(buf, n, "%ldd %ldh %ldm", t / 60 / 60 / 24,
+                        (t / 60 / 60) % 24, (t / 60) % 60);
+       else if (t >= 60 * 60)
+               snprintf(buf, n, "%ldh %ldm", (t / 60 / 60) % 24,
+                        (t / 60) % 60);
+       else
+               snprintf(buf, n, "%ldm %lds", t / 60, t % 60);
+}
+
+void format_seconds_short(char *buf, unsigned int n, long t)
+{
+       if (t >= 24 * 60 * 60)
+               snprintf(buf, n, "%ldd %ldh", t / 60 / 60 / 24,
+                        (t / 60 / 60) % 24);
+       else if (t >= 60 * 60)
+               snprintf(buf, n, "%ldh %ldm", (t / 60 / 60) % 24,
+                        (t / 60) % 60);
+       else
+               snprintf(buf, n, "%ldm", t / 60);
+}
+
+static double last_meminfo_update;
+static double last_fs_update;
+
+unsigned int need_mask;
+
+void update_stuff()
+{
+       unsigned int i;
+       info.mask = 0;
+
+       if (no_buffers)
+               need_mask |= 1 << INFO_BUFFERS;
+
+       /* clear speeds and up status in case device was removed and doesn't get
+        * updated */
+
+       for (i = 0; i < 16; i++) {
+               if (netstats[i].dev) {
+                       netstats[i].up = 0;
+                       netstats[i].recv_speed = 0.0;
+                       netstats[i].trans_speed = 0.0;
+               }
+       }
+
+       prepare_update();
+
+#define NEED(a) ((need_mask & (1 << a)) && ((info.mask & (1 << a)) == 0))
+
+       if (NEED(INFO_UPTIME))
+               update_uptime();
+
+       if (NEED(INFO_PROCS))
+               update_total_processes();
+
+       if (NEED(INFO_RUN_PROCS))
+               update_running_processes();
+
+       if (NEED(INFO_CPU))
+               update_cpu_usage();
+
+       if (NEED(INFO_NET))
+               update_net_stats();
+
+       if (NEED(INFO_WIFI))
+               update_wifi_stats();
+
+       if (NEED(INFO_MAIL))
+               update_mail_count();
+
+       if (NEED(INFO_TOP))
+               update_top();
+
+#ifdef MLDONKEY
+  if (NEED(INFO_MLDONKEY)) get_mldonkey_status(&mlconfig, &mlinfo);
+#endif
+  
+#ifdef SETI
+       if (NEED(INFO_SETI))
+               update_seti();
+#endif
+
+#ifdef MPD
+       if (NEED(INFO_MPD))
+               update_mpd();
+#endif
+
+       if (NEED(INFO_LOADAVG))
+               update_load_average();
+
+#ifdef METAR
+   if (NEED(INFO_METAR) && current_update_time - last_metar_update > 1200.9 && info.looped) {
+       update_metar();
+       last_metar_update = current_update_time;
+   }
+#endif
+
+
+       if ((NEED(INFO_MEM) || NEED(INFO_BUFFERS)) &&
+           current_update_time - last_meminfo_update > 6.9) {
+               update_meminfo();
+               if (no_buffers)
+                       info.mem -= info.bufmem;
+               last_meminfo_update = current_update_time;
+       }
+
+       /* update_fs_stat() won't do anything if there aren't fs -things */
+       if (NEED(INFO_FS) && current_update_time - last_fs_update > 12.9) {
+               update_fs_stats();
+               last_fs_update = current_update_time;
+       }
+}
diff --git a/config.h.in b/config.h.in
new file mode 100644 (file)
index 0000000..86ac795
--- /dev/null
@@ -0,0 +1,139 @@
+/* config.h.in.  Generated from configure.in by autoheader.  */
+
+/* Define if you are using Cairo */
+#undef CAIRO
+
+/* Define if you want support for the DBE extension */
+#undef DOUBLE_BUFFER
+
+/* Define to 1 if you have the <cairo.h> header file. */
+#undef HAVE_CAIRO_H
+
+/* Define to 1 if you have the <cairo-xlib.h> header file. */
+#undef HAVE_CAIRO_XLIB_H
+
+/* Define to 1 if you have the <dirent.h> header file. */
+#undef HAVE_DIRENT_H
+
+/* Define if you have getloadavg */
+#undef HAVE_GETLOADAVG
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define if you have kstat (Solaris) */
+#undef HAVE_KSTAT
+
+/* Define to 1 if you have the <linux/soundcard.h> header file. */
+#undef HAVE_LINUX_SOUNDCARD_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <metar.h> header file. */
+#undef HAVE_METAR_H
+
+/* Define to 1 if you have the `popen' function. */
+#undef HAVE_POPEN
+
+/* Define to 1 if you have the <proc/procps.h> header file. */
+#undef HAVE_PROC_PROCPS_H
+
+/* Define to 1 if you have the <proc/readproc.h> header file. */
+#undef HAVE_PROC_READPROC_H
+
+/* Define to 1 if you have the <signal.h> header file. */
+#undef HAVE_SIGNAL_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define if you have sysinfo (Linux) */
+#undef HAVE_SYSINFO
+
+/* Define to 1 if you have the <sys/mount.h> header file. */
+#undef HAVE_SYS_MOUNT_H
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* Define to 1 if you have the <sys/statfs.h> header file. */
+#undef HAVE_SYS_STATFS_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#undef HAVE_SYS_UTSNAME_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define if you have X11 */
+#undef HAVE_X11
+
+/* Define to 1 if you have the <X11/extensions/Xdbe.h> header file. */
+#undef HAVE_X11_EXTENSIONS_XDBE_H
+
+/* Define to 1 if you have the <X11/Xlib.h> header file. */
+#undef HAVE_X11_XLIB_H
+
+/* Xdbe */
+#undef HAVE_XDBE
+
+/* Define if you want metar stats (weather information) */
+#undef METAR
+
+/* Define if you want MLDonkey support */
+#undef MLDONKEY
+
+/* Define if you want MPD support */
+#undef MPD
+
+/* Define if you want support for window creating */
+#undef OWN_WINDOW
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define if you want to use /proc/uptime for uptime */
+#undef PROC_UPTIME
+
+/* Define if you want SETI at Home stats */
+#undef SETI
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Define if you are using Xft */
+#undef XFT
diff --git a/configure b/configure
new file mode 100755 (executable)
index 0000000..616f028
--- /dev/null
+++ b/configure
@@ -0,0 +1,7766 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS="  $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete.  It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="conky.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# 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 CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar BUILD_LINUX_TRUE BUILD_LINUX_FALSE BUILD_SOLARIS_TRUE BUILD_SOLARIS_FALSE BUILD_FREEBSD_TRUE BUILD_FREEBSD_FALSE BUILD_NETBSD_TRUE BUILD_NETBSD_FALSE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP BUILD_SETI_TRUE BUILD_SETI_FALSE BUILD_MPD_TRUE BUILD_MPD_FALSE BUILD_CAIRO_TRUE BUILD_CAIRO_FALSE CAIROCONFIG BUILD_METAR_TRUE BUILD_METAR_FALSE BUILD_MLDONKEY_TRUE BUILD_MLDONKEY_FALSE XFTCONFIG HELP2MAN HAVE_HELP2MAN_TRUE HAVE_HELP2MAN_FALSE X11_LIBS XFT_LIBS LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_option in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    eval "enable_$ac_feature=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_$ac_feature='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_$ac_package='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/-/_/g'`
+    eval "with_$ac_package=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+    eval "$ac_envvar='$ac_optarg'"
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+             localstatedir libdir includedir oldincludedir infodir mandir
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$0" : 'X\(//\)[^/]' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+   { (exit 1); exit 1; }; }
+  else
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+  fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+   { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+  cat <<_ACEOF
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                         [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                         [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR           user executables [EPREFIX/bin]
+  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
+  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+  --libdir=DIR           object code libraries [EPREFIX/lib]
+  --includedir=DIR       C header files [PREFIX/include]
+  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+  --infodir=DIR          info documentation [PREFIX/info]
+  --mandir=DIR           man documentation [PREFIX/man]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+X features:
+  --x-includes=DIR    X include files are in DIR
+  --x-libraries=DIR   X library files are in DIR
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-xft            enable if you want to use Xft default=no
+  --enable-own-window     enable if you want support for creating own window default=yes
+  --enable-double-buffer  enable if you want to support flicker-free operation default=yes
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
+  --enable-proc-uptime    enable using /proc/uptime for uptime default=no
+  --enable-seti           enable if you want SETI at Home stats default=no
+  --enable-mpd           enable if you want MPD support default=no
+  --enable-cairo           enable if you want Cairo support default=no
+  --enable-metar       enable if you want metar stats (weather information) default=no
+  --enable-mldonkey       enable if you want MLDonkey support default=no
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-x                use the X Window System
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
+              headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  ac_popdir=`pwd`
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d $ac_dir || continue
+    ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+    cd $ac_dir
+    # Check for guested configure; otherwise get Cygnus style configure.
+    if test -f $ac_srcdir/configure.gnu; then
+      echo
+      $SHELL $ac_srcdir/configure.gnu  --help=recursive
+    elif test -f $ac_srcdir/configure; then
+      echo
+      $SHELL $ac_srcdir/configure  --help=recursive
+    elif test -f $ac_srcdir/configure.ac ||
+          test -f $ac_srcdir/configure.in; then
+      echo
+      $ac_configure --help
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi
+    cd $ac_popdir
+  done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+  cat <<\_ACEOF
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+       ac_must_keep_next=false # Got value, back to normal.
+      else
+       case $ac_arg in
+         *=* | --config-cache | -C | -disable-* | --disable-* \
+         | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+         | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+         | -with-* | --with-* | -without-* | --without-* | --x)
+           case "$ac_configure_args0 " in
+             "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+           esac
+           ;;
+         -* ) ac_must_keep_next=true ;;
+       esac
+      fi
+      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+      # Get rid of the leading space.
+      ac_sep=" "
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+{
+  (set) 2>&1 |
+    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      sed -n \
+       "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+      ;;
+    *)
+      sed -n \
+       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+}
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=$`echo $ac_var`
+      echo "$ac_var='"'"'$ac_val'"'"'"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+       eval ac_val=$`echo $ac_var`
+       echo "$ac_var='"'"'$ac_val'"'"'"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      sed "/^$/d" confdefs.h | sort
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core &&
+  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+     ' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . $cache_file;;
+      *)                      . ./$cache_file;;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+              sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+  eval ac_new_val="\$ac_env_${ac_var}_value"
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+       { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+       { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+       { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+       ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+am__api_version="1.9"
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f $ac_dir/shtool; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+       if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+         if test $ac_prog = install &&
+           grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         elif test $ac_prog = install &&
+           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+           ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+           break 3
+         fi
+       fi
+      done
+    done
+    ;;
+esac
+done
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL=$ac_install_sh
+  fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+test "$program_prefix" != NONE &&
+  program_transform_name="s,^,$program_prefix,;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s,\$,$program_suffix,;$program_transform_name"
+# Double any \ or $.  echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+
+for ac_prog in gawk mawk nawk awk
+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_prog_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AWK="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$AWK" && break
+done
+
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+all:
+       @echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+  SET_MAKE=
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE=conky
+ VERSION=1.2
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; 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_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; 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_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  STRIP=$ac_ct_STRIP
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+          ac_config_headers="$ac_config_headers config.h"
+
+
+uname=`uname`
+
+case $uname in
+  Linux*)
+    WANT_SYSINFO=yes
+    ;;
+  FreeBSD*)
+    WANT_KVM=yes
+    ;;
+  NetBSD*)
+    WANT_KVM=yes
+    WANT_OSSLIB=yes
+    ;;
+# Solaris doesn't work at all right now
+
+#  SunOS*)
+#    WANT_KSTAT=yes
+#    ;;
+
+  *)
+    echo "Your operating system $uname isn't supported"
+    echo "Feel free to help. :P"
+    exit 1
+    ;;
+esac
+
+
+
+if test x$uname = xLinux; then
+  BUILD_LINUX_TRUE=
+  BUILD_LINUX_FALSE='#'
+else
+  BUILD_LINUX_TRUE='#'
+  BUILD_LINUX_FALSE=
+fi
+
+
+
+if test x$uname = xSunOS; then
+  BUILD_SOLARIS_TRUE=
+  BUILD_SOLARIS_FALSE='#'
+else
+  BUILD_SOLARIS_TRUE='#'
+  BUILD_SOLARIS_FALSE=
+fi
+
+
+
+if test x$uname = xFreeBSD; then
+  BUILD_FREEBSD_TRUE=
+  BUILD_FREEBSD_FALSE='#'
+else
+  BUILD_FREEBSD_TRUE='#'
+  BUILD_FREEBSD_FALSE=
+fi
+
+
+
+if test x$uname = xNetBSD; then
+  BUILD_NETBSD_TRUE=
+  BUILD_NETBSD_FALSE='#'
+else
+  BUILD_NETBSD_TRUE='#'
+  BUILD_NETBSD_FALSE=
+fi
+
+
+
+want_xft=no
+# Check whether --enable-xft or --disable-xft was given.
+if test "${enable_xft+set}" = set; then
+  enableval="$enable_xft"
+  want_xft="$enableval"
+fi;
+
+
+dah=yes
+# Check whether --enable-own_window or --disable-own_window was given.
+if test "${enable_own_window+set}" = set; then
+  enableval="$enable_own_window"
+  dah="$enableval"
+fi;
+
+if test $dah != "no"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define OWN_WINDOW 1
+_ACEOF
+
+fi
+
+
+dah=yes
+# Check whether --enable-double_buffer or --disable-double_buffer was given.
+if test "${enable_double_buffer+set}" = set; then
+  enableval="$enable_double_buffer"
+  dah="$enableval"
+fi;
+
+if test $dah != "no"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define DOUBLE_BUFFER 1
+_ACEOF
+
+  DEPDIR="${am__leading_dot}deps"
+
+          ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+
+
+echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+  enableval="$enable_dependency_tracking"
+
+fi;
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+
+
+if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; 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_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; 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_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; 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_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; 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_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; 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_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+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
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$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_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl
+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_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CC" && break
+done
+
+  CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+  (eval $ac_link_default) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Find the output, starting from the most likely.  This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+       ;;
+    conftest.$ac_ext )
+       # This is the source file.
+       ;;
+    [ab].out )
+       # We found the default executable, but exeext='' is most
+       # certainly right.
+       break;;
+    *.* )
+       ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+       # FIXME: I believe we export ac_cv_exeext for Libtool,
+       # but it would be cool to find out if it's true.  Does anybody
+       # maintain Libtool? --akim.
+       export ac_cv_exeext
+       break;;
+    * )
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+       cross_compiling=yes
+    else
+       { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+         export ac_cv_exeext
+         break;;
+    * ) break;;
+  esac
+done
+else
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std1 is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std1.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX                  -qlanglvl=ansi
+# Ultrix and OSF/1     -std1
+# HP-UX 10.20 and later        -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4                 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C.  Since we use `exit',
+# in C++ we need to declare it.  In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+  choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC"   am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+                  (('a' <= (c) && (c) <= 'i') \
+                    || ('j' <= (c) && (c) <= 'r') \
+                    || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+       || toupper (i) != TOUPPER (i))
+      exit(2);
+  exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+                 inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_header in X11/extensions/Xdbe.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_XDBE 1
+_ACEOF
+
+else
+  XDBE_MISSING=yes
+fi
+
+done
+
+  if test "x$XDBE_MISSING" = xyes; then
+      { { echo "$as_me:$LINENO: error: something went wrong when checking for Xdbe (double buffer extension" >&5
+echo "$as_me: error: something went wrong when checking for Xdbe (double buffer extension" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
+
+
+dah=no
+# Check whether --enable-proc_uptime or --disable-proc_uptime was given.
+if test "${enable_proc_uptime+set}" = set; then
+  enableval="$enable_proc_uptime"
+  dah="$enableval"
+fi;
+
+if test $dah = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define PROC_UPTIME 1
+_ACEOF
+
+fi
+
+
+want_seti=no
+# Check whether --enable-seti or --disable-seti was given.
+if test "${enable_seti+set}" = set; then
+  enableval="$enable_seti"
+  want_seti="$enableval"
+fi;
+
+
+
+if test x$want_seti == xyes; then
+  BUILD_SETI_TRUE=
+  BUILD_SETI_FALSE='#'
+else
+  BUILD_SETI_TRUE='#'
+  BUILD_SETI_FALSE=
+fi
+
+if test x$want_seti == xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define SETI 1
+_ACEOF
+
+fi
+
+
+want_mpd=no
+# Check whether --enable-mpd or --disable-mpd was given.
+if test "${enable_mpd+set}" = set; then
+  enableval="$enable_mpd"
+  want_mpd="$enableval"
+fi;
+
+
+
+if test x$want_mpd == xyes; then
+  BUILD_MPD_TRUE=
+  BUILD_MPD_FALSE='#'
+else
+  BUILD_MPD_TRUE='#'
+  BUILD_MPD_FALSE=
+fi
+
+if test x$want_mpd == xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define MPD 1
+_ACEOF
+
+fi
+
+
+want_cairo=no
+# Check whether --enable-cairo or --disable-cairo was given.
+if test "${enable_cairo+set}" = set; then
+  enableval="$enable_cairo"
+  want_cairo="$enableval"
+fi;
+
+
+
+if test x$want_cairo == xyes; then
+  BUILD_CAIRO_TRUE=
+  BUILD_CAIRO_FALSE='#'
+else
+  BUILD_CAIRO_TRUE='#'
+  BUILD_CAIRO_FALSE=
+fi
+
+
+
+if test "$want_cairo" = "yes"; then
+
+
+for ac_header in cairo.h cairo-xlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  CAIRO_MISSING=yes
+fi
+
+done
+
+    if test "x$CAIRO_MISSING" = xyes; then
+      { { echo "$as_me:$LINENO: error: something went wrong when checking for cairo, you're probably missing headers or it's not installed" >&5
+echo "$as_me: error: something went wrong when checking for cairo, you're probably missing headers or it's not installed" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; 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_CAIROCONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $CAIROCONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CAIROCONFIG="$CAIROCONFIG" # 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_CAIROCONFIG="$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
+CAIROCONFIG=$ac_cv_path_CAIROCONFIG
+
+if test -n "$CAIROCONFIG"; then
+  echo "$as_me:$LINENO: result: $CAIROCONFIG" >&5
+echo "${ECHO_T}$CAIROCONFIG" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  if test x$CAIROCONFIG != x; then
+
+
+cat >>confdefs.h <<\_ACEOF
+#define CAIRO 1
+_ACEOF
+
+    CFLAGS="$CFLAGS `$CAIROCONFIG --cflags cairo` `$CAIROCONFIG --libs cairo` "
+    CAIRO_LIBS="`$CAIROCONFIG --libs cairo` `$CAIROCONFIG --cflags cairo`"
+  else
+    want_cairo=no
+  fi
+fi
+
+
+want_metar=no
+# Check whether --enable-metar or --disable-metar was given.
+if test "${enable_metar+set}" = set; then
+  enableval="$enable_metar"
+  want_metar="$enableval"
+fi;
+
+
+
+if test x$want_metar == xyes; then
+  BUILD_METAR_TRUE=
+  BUILD_METAR_FALSE='#'
+else
+  BUILD_METAR_TRUE='#'
+  BUILD_METAR_FALSE=
+fi
+
+if test x$want_metar == xyes; then
+
+for ac_header in metar.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  METAR_MISSING=yes
+fi
+
+done
+
+    if test "x$METAR_MISSING" = xyes; then
+      { { echo "$as_me:$LINENO: error: something went wrong when checking for mdsplib, you're probably missing headers or it's not installed" >&5
+echo "$as_me: error: something went wrong when checking for mdsplib, you're probably missing headers or it's not installed" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+
+cat >>confdefs.h <<\_ACEOF
+#define METAR 1
+_ACEOF
+
+fi
+
+
+
+
+want_mldonkey=no
+# Check whether --enable-mldonkey or --disable-mldonkey was given.
+if test "${enable_mldonkey+set}" = set; then
+  enableval="$enable_mldonkey"
+  want_mldonkey="$enableval"
+fi;
+
+
+
+if test x$want_mldonkey == xyes; then
+  BUILD_MLDONKEY_TRUE=
+  BUILD_MLDONKEY_FALSE='#'
+else
+  BUILD_MLDONKEY_TRUE='#'
+  BUILD_MLDONKEY_FALSE=
+fi
+
+if test x$want_mldonkey == xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define MLDONKEY 1
+_ACEOF
+
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; 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_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; 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_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; 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_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; 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_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; 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_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+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
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$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_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl
+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_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CC" && break
+done
+
+  CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std1 is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std1.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX                  -qlanglvl=ansi
+# Ultrix and OSF/1     -std1
+# HP-UX 10.20 and later        -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4                 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C.  Since we use `exit',
+# in C++ we need to declare it.  In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+  choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC"   am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+
+
+echo "$as_me:$LINENO: checking for X" >&5
+echo $ECHO_N "checking for X... $ECHO_C" >&6
+
+
+# Check whether --with-x or --without-x was given.
+if test "${with_x+set}" = set; then
+  withval="$with_x"
+
+fi;
+# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
+if test "x$with_x" = xno; then
+  # The user explicitly disabled X.
+  have_x=disabled
+else
+  if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
+    # Both variables are already set.
+    have_x=yes
+  else
+    if test "${ac_cv_have_x+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # One or both of the vars are not set, and there is no cached value.
+ac_x_includes=no ac_x_libraries=no
+rm -fr conftest.dir
+if mkdir conftest.dir; then
+  cd conftest.dir
+  # Make sure to not put "make" in the Imakefile rules, since we grep it out.
+  cat >Imakefile <<'_ACEOF'
+acfindx:
+       @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
+_ACEOF
+  if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
+    # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+    eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
+    # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
+    for ac_extension in a so sl; do
+      if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
+        test -f $ac_im_libdir/libX11.$ac_extension; then
+       ac_im_usrlibdir=$ac_im_libdir; break
+      fi
+    done
+    # Screen out bogus values from the imake configuration.  They are
+    # bogus both because they are the default anyway, and because
+    # using them would break gcc on systems where it needs fixed includes.
+    case $ac_im_incroot in
+       /usr/include) ;;
+       *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
+    esac
+    case $ac_im_usrlibdir in
+       /usr/lib | /lib) ;;
+       *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
+    esac
+  fi
+  cd ..
+  rm -fr conftest.dir
+fi
+
+# Standard set of common directories for X headers.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+ac_x_header_dirs='
+/usr/X11/include
+/usr/X11R6/include
+/usr/X11R5/include
+/usr/X11R4/include
+
+/usr/include/X11
+/usr/include/X11R6
+/usr/include/X11R5
+/usr/include/X11R4
+
+/usr/local/X11/include
+/usr/local/X11R6/include
+/usr/local/X11R5/include
+/usr/local/X11R4/include
+
+/usr/local/include/X11
+/usr/local/include/X11R6
+/usr/local/include/X11R5
+/usr/local/include/X11R4
+
+/usr/X386/include
+/usr/x386/include
+/usr/XFree86/include/X11
+
+/usr/include
+/usr/local/include
+/usr/unsupported/include
+/usr/athena/include
+/usr/local/x11r5/include
+/usr/lpp/Xamples/include
+
+/usr/openwin/include
+/usr/openwin/share/include'
+
+if test "$ac_x_includes" = no; then
+  # Guess where to find include files, by looking for Intrinsic.h.
+  # First, try using that file with no special directory specified.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <X11/Intrinsic.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # We can compile using X headers with no special include directory.
+ac_x_includes=
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  for ac_dir in $ac_x_header_dirs; do
+  if test -r "$ac_dir/X11/Intrinsic.h"; then
+    ac_x_includes=$ac_dir
+    break
+  fi
+done
+fi
+rm -f conftest.err conftest.$ac_ext
+fi # $ac_x_includes = no
+
+if test "$ac_x_libraries" = no; then
+  # Check for the libraries.
+  # See if we find them without any special options.
+  # Don't add to $LIBS permanently.
+  ac_save_LIBS=$LIBS
+  LIBS="-lXt $LIBS"
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <X11/Intrinsic.h>
+int
+main ()
+{
+XtMalloc (0)
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  LIBS=$ac_save_LIBS
+# We can link X programs with no special library path.
+ac_x_libraries=
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+LIBS=$ac_save_LIBS
+for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
+do
+  # Don't even attempt the hair of trying to link an X program!
+  for ac_extension in a so sl; do
+    if test -r $ac_dir/libXt.$ac_extension; then
+      ac_x_libraries=$ac_dir
+      break 2
+    fi
+  done
+done
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi # $ac_x_libraries = no
+
+if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
+  # Didn't find X anywhere.  Cache the known absence of X.
+  ac_cv_have_x="have_x=no"
+else
+  # Record where we found X for the cache.
+  ac_cv_have_x="have_x=yes \
+               ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
+fi
+fi
+
+  fi
+  eval "$ac_cv_have_x"
+fi # $with_x != no
+
+if test "$have_x" != yes; then
+  echo "$as_me:$LINENO: result: $have_x" >&5
+echo "${ECHO_T}$have_x" >&6
+  no_x=yes
+else
+  # If each of the values was on the command line, it overrides each guess.
+  test "x$x_includes" = xNONE && x_includes=$ac_x_includes
+  test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
+  # Update the cache value to reflect the command line values.
+  ac_cv_have_x="have_x=yes \
+               ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
+  echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5
+echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6
+fi
+
+if test $have_x != "yes"; then
+  echo "Sorry, X is very much needed"
+  exit 1
+fi
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_X11 1
+_ACEOF
+
+
+
+if test "$x_libraries" != ""; then
+  LDFLAGS="$LDFLAGS -L$x_libraries"
+fi
+
+if test "$x_includes" != ""; then
+  CFLAGS="$CFLAGS -Wall -I$x_includes"
+fi
+
+
+if test "$want_xft" = "yes"; then
+  # Extract the first word of "xft-config", so it can be a program name with args.
+set dummy xft-config; 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_XFTCONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $XFTCONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_XFTCONFIG="$XFTCONFIG" # 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_XFTCONFIG="$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
+XFTCONFIG=$ac_cv_path_XFTCONFIG
+
+if test -n "$XFTCONFIG"; then
+  echo "$as_me:$LINENO: result: $XFTCONFIG" >&5
+echo "${ECHO_T}$XFTCONFIG" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  if test x$XFTCONFIG != x; then
+
+    if test "x$XFT_MISSING" = xyes; then
+      { { echo "$as_me:$LINENO: error: something went wrong when checking for Xft, you're probably missing headers or it's not installed" >&5
+echo "$as_me: error: something went wrong when checking for Xft, you're probably missing headers or it's not installed" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+
+
+cat >>confdefs.h <<\_ACEOF
+#define XFT 1
+_ACEOF
+
+    CFLAGS="$CFLAGS `$XFTCONFIG --cflags`"
+    XFT_LIBS=`$XFTCONFIG --libs`
+  else
+    want_xft=no
+  fi
+fi
+
+
+if test x$WANT_KVM = xyes; then
+  echo "$as_me:$LINENO: checking for kvm_open in -lkvm" >&5
+echo $ECHO_N "checking for kvm_open in -lkvm... $ECHO_C" >&6
+if test "${ac_cv_lib_kvm_kvm_open+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lkvm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char kvm_open ();
+int
+main ()
+{
+kvm_open ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_kvm_kvm_open=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_kvm_kvm_open=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_kvm_kvm_open" >&5
+echo "${ECHO_T}$ac_cv_lib_kvm_kvm_open" >&6
+if test $ac_cv_lib_kvm_kvm_open = yes; then
+  LIBS="$LIBS -lkvm"
+else
+  { { echo "$as_me:$LINENO: error: Could not find kvm_open in -lkvm." >&5
+echo "$as_me: error: Could not find kvm_open in -lkvm." >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+
+fi
+
+
+if test x$WANT_OSSLIB = xyes; then
+    echo "$as_me:$LINENO: checking for _oss_ioctl in -lossaudio" >&5
+echo $ECHO_N "checking for _oss_ioctl in -lossaudio... $ECHO_C" >&6
+if test "${ac_cv_lib_ossaudio__oss_ioctl+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lossaudio  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char _oss_ioctl ();
+int
+main ()
+{
+_oss_ioctl ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_ossaudio__oss_ioctl=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_ossaudio__oss_ioctl=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_ossaudio__oss_ioctl" >&5
+echo "${ECHO_T}$ac_cv_lib_ossaudio__oss_ioctl" >&6
+if test $ac_cv_lib_ossaudio__oss_ioctl = yes; then
+  LIBS="$LIBS -lossaudio"
+else
+  { { echo "$as_me:$LINENO: error: Could not find oss_ioctl in -lossaudio." >&5
+echo "$as_me: error: Could not find oss_ioctl in -lossaudio." >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+
+fi
+
+
+
+
+
+
+
+
+
+
+for ac_header in signal.h unistd.h X11/Xlib.h sys/utsname.h sys/stat.h linux/soundcard.h dirent.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+for ac_header in sys/statfs.h sys/param.h sys/mount.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_header in proc/procps.h proc/readproc.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  PROCPS_MISSING=yes
+fi
+
+done
+
+  if test "x$PROCPS_MISSING" = xyes; then
+      { { echo "$as_me:$LINENO: error: something went wrong when checking for procps, you're probably missing the necessary headers" >&5
+echo "$as_me: error: something went wrong when checking for procps, you're probably missing the necessary headers" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+
+
+# Extract the first word of "help2man", so it can be a program name with args.
+set dummy help2man; 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_HELP2MAN+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $HELP2MAN in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_HELP2MAN="$HELP2MAN" # 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_HELP2MAN="$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
+HELP2MAN=$ac_cv_path_HELP2MAN
+
+if test -n "$HELP2MAN"; then
+  echo "$as_me:$LINENO: result: $HELP2MAN" >&5
+echo "${ECHO_T}$HELP2MAN" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+
+if test x$HELP2MAN != x; then
+  HAVE_HELP2MAN_TRUE=
+  HAVE_HELP2MAN_FALSE='#'
+else
+  HAVE_HELP2MAN_TRUE='#'
+  HAVE_HELP2MAN_FALSE=
+fi
+
+
+
+if test x$WANT_SYSINFO = xyes; then
+  dah=no
+  echo "$as_me:$LINENO: checking for sysinfo" >&5
+echo $ECHO_N "checking for sysinfo... $ECHO_C" >&6
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+     #include <sys/sysinfo.h>
+int
+main ()
+{
+struct sysinfo s; sysinfo(&s); (void) s.uptime;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; dah=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+echo "$as_me:$LINENO: result: not usable" >&5
+echo "${ECHO_T}not usable" >&6; dah=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+  if test x$dah = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SYSINFO 1
+_ACEOF
+
+  fi
+fi
+
+
+if test x$WANT_KSTAT = xyes; then
+  dah=no
+  echo "$as_me:$LINENO: checking for kstat_open in -lkstat" >&5
+echo $ECHO_N "checking for kstat_open in -lkstat... $ECHO_C" >&6
+if test "${ac_cv_lib_kstat_kstat_open+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lkstat  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char kstat_open ();
+int
+main ()
+{
+kstat_open ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_kstat_kstat_open=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_kstat_kstat_open=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_kstat_kstat_open" >&5
+echo "${ECHO_T}$ac_cv_lib_kstat_kstat_open" >&6
+if test $ac_cv_lib_kstat_kstat_open = yes; then
+  dah=yes
+fi
+
+
+  if test x$dah = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_KSTAT 1
+_ACEOF
+
+    LDFLAGS="$LDFLAGS -lkstat"
+  fi
+fi
+
+
+echo "$as_me:$LINENO: checking for getloadavg" >&5
+echo $ECHO_N "checking for getloadavg... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+int
+main ()
+{
+double v[3]; getloadavg(v, 3);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETLOADAVG 1
+_ACEOF
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+for ac_func in popen
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+CFLAGS="$CFLAGS -Wall -W"
+
+
+
+
+
+          ac_config_files="$ac_config_files Makefile"
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+  (set) 2>&1 |
+    case `(ac_space=' '; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+       "s/'/'\\\\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;;
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n \
+       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+} |
+  sed '
+     t clear
+     : clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+  if test -w $cache_file; then
+    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+    cat confcache >$cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[         ]*VPATH[        ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[    ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[      ]*$//;
+}'
+fi
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_i=`echo "$ac_i" |
+        sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${BUILD_LINUX_TRUE}" && test -z "${BUILD_LINUX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_LINUX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_LINUX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_SOLARIS_TRUE}" && test -z "${BUILD_SOLARIS_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_SOLARIS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_SOLARIS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_FREEBSD_TRUE}" && test -z "${BUILD_FREEBSD_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_FREEBSD\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_FREEBSD\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_NETBSD_TRUE}" && test -z "${BUILD_NETBSD_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_NETBSD\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_NETBSD\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_SETI_TRUE}" && test -z "${BUILD_SETI_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_SETI\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_SETI\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_MPD_TRUE}" && test -z "${BUILD_MPD_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_MPD\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_MPD\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_CAIRO_TRUE}" && test -z "${BUILD_CAIRO_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_CAIRO\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_CAIRO\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_METAR_TRUE}" && test -z "${BUILD_METAR_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_METAR\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_METAR\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_MLDONKEY_TRUE}" && test -z "${BUILD_MLDONKEY_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_MLDONKEY\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_MLDONKEY\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${HAVE_HELP2MAN_TRUE}" && test -z "${HAVE_HELP2MAN_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"HAVE_HELP2MAN\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"HAVE_HELP2MAN\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS="  $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.  Logging --version etc. is OK.
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+                  instantiate the configuration file FILE
+  --header=FILE[:TEMPLATE]
+                  instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.59,
+  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "x$1" : 'x\([^=]*\)='`
+    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  -*)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  *) # This is not an option, so the user has probably given explicit
+     # arguments.
+     ac_option=$1
+     ac_need_defaults=false;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --vers* | -V )
+    echo "$ac_cs_version"; exit 0 ;;
+  --he | --h)
+    # Conflict between --help and --header
+    { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit 0 ;;
+  --debug | --d* | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1" ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS section.
+#
+
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+  case "$ac_config_target" in
+  # Handling of arguments.
+  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+  "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+  "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./confstat$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+  # Protect against being on the right side of a sed subst in config.status.
+  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CYGPATH_W@,$CYGPATH_W,;t t
+s,@PACKAGE@,$PACKAGE,;t t
+s,@VERSION@,$VERSION,;t t
+s,@ACLOCAL@,$ACLOCAL,;t t
+s,@AUTOCONF@,$AUTOCONF,;t t
+s,@AUTOMAKE@,$AUTOMAKE,;t t
+s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@install_sh@,$install_sh,;t t
+s,@STRIP@,$STRIP,;t t
+s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@mkdir_p@,$mkdir_p,;t t
+s,@AWK@,$AWK,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@am__leading_dot@,$am__leading_dot,;t t
+s,@AMTAR@,$AMTAR,;t t
+s,@am__tar@,$am__tar,;t t
+s,@am__untar@,$am__untar,;t t
+s,@BUILD_LINUX_TRUE@,$BUILD_LINUX_TRUE,;t t
+s,@BUILD_LINUX_FALSE@,$BUILD_LINUX_FALSE,;t t
+s,@BUILD_SOLARIS_TRUE@,$BUILD_SOLARIS_TRUE,;t t
+s,@BUILD_SOLARIS_FALSE@,$BUILD_SOLARIS_FALSE,;t t
+s,@BUILD_FREEBSD_TRUE@,$BUILD_FREEBSD_TRUE,;t t
+s,@BUILD_FREEBSD_FALSE@,$BUILD_FREEBSD_FALSE,;t t
+s,@BUILD_NETBSD_TRUE@,$BUILD_NETBSD_TRUE,;t t
+s,@BUILD_NETBSD_FALSE@,$BUILD_NETBSD_FALSE,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@DEPDIR@,$DEPDIR,;t t
+s,@am__include@,$am__include,;t t
+s,@am__quote@,$am__quote,;t t
+s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
+s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
+s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s,@CCDEPMODE@,$CCDEPMODE,;t t
+s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
+s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
+s,@BUILD_SETI_TRUE@,$BUILD_SETI_TRUE,;t t
+s,@BUILD_SETI_FALSE@,$BUILD_SETI_FALSE,;t t
+s,@BUILD_MPD_TRUE@,$BUILD_MPD_TRUE,;t t
+s,@BUILD_MPD_FALSE@,$BUILD_MPD_FALSE,;t t
+s,@BUILD_CAIRO_TRUE@,$BUILD_CAIRO_TRUE,;t t
+s,@BUILD_CAIRO_FALSE@,$BUILD_CAIRO_FALSE,;t t
+s,@CAIROCONFIG@,$CAIROCONFIG,;t t
+s,@BUILD_METAR_TRUE@,$BUILD_METAR_TRUE,;t t
+s,@BUILD_METAR_FALSE@,$BUILD_METAR_FALSE,;t t
+s,@BUILD_MLDONKEY_TRUE@,$BUILD_MLDONKEY_TRUE,;t t
+s,@BUILD_MLDONKEY_FALSE@,$BUILD_MLDONKEY_FALSE,;t t
+s,@XFTCONFIG@,$XFTCONFIG,;t t
+s,@HELP2MAN@,$HELP2MAN,;t t
+s,@HAVE_HELP2MAN_TRUE@,$HAVE_HELP2MAN_TRUE,;t t
+s,@HAVE_HELP2MAN_FALSE@,$HAVE_HELP2MAN_FALSE,;t t
+s,@X11_LIBS@,$X11_LIBS,;t t
+s,@XFT_LIBS@,$XFT_LIBS,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+  cat >>$CONFIG_STATUS <<\_ACEOF
+  # Split the substitutions into bite-sized pieces for seds with
+  # small command number limits, like on Digital OSF/1 and HP-UX.
+  ac_max_sed_lines=48
+  ac_sed_frag=1 # Number of current file.
+  ac_beg=1 # First line for current file.
+  ac_end=$ac_max_sed_lines # Line after last line for current file.
+  ac_more_lines=:
+  ac_sed_cmds=
+  while $ac_more_lines; do
+    if test $ac_beg -gt 1; then
+      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    else
+      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    fi
+    if test ! -s $tmp/subs.frag; then
+      ac_more_lines=false
+    else
+      # The purpose of the label and of the branching condition is to
+      # speed up the sed processing (if there are no `@' at all, there
+      # is no need to browse any of the substitutions).
+      # These are the two extra sed commands mentioned above.
+      (echo ':t
+  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+      if test -z "$ac_sed_cmds"; then
+       ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+      else
+       ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+      fi
+      ac_sed_frag=`expr $ac_sed_frag + 1`
+      ac_beg=$ac_end
+      ac_end=`expr $ac_end + $ac_max_sed_lines`
+    fi
+  done
+  if test -z "$ac_sed_cmds"; then
+    ac_sed_cmds=cat
+  fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+       cat >$tmp/stdin
+       ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+  esac
+
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    configure_input=
+  else
+    configure_input="$ac_file.  "
+  fi
+  configure_input=$configure_input"Generated from `echo $ac_file_in |
+                                    sed 's,.*/,,'` by configure."
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+        # Absolute (can't be DOS-style, as IFS=:)
+        test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        echo "$f";;
+      *) # Relative
+        if test -f "$f"; then
+          # Build tree
+          echo "$f"
+        elif test -f "$srcdir/$f"; then
+          # Source tree
+          echo "$srcdir/$f"
+        else
+          # /dev/null tree
+          { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+  rm -f $tmp/stdin
+  if test x"$ac_file" != x-; then
+    mv $tmp/out $ac_file
+  else
+    cat $tmp/out
+    rm -f $tmp/out
+  fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s,^\([   ]*\)#\([        ]*define[       ][      ]*\)'
+ac_dB='[        ].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([   ]*\)#\([        ]*\)undef\([    ][      ]*\)'
+ac_uB='$,\1#\2define\3'
+ac_uC=' '
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+       cat >$tmp/stdin
+       ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+        # Absolute (can't be DOS-style, as IFS=:)
+        test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        # Do quote $f, to prevent DOS paths from being IFS'd.
+        echo "$f";;
+      *) # Relative
+        if test -f "$f"; then
+          # Build tree
+          echo "$f"
+        elif test -f "$srcdir/$f"; then
+          # Source tree
+          echo "$srcdir/$f"
+        else
+          # /dev/null tree
+          { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+  # Remove the trailing spaces.
+  sed 's/[      ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h.  The first handles `#define'
+# templates, and the second `#undef' templates.
+# And first: Protect against being on the right side of a sed subst in
+# config.status.  Protect against being in an unquoted here document
+# in config.status.
+rm -f conftest.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[    ]*#[    ]*define[       ][      ]*\([^  (][^    (]*\)\(([^)]*)\)[       ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[    ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless.  Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
+
+# This sed command replaces #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >>conftest.undefs <<\_ACEOF
+s,^[    ]*#[    ]*undef[        ][      ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo '  if grep "^[     ]*#[    ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo '  # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo '  :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+  # Write a limited-size here document to $tmp/defines.sed.
+  echo '  cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#define' lines.
+  echo '/^[     ]*#[    ]*define/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/defines.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+  rm -f conftest.defines
+  mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo '  fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #undef templates' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.undefs >/dev/null
+do
+  # Write a limited-size here document to $tmp/undefs.sed.
+  echo '  cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#undef'
+  echo '/^[     ]*#[    ]*undef/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+  rm -f conftest.undefs
+  mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    echo "/* Generated by configure.  */" >$tmp/config.h
+  else
+    echo "/* $ac_file.  Generated by configure.  */" >$tmp/config.h
+  fi
+  cat $tmp/in >>$tmp/config.h
+  rm -f $tmp/in
+  if test x"$ac_file" != x-; then
+    if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+      { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+      rm -f $ac_file
+      mv $tmp/config.h $ac_file
+    fi
+  else
+    cat $tmp/config.h
+    rm -f $tmp/config.h
+  fi
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $ac_file | $ac_file:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null ||
+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X$ac_file : 'X\(//\)[^/]' \| \
+        X$ac_file : 'X\(//\)$' \| \
+        X$ac_file : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X$ac_file |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`/stamp-h$_am_stamp_count
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+  ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+  ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+  ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_dest" : 'X\(//\)[^/]' \| \
+        X"$ac_dest" : 'X\(//\)$' \| \
+        X"$ac_dest" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+  case $ac_dest in
+    depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`(dirname "$mf") 2>/dev/null ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$mf" : 'X\(//\)[^/]' \| \
+        X"$mf" : 'X\(//\)$' \| \
+        X"$mf" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`(dirname "$file") 2>/dev/null ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$file" : 'X\(//\)[^/]' \| \
+        X"$file" : 'X\(//\)$' \| \
+        X"$file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    { if $as_mkdir_p; then
+    mkdir -p $dirpart/$fdir
+  else
+    as_dir=$dirpart/$fdir
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
+echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+  esac
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+
diff --git a/configure.in b/configure.in
new file mode 100644 (file)
index 0000000..de6bef5
--- /dev/null
@@ -0,0 +1,337 @@
+AC_INIT(conky.c)
+
+AM_INIT_AUTOMAKE(conky, 1.2)
+AM_CONFIG_HEADER(config.h)
+
+uname=`uname`
+
+case $uname in
+  Linux*)
+    WANT_SYSINFO=yes
+    ;;
+  FreeBSD*)
+    WANT_KVM=yes
+    ;;
+  NetBSD*)
+    WANT_KVM=yes
+    WANT_OSSLIB=yes
+    ;;
+# Solaris doesn't work at all right now
+
+#  SunOS*)
+#    WANT_KSTAT=yes
+#    ;;
+
+  *)
+    echo "Your operating system $uname isn't supported"
+    echo "Feel free to help. :P"
+    exit 1
+    ;;
+esac
+
+AM_CONDITIONAL(BUILD_LINUX, test x$uname = xLinux)
+AM_CONDITIONAL(BUILD_SOLARIS, test x$uname = xSunOS)
+AM_CONDITIONAL(BUILD_FREEBSD, test x$uname = xFreeBSD)
+AM_CONDITIONAL(BUILD_NETBSD, test x$uname = xNetBSD)
+
+dnl
+dnl XFT option
+dnl
+
+want_xft=no
+AC_ARG_ENABLE(xft,
+[  --enable-xft            enable if you want to use Xft [default=no]],
+  [want_xft="$enableval"])
+
+dnl
+dnl OWN_WINDOW option
+dnl
+
+dah=yes
+AC_ARG_ENABLE(own_window,
+[  --enable-own-window     enable if you want support for creating own window [default=yes]],
+  [dah="$enableval"])
+
+if test $dah != "no"; then
+  AC_DEFINE(OWN_WINDOW, 1, [Define if you want support for window creating])
+fi
+
+dnl
+dnl DOUBLE_BUFFER option
+dnl
+
+dah=yes
+AC_ARG_ENABLE(double_buffer,
+[  --enable-double-buffer  enable if you want to support flicker-free operation [default=yes]],
+  [dah="$enableval"])
+
+if test $dah != "no"; then
+  AC_DEFINE(DOUBLE_BUFFER, 1, [Define if you want support for the DBE extension])
+  AC_CHECK_HEADERS([X11/extensions/Xdbe.h], [AC_DEFINE([HAVE_XDBE], 1, [Xdbe])], [XDBE_MISSING=yes])
+  if test "x$XDBE_MISSING" = xyes; then
+      AC_MSG_ERROR([something went wrong when checking for Xdbe (double buffer extension])
+  fi
+fi
+
+dnl
+dnl PROC_UPTIME option
+dnl
+
+dah=no
+AC_ARG_ENABLE(proc_uptime,
+[  --enable-proc-uptime    enable using /proc/uptime for uptime [default=no]],
+  [dah="$enableval"])
+
+if test $dah = "yes"; then
+  AC_DEFINE(PROC_UPTIME, 1, [Define if you want to use /proc/uptime for uptime])
+fi
+
+dnl
+dnl Seti@Home
+dnl
+
+want_seti=no
+AC_ARG_ENABLE(seti,
+[  --enable-seti           enable if you want SETI at Home stats [default=no]],
+  [want_seti="$enableval"])
+
+AM_CONDITIONAL(BUILD_SETI, test x$want_seti == xyes)
+if test x$want_seti == xyes; then
+  AC_DEFINE(SETI, 1, [Define if you want SETI at Home stats])
+fi
+
+dnl
+dnl MPD
+dnl
+
+want_mpd=no
+AC_ARG_ENABLE(mpd,
+[  --enable-mpd           enable if you want MPD support [default=no]],
+  [want_mpd="$enableval"])
+
+AM_CONDITIONAL(BUILD_MPD, test x$want_mpd == xyes)
+if test x$want_mpd == xyes; then
+  AC_DEFINE(MPD, 1, [Define if you want MPD support])
+fi
+
+dnl
+dnl Cairo
+dnl
+
+want_cairo=no
+AC_ARG_ENABLE(cairo,
+[  --enable-cairo           enable if you want Cairo support [default=no]],
+  [want_cairo="$enableval"])
+
+AM_CONDITIONAL(BUILD_CAIRO, test x$want_cairo == xyes)
+
+
+if test "$want_cairo" = "yes"; then
+  AC_CHECK_HEADERS([cairo.h cairo-xlib.h], [], [CAIRO_MISSING=yes])
+    if test "x$CAIRO_MISSING" = xyes; then
+      AC_MSG_ERROR([something went wrong when checking for cairo, you're probably missing headers or it's not installed])
+  fi
+  AC_PATH_PROG(CAIROCONFIG, pkg-config)
+  if test x$CAIROCONFIG != x; then
+    dnl TODO: needs more checks
+
+    AC_DEFINE(CAIRO, 1, [Define if you are using Cairo])
+    CFLAGS="$CFLAGS `$CAIROCONFIG --cflags cairo` `$CAIROCONFIG --libs cairo` "
+    CAIRO_LIBS="`$CAIROCONFIG --libs cairo` `$CAIROCONFIG --cflags cairo`"
+  else
+    want_cairo=no
+  fi
+fi
+
+dnl metar
+dnl
+
+want_metar=no
+AC_ARG_ENABLE(metar,
+[  --enable-metar       enable if you want metar stats (weather information) [default=no]],
+  [want_metar="$enableval"])
+
+AM_CONDITIONAL(BUILD_METAR, test x$want_metar == xyes)
+if test x$want_metar == xyes; then
+AC_CHECK_HEADERS([metar.h], [], [METAR_MISSING=yes])
+    if test "x$METAR_MISSING" = xyes; then
+      AC_MSG_ERROR([something went wrong when checking for mdsplib, you're probably missing headers or it's not installed])
+  fi
+  AC_DEFINE(METAR, 1, [Define if you want metar stats (weather information)])
+fi
+dnl
+
+
+
+dnl
+dnl MLDonkey
+dnl
+
+want_mldonkey=no
+AC_ARG_ENABLE(mldonkey,
+[  --enable-mldonkey       enable if you want MLDonkey support [default=no]],
+  [want_mldonkey="$enableval"])
+
+AM_CONDITIONAL(BUILD_MLDONKEY, test x$want_mldonkey == xyes)
+if test x$want_mldonkey == xyes; then
+  AC_DEFINE(MLDONKEY, 1, [Define if you want MLDonkey support])
+fi
+
+dnl
+dnl C Compiler
+dnl
+
+AC_PROG_CC
+
+dnl
+dnl X
+dnl
+
+AC_PATH_X
+if test $have_x != "yes"; then
+  echo "Sorry, X is very much needed"
+  exit 1
+fi
+AC_DEFINE(HAVE_X11, 1, [Define if you have X11])
+
+dnl AC_CHECK_LIB([X11], [XOpenDisplay], [X11_LIBS="-lX11"], [], [[-L$x_libraries]])
+dnl AC_CHECK_LIB([Xext], [XdbeQueryExtension], [
+dnl   X11_LIBS="$X11_LIBS -lXext"
+dnl   AC_DEFINE(HAVE_LIBXEXT, 1, [Define if you have libXext])
+dnl ], [], [[-L$x_libraries $X11_LIBS]])
+
+if test "$x_libraries" != ""; then
+  LDFLAGS="$LDFLAGS -L$x_libraries"
+fi
+
+if test "$x_includes" != ""; then
+  CFLAGS="$CFLAGS -Wall -I$x_includes"
+fi
+
+dnl
+dnl Xft
+dnl
+
+if test "$want_xft" = "yes"; then
+  AC_PATH_PROG(XFTCONFIG, xft-config)
+  if test x$XFTCONFIG != x; then
+    dnl TODO: needs more checks
+  
+dnl This won't work for some reason
+dnl  AC_CHECK_HEADERS([X11/Xft/Xft.h], [], [XFT_MISSING=yes])
+    if test "x$XFT_MISSING" = xyes; then
+      AC_MSG_ERROR([something went wrong when checking for Xft, you're probably missing headers or it's not installed])
+  fi
+
+    AC_DEFINE(XFT, 1, [Define if you are using Xft])
+    CFLAGS="$CFLAGS `$XFTCONFIG --cflags`"
+    XFT_LIBS=`$XFTCONFIG --libs`
+  else
+    want_xft=no
+  fi
+fi
+
+dnl
+dnl KVM
+dnl
+
+if test x$WANT_KVM = xyes; then
+  AC_CHECK_LIB(kvm, kvm_open,
+       LIBS="$LIBS -lkvm",
+       AC_MSG_ERROR([Could not find kvm_open in -lkvm.])
+  )
+fi
+
+dnl
+dnl OSSLIB for NetBSD
+dnl
+
+if test x$WANT_OSSLIB = xyes; then
+    AC_CHECK_LIB(ossaudio, _oss_ioctl,
+       LIBS="$LIBS -lossaudio",
+       AC_MSG_ERROR([Could not find oss_ioctl in -lossaudio.])
+    )
+fi
+
+dnl
+dnl Some random headers
+dnl
+
+
+AC_CHECK_HEADERS([signal.h unistd.h X11/Xlib.h sys/utsname.h sys/stat.h linux/soundcard.h dirent.h])
+AC_CHECK_HEADERS([sys/statfs.h sys/param.h sys/mount.h])
+dnl For cairo
+AC_CHECK_HEADERS([proc/procps.h proc/readproc.h], [], [PROCPS_MISSING=yes])
+  if test "x$PROCPS_MISSING" = xyes; then
+      AC_MSG_ERROR([something went wrong when checking for procps, you're probably missing the necessary headers])
+  fi
+
+dnl
+dnl Check help2man
+dnl
+
+AC_PATH_PROG(HELP2MAN, help2man)
+AM_CONDITIONAL(HAVE_HELP2MAN, test x$HELP2MAN != x)
+
+dnl
+dnl Check sysinfo()
+dnl
+
+if test x$WANT_SYSINFO = xyes; then
+  dah=no
+  AC_MSG_CHECKING(for sysinfo)
+  AC_TRY_COMPILE(
+    [#include <sys/types.h>
+     #include <sys/sysinfo.h>],
+    [struct sysinfo s; sysinfo(&s); (void) s.uptime; ],
+    [AC_MSG_RESULT(yes); dah=yes],
+    [AC_MSG_RESULT(not usable); dah=no])
+
+  if test x$dah = xyes; then
+    AC_DEFINE(HAVE_SYSINFO, 1, [Define if you have sysinfo (Linux)])
+  fi
+fi
+
+dnl
+dnl kstat in Solaris
+dnl
+
+if test x$WANT_KSTAT = xyes; then
+  dah=no
+  AC_CHECK_LIB([kstat], [kstat_open], [dah=yes], [])
+
+  if test x$dah = xyes; then
+    AC_DEFINE(HAVE_KSTAT, 1, [Define if you have kstat (Solaris)])
+    LDFLAGS="$LDFLAGS -lkstat"
+  fi
+fi
+
+dnl
+dnl Check getloadavg
+dnl
+
+AC_MSG_CHECKING(for getloadavg)
+AC_TRY_COMPILE(
+  [#include <stdlib.h>],
+  [double v[3]; getloadavg(v, 3);],
+  [AC_MSG_RESULT(yes)
+   AC_DEFINE(HAVE_GETLOADAVG, 1, [Define if you have getloadavg])],
+  [AC_MSG_RESULT(no)])
+
+dnl
+dnl Check popen
+dnl
+
+AC_CHECK_FUNCS(popen)
+
+dnl
+dnl Da.
+dnl
+
+CFLAGS="$CFLAGS -Wall -W"
+
+AC_SUBST(CFLAGS)
+AC_SUBST(X11_LIBS)
+AC_SUBST(XFT_LIBS)
+
+AC_OUTPUT(Makefile)
diff --git a/conky.1 b/conky.1
new file mode 100644 (file)
index 0000000..f74d1ef
--- /dev/null
+++ b/conky.1
@@ -0,0 +1,67 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.33.
+.TH CONKY "1" "July 2005" "Conky 1.2 compiled Jul 18 2005" "User Commands"
+.SH NAME
+Conky
+.SH SYNOPSIS
+.B conky
+[\fIOPTION\fR]...
+.SH DESCRIPTION
+.\" Add any additional description here
+.PP
+Conky is a system monitor that renders text on desktop or to own transparent
+window. Command line options will override configurations defined in config
+file.
+.TP
+\fB\-V\fR
+version
+.TP
+\fB\-a\fR ALIGNMENT
+text alignment on screen, {top,bottom}_{left,right}
+.TP
+\fB\-c\fR FILE
+config file to load instead of $HOME/.conkyrc
+.TP
+\fB\-d\fR
+daemonize, fork to background
+.TP
+\fB\-f\fR FONT
+font to use
+.TP
+\fB\-h\fR
+help
+.TP
+\fB\-o\fR
+create own window to draw
+.TP
+\fB\-b\fR
+double buffer (prevents flickering)
+.TP
+\fB\-t\fR TEXT
+text to render, remember single quotes, like \fB\-t\fR '$uptime'
+.TP
+\fB\-u\fR SECS
+update interval
+.TP
+\fB\-i\fR NUM
+number of times to update Conky
+.TP
+\fB\-w\fR WIN_ID
+window id to draw
+.TP
+\fB\-x\fR X
+x position
+.TP
+\fB\-y\fR Y
+y position
+.SH EXAMPLES
+.B
+conky -t '${time %D %H:%m}' -o -u 30
+.PP
+Start Conky in its own window with date and clock as text and 30 sec update interval.
+
+.B
+conky -a top_left -x 5 -y 500 -d
+.PP
+Start Conky to background at coordinates (5, 500).
+.SH FILES
+~/.conkyrc default configuration file
diff --git a/conky.c b/conky.c
new file mode 100644 (file)
index 0000000..c81b761
--- /dev/null
+++ b/conky.c
@@ -0,0 +1,3731 @@
+/* Conky, a system monitor, based on torsmo
+ *
+ * This program is licensed under BSD license, read COPYING
+ */
+
+#include "conky.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <time.h>
+#include <locale.h>
+#include <signal.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <string.h>
+#include <limits.h>
+#if HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+#include <sys/time.h>
+#include <X11/Xutil.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+  
+#define CONFIG_FILE "$HOME/.conkyrc"
+#define MAIL_FILE "$MAIL"
+#define MAX_IF_BLOCK_DEPTH 5
+
+/* alignments */
+enum alignment {
+       TOP_LEFT = 1,
+       TOP_RIGHT,
+       BOTTOM_LEFT,
+       BOTTOM_RIGHT,
+};
+
+/* default config file */
+static char *current_config;
+
+/* set to 1 if you want all text to be in uppercase */
+static unsigned int stuff_in_upper_case;
+
+/* Position on the screen */
+static int text_alignment;
+static int gap_x, gap_y;
+
+/* Font used */
+static char *font_name;
+
+/* Update interval */
+static double update_interval;
+
+/* Run how many times? */
+static unsigned long total_run_times;
+
+/* fork? */
+static int fork_to_background;
+
+/* border */
+static int draw_borders;
+static int stippled_borders;
+
+static int draw_shades, draw_outline;
+
+static int border_margin, border_width;
+
+static long default_fg_color, default_bg_color, default_out_color;
+
+static int cpu_avg_samples, net_avg_samples;
+
+/*#ifdef OWN_WINDOW*/
+/* create own window or draw stuff to root? */
+static int own_window = 0;
+
+/* fixed size/pos is set if wm/user changes them */
+static int fixed_size = 0, fixed_pos = 0;
+/*#endif*/
+
+static int minimum_width, minimum_height;
+
+/* no buffers in used memory? */
+int no_buffers;
+
+/* pad percentages to decimals? */
+static int pad_percents = 0;
+
+/* Text that is shown */
+static char original_text[] =
+    "$nodename - $sysname $kernel on $machine\n"
+    "$hr\n"
+    "${color grey}Uptime:$color $uptime\n"
+    "${color grey}Frequency (in MHz):$color $freq\n"
+    "${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}\n"
+    "${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}\n"
+    "${color grey}CPU Usage:$color $cpu% ${cpubar 4}\n"
+    "${color grey}Processes:$color $processes  ${color grey}Running:$color $running_processes\n"
+    "$hr\n"
+    "${color grey}File systems:\n"
+    " / $color${fs_free /}/${fs_size /} ${fs_bar 6 /}\n"
+    "${color grey}Networking:\n"
+    " Up:$color ${upspeed eth0} k/s${color grey} - Down:$color ${downspeed eth0} k/s\n"
+    "${color grey}Temperatures:\n"
+    " CPU:$color ${i2c temp 1}°C${color grey} - MB:$color ${i2c temp 2}°C\n"
+    "$hr\n"
+#ifdef SETI
+    "${color grey}SETI@Home Statistics:\n"
+    "${color grey}Seti Unit Number:$color $seti_credit\n"
+    "${color grey}Seti Progress:$color $seti_prog% $seti_progbar\n"
+#endif
+#ifdef MPD
+    "${color grey}MPD: $mpd_status $mpd_artist - $mpd_title from $mpd_album at $mpd_vol\n"
+    "Bitrate: $mpd_bitrate\n"
+    "Progress: $mpd_bar\n"
+#endif
+    "${color grey}Name         PID     CPU%    MEM%\n"
+    " ${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}\n"
+    " ${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}\n"
+    " ${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}\n"
+    " ${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}\n"
+               "${tail /var/log/Xorg.0.log 3}" ;
+
+static char *text = original_text;
+
+static int total_updates;
+
+/* font stuff */
+
+static XFontStruct *font;
+
+#ifdef XFT
+static XftFont *xftfont;
+static int font_alpha = 65535;
+#endif
+
+/* if-blocks */
+ static int blockdepth = 0;
+ static int if_jumped = 0;
+ static int blockstart[MAX_IF_BLOCK_DEPTH];
+ int check_mount (char* s)
+ {
+   int ret=0;
+   FILE* mtab = fopen("/etc/mtab","r");
+   if(mtab) {
+     char buf1[256],buf2[128];
+     while(fgets (buf1,256,mtab))
+     {
+       sscanf(buf1,"%*s %128s",buf2);
+       if(!strcmp(s,buf2)) { ret=1; break; }
+    }
+   fclose(mtab);
+  } else { ERR("Could not open mtab"); }
+   return ret;
+}
+
+
+static inline int calc_text_width(const char *s, unsigned int l)
+{
+#ifdef XFT
+       if (use_xft) {
+               XGlyphInfo gi;
+               XftTextExtents8(display, xftfont, s, l, &gi);
+               return gi.xOff;
+       } else
+#endif
+       {
+               return XTextWidth(font, s, l);
+       }
+}
+
+#ifdef XFT
+
+#define font_height() use_xft ? (xftfont->ascent + xftfont->descent) : \
+    (font->max_bounds.ascent + font->max_bounds.descent)
+#define font_ascent() use_xft ? xftfont->ascent : font->max_bounds.ascent
+#define font_descent() use_xft ? xftfont->descent : font->max_bounds.descent
+
+#else
+
+#define font_height() (font->max_bounds.ascent + font->max_bounds.descent)
+#define font_ascent() font->max_bounds.ascent
+#define font_descent() font->max_bounds.descent
+
+#endif
+
+/* formatted text to render on screen, generated in generate_text(),
+ * drawn in draw_stuff() */
+
+static char text_buffer[TEXT_BUFFER_SIZE*4];
+
+/* special stuff in text_buffer */
+
+#define SPECIAL_CHAR '\x01'
+
+enum {
+       HORIZONTAL_LINE,
+       STIPPLED_HR,
+       BAR,
+       FG,
+       BG,
+       OUTLINE,
+       ALIGNR,
+       ALIGNC,
+};
+
+static struct special_t {
+       int type;
+       short height;
+       short width;
+       long arg;
+} specials[128];
+
+static int special_count;
+static int special_index;      /* used when drawing */
+
+static struct special_t *new_special(char *buf, int t)
+{
+       if (special_count >= 128)
+               CRIT_ERR("too much special things in text");
+
+       buf[0] = SPECIAL_CHAR;
+       buf[1] = '\0';
+       specials[special_count].type = t;
+       return &specials[special_count++];
+}
+
+typedef struct tailstring_list {
+       char data[TEXT_BUFFER_SIZE];
+       struct tailstring_list *next;
+} tailstring;
+
+void addtail(tailstring **head, char *data_in) {
+       tailstring *tmp;
+       if ((tmp = malloc(sizeof(*tmp))) == NULL) {
+               CRIT_ERR("malloc");
+       }
+       strncpy(tmp->data, data_in, TEXT_BUFFER_SIZE);
+       tmp->next = *head;
+       *head = tmp;
+}
+
+void freetail(tailstring *head) {
+         tailstring *tmp;
+
+         while (head != NULL) {
+                 tmp = head->next;
+                 free(head);
+                 head = tmp;
+         }
+  }
+
+
+static void new_bar(char *buf, int w, int h, int usage)
+{
+       struct special_t *s = new_special(buf, BAR);
+       s->arg = (usage > 255) ? 255 : ((usage < 0) ? 0 : usage);
+       s->width = w;
+       s->height = h;
+}
+
+static const char *scan_bar(const char *args, int *w, int *h)
+{
+       *w = 0;                 /* zero width means all space that is available */
+       *h = 4;
+       /* bar's argument is either height or height,width */
+       if (args) {
+               int n = 0;
+               if (sscanf(args, "%d,%d %n", h, w, &n) <= 1)
+                       sscanf(args, "%d %n", h, &n);
+               args += n;
+       }
+
+       return args;
+}
+
+static inline void new_hr(char *buf, int a)
+{
+       new_special(buf, HORIZONTAL_LINE)->height = a;
+}
+
+static inline void new_stippled_hr(char *buf, int a, int b)
+{
+       struct special_t *s = new_special(buf, STIPPLED_HR);
+       s->height = b;
+       s->arg = a;
+}
+
+static inline void new_fg(char *buf, long c)
+{
+       new_special(buf, FG)->arg = c;
+}
+
+static inline void new_bg(char *buf, long c)
+{
+       new_special(buf, BG)->arg = c;
+}
+
+static inline void new_outline(char *buf, long c)
+{
+       new_special(buf, OUTLINE)->arg = c;
+}
+
+static inline void new_alignr(char *buf, long c) {
+       new_special(buf, ALIGNR)->arg = c;
+}
+
+static inline void new_alignc(char *buf, long c) {
+       new_special(buf, ALIGNC)->arg = c;
+}
+
+/* quite boring functions */
+
+static inline void for_each_line(char *b, void (*f) (char *))
+{
+       char *ps, *pe;
+
+       for (ps = b, pe = b; *pe; pe++) {
+               if (*pe == '\n') {
+                       *pe = '\0';
+                       f(ps);
+                       *pe = '\n';
+                       ps = pe + 1;
+               }
+       }
+
+       if (ps < pe)
+               f(ps);
+}
+
+static void convert_escapes(char *buf)
+{
+       char *p = buf, *s = buf;
+
+       while (*s) {
+               if (*s == '\\') {
+                       s++;
+                       if (*s == 'n')
+                               *p++ = '\n';
+                       else if (*s == '\\')
+                               *p++ = '\\';
+                       s++;
+               } else
+                       *p++ = *s++;
+       }
+       *p = '\0';
+}
+
+/* converts from bytes to human readable format (k, M, G) */
+static void human_readable(long long a, char *buf, int size)
+{
+       if (a >= 1024 * 1024 * 1024)
+               snprintf(buf, size, "%.2fG", (a / 1024 / 1024) / 1024.0);
+       else if (a >= 1024 * 1024) {
+               double m = (a / 1024) / 1024.0;
+               if (m >= 100.0)
+                       snprintf(buf, size, "%.0fM", m);
+               else
+                       snprintf(buf, size, "%.1fM", m);
+       } else if (a >= 1024)
+               snprintf(buf, size, "%Ldk", a / (long long) 1024);
+       else
+               snprintf(buf, size, "%Ld", a);
+}
+
+/* text handling */
+
+enum text_object_type {
+       OBJ_acpiacadapter,
+       OBJ_adt746xcpu,
+       OBJ_adt746xfan,
+       OBJ_acpifan,
+  OBJ_addr,
+  OBJ_linkstatus,
+       OBJ_acpitemp,
+       OBJ_battery,
+       OBJ_buffers,
+       OBJ_cached,
+       OBJ_color,
+       OBJ_cpu,
+       OBJ_cpubar,
+       OBJ_downspeed,
+       OBJ_downspeedf,
+       OBJ_else,
+       OBJ_endif,
+       OBJ_exec,
+       OBJ_execi,
+       OBJ_execbar,
+       OBJ_freq,
+       OBJ_fs_bar,
+       OBJ_fs_bar_free,
+       OBJ_fs_free,
+       OBJ_fs_free_perc,
+       OBJ_fs_size,
+       OBJ_fs_used,
+       OBJ_fs_used_perc,
+       OBJ_hr,
+       OBJ_alignr,
+       OBJ_alignc,
+       OBJ_i2c,
+       OBJ_if_existing,
+       OBJ_if_mounted,
+       OBJ_if_running,
+       OBJ_top,
+       OBJ_tail,
+       OBJ_kernel,
+       OBJ_loadavg,
+       OBJ_machine,
+       OBJ_mails,
+       OBJ_mem,
+       OBJ_membar,
+       OBJ_memmax,
+       OBJ_memperc,
+       OBJ_mixer,
+       OBJ_mixerl,
+       OBJ_mixerr,
+       OBJ_mixerbar,
+       OBJ_mixerlbar,
+       OBJ_mixerrbar,
+       OBJ_new_mails,
+       OBJ_nodename,
+       OBJ_pre_exec,
+#ifdef MLDONKEY
+OBJ_ml_upload_counter,
+         OBJ_ml_download_counter,
+          OBJ_ml_nshared_files,
+          OBJ_ml_shared_counter,
+          OBJ_ml_tcp_upload_rate,
+          OBJ_ml_tcp_download_rate,
+          OBJ_ml_udp_upload_rate,
+          OBJ_ml_udp_download_rate,
+          OBJ_ml_ndownloaded_files,
+          OBJ_ml_ndownloading_files,
+#endif
+       OBJ_processes,
+       OBJ_running_processes,
+       OBJ_shadecolor,
+       OBJ_outlinecolor,
+       OBJ_stippled_hr,
+       OBJ_swap,
+       OBJ_swapbar,
+       OBJ_swapmax,
+       OBJ_swapperc,
+       OBJ_sysname,
+       OBJ_temp1,              /* i2c is used instead in these */
+       OBJ_temp2,
+       OBJ_text,
+       OBJ_time,
+       OBJ_utime,
+       OBJ_totaldown,
+       OBJ_totalup,
+       OBJ_updates,
+       OBJ_upspeed,
+       OBJ_upspeedf,
+       OBJ_uptime,
+       OBJ_uptime_short,
+#ifdef SETI
+       OBJ_seti_prog,
+       OBJ_seti_progbar,
+       OBJ_seti_credit,
+#endif
+#ifdef MPD
+       OBJ_mpd_title,
+       OBJ_mpd_artist,
+       OBJ_mpd_album,
+       OBJ_mpd_vol,
+       OBJ_mpd_bitrate,
+       OBJ_mpd_status,
+       OBJ_mpd_host,
+       OBJ_mpd_port,
+       OBJ_mpd_bar,
+#endif
+#ifdef METAR
+  OBJ_metar_ob_time,
+  OBJ_metar_temp,
+  OBJ_metar_tempf,
+  OBJ_metar_windchill,
+  OBJ_metar_dew_point,
+  OBJ_metar_rh,
+  OBJ_metar_windspeed,
+  OBJ_metar_winddir,
+  OBJ_metar_swinddir,
+  OBJ_metar_cloud,
+  OBJ_metar_u2d_time,
+#endif
+};
+
+struct text_object {
+       int type;
+       union {
+               char *s;        /* some string */
+               int i;          /* some integer */
+               long l;         /* some other integer */
+               struct net_stat *net;
+               struct fs_stat *fs;
+               unsigned char loadavg[3];
+
+               struct {
+                       struct fs_stat *fs;
+                       int w, h;
+               } fsbar;        /* 3 */
+
+               struct {
+                       int l;
+                       int w, h;
+               } mixerbar;     /* 3 */
+
+               struct {
+                       int fd;
+                       int arg;
+                       char devtype[256];
+                       char type[64];
+               } i2c;          /* 2 */
+               struct {
+                      int pos;
+                      char* s;
+               } ifblock;
+               struct {
+                       int num;
+                       int type;
+               } top;
+
+                       struct {
+                       int wantedlines;
+                       int readlines;
+                       char *logfile;
+                       double last_update;
+                       float interval;
+                       char buffer[TEXT_BUFFER_SIZE*4];
+       } tail;
+
+               struct {
+                       double last_update;
+                       float interval;
+                       char *cmd;
+                       char *buffer;
+               } execi;        /* 5 */
+
+               struct {
+                       int a, b;
+               } pair;         /* 2 */
+
+
+       } data;
+};
+
+static unsigned int text_object_count;
+static struct text_object *text_objects;
+
+/* new_text_object() allocates a new zeroed text_object */
+static struct text_object *new_text_object()
+{
+       text_object_count++;
+       text_objects = (struct text_object *) realloc(text_objects,
+                                                     sizeof(struct
+                                                            text_object) *
+                                                     text_object_count);
+       memset(&text_objects[text_object_count - 1], 0,
+              sizeof(struct text_object));
+
+       return &text_objects[text_object_count - 1];
+}
+
+static void free_text_objects()
+{
+       unsigned int i;
+
+       for (i = 0; i < text_object_count; i++) {
+               switch (text_objects[i].type) {
+               case OBJ_acpitemp:
+                       close(text_objects[i].data.i);
+                       break;
+
+               case OBJ_i2c:
+                       close(text_objects[i].data.i2c.fd);
+                       break;
+               case OBJ_time:
+               case OBJ_utime:
+       case OBJ_if_existing:
+       case OBJ_if_mounted:
+       case OBJ_if_running:
+         free(text_objects[i].data.ifblock.s);
+       break;
+               case OBJ_text:
+               case OBJ_exec:
+               case OBJ_execbar:
+#ifdef MPD
+               case OBJ_mpd_title:
+                       case OBJ_mpd_artist:
+                       case OBJ_mpd_album:
+                       case OBJ_mpd_status:
+                       case OBJ_mpd_host:
+#endif
+               case OBJ_pre_exec:
+               case OBJ_battery:
+                       free(text_objects[i].data.s);
+                       break;
+
+               case OBJ_execi:
+                       free(text_objects[i].data.execi.cmd);
+                       free(text_objects[i].data.execi.buffer);
+                       break;
+               }
+       }
+
+       free(text_objects);
+       text_objects = NULL;
+       text_object_count = 0;
+}
+
+void scan_mixer_bar(const char *arg, int *a, int *w, int *h)
+{
+       char buf1[64];
+       int n;
+
+       if (arg && sscanf(arg, "%63s %n", buf1, &n) >= 1) {
+               *a = mixer_init(buf1);
+               (void) scan_bar(arg + n, w, h);
+       } else {
+               *a = mixer_init(0);
+               (void) scan_bar(arg, w, h);
+       }
+}
+
+/* construct_text_object() creates a new text_object */
+static void construct_text_object(const char *s, const char *arg)
+{
+       struct text_object *obj = new_text_object();
+
+#define OBJ(a, n) if (strcmp(s, #a) == 0) { obj->type = OBJ_##a; need_mask |= (1 << n); {
+#define END ; } } else
+
+       if (s[0] == '#') {
+               obj->type = OBJ_color;
+               obj->data.l = get_x11_color(s);
+       } else
+               OBJ(acpitemp, 0) obj->data.i = open_acpi_temperature(arg);
+       END OBJ(acpiacadapter, 0)
+       END OBJ(freq, 0) END OBJ(acpifan, 0) END OBJ(battery,
+                                                    0) char bat[64];
+       if (arg)
+               sscanf(arg, "%63s", bat);
+       else
+               strcpy(bat, "BAT0");
+       obj->data.s = strdup(bat);
+       END OBJ(buffers, INFO_BUFFERS)
+       END OBJ(cached, INFO_BUFFERS)
+       END OBJ(cpu, INFO_CPU)
+       END OBJ(cpubar, INFO_CPU)
+        (void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
+       END OBJ(color, 0) obj->data.l =
+           arg ? get_x11_color(arg) : default_fg_color;
+       END OBJ(downspeed, INFO_NET) obj->data.net = get_net_stat(arg);
+       END OBJ(downspeedf, INFO_NET) obj->data.net = get_net_stat(arg);
+       END
+                          OBJ(else,0)
+                               if(blockdepth) {
+                         text_objects[blockstart[blockdepth-1]-1].data.ifblock.pos = text_object_count;
+                         blockstart[blockdepth-1] = text_object_count;
+                         obj->data.ifblock.pos = text_object_count + 2;
+                    } else { ERR("$else: no matching $if_*"); }
+                  END
+                                  OBJ(endif,0)
+                                    if(blockdepth) {
+                              blockdepth--;
+                              text_objects[blockstart[blockdepth]-1].data.ifblock.pos = text_object_count;
+                            } else { ERR("$endif: no matching $if_*"); }
+                          END
+#ifdef HAVE_POPEN
+       OBJ(exec, 0) obj->data.s = strdup(arg ? arg : "");
+       END
+       OBJ(execbar, 0) 
+               obj->data.s = strdup(arg ? arg : "");
+       END
+       OBJ(execi, 0) unsigned int n;
+
+       if (!arg
+           || sscanf(arg, "%f %n", &obj->data.execi.interval, &n) <= 0) {
+               char buf[256];
+               ERR("${execi <interval> command}");
+               obj->type = OBJ_text;
+               snprintf(buf, 256, "${%s}", s);
+               obj->data.s = strdup(buf);
+       } else {
+               obj->data.execi.cmd = strdup(arg + n);
+               obj->data.execi.buffer =
+                   (char *) calloc(1, TEXT_BUFFER_SIZE);
+       }
+       END OBJ(pre_exec, 0) obj->type = OBJ_text;
+       if (arg) {
+               FILE *fp = popen(arg, "r");
+               unsigned int n;
+               char buf[2048];
+
+               n = fread(buf, 1, 2048, fp);
+               buf[n] = '\0';
+
+               if (n && buf[n - 1] == '\n')
+                       buf[n - 1] = '\0';
+
+               (void) pclose(fp);
+
+               obj->data.s = strdup(buf);
+       } else
+               obj->data.s = strdup("");
+       END
+#endif
+           OBJ(fs_bar, INFO_FS) obj->data.fsbar.h = 4;
+       arg = scan_bar(arg, &obj->data.fsbar.w, &obj->data.fsbar.h);
+       if (arg) {
+               while (isspace(*arg))
+                       arg++;
+               if (*arg == '\0')
+                       arg = "/";
+       } else
+               arg = "/";
+       obj->data.fsbar.fs = prepare_fs_stat(arg);
+       END OBJ(fs_bar_free, INFO_FS) obj->data.fsbar.h = 4;
+       if (arg) {
+               unsigned int n;
+               if (sscanf(arg, "%d %n", &obj->data.fsbar.h, &n) >= 1)
+                       arg += n;
+       } else
+               arg = "/";
+       obj->data.fsbar.fs = prepare_fs_stat(arg);
+       END OBJ(fs_free, INFO_FS) if (!arg)
+                arg = "/";
+       obj->data.fs = prepare_fs_stat(arg);
+       END OBJ(fs_used_perc, INFO_FS) if (!arg)
+                arg = "/";
+       obj->data.fs = prepare_fs_stat(arg);
+       END OBJ(fs_free_perc, INFO_FS) if (!arg)
+                arg = "/";
+       obj->data.fs = prepare_fs_stat(arg);
+       END OBJ(fs_size, INFO_FS) if (!arg)
+                arg = "/";
+       obj->data.fs = prepare_fs_stat(arg);
+       END OBJ(fs_used, INFO_FS) if (!arg)
+                arg = "/";
+       obj->data.fs = prepare_fs_stat(arg);
+       END OBJ(hr, 0) obj->data.i = arg ? atoi(arg) : 1;
+       END OBJ(i2c, INFO_I2C) char buf1[64], buf2[64];
+       int n;
+
+       if (!arg) {
+               ERR("i2c needs arguments");
+               obj->type = OBJ_text;
+               obj->data.s = strdup("${i2c}");
+               return;
+       }
+
+       if (sscanf(arg, "%63s %63s %d", buf1, buf2, &n) != 3) {
+               /* if scanf couldn't read three values, read type and num and use
+                * default device */
+               sscanf(arg, "%63s %d", buf2, &n);
+               obj->data.i2c.fd =
+                   open_i2c_sensor(0, buf2, n, &obj->data.i2c.arg,
+                                   obj->data.i2c.devtype);
+               strcpy(obj->data.i2c.type, buf2);
+       } else {
+               obj->data.i2c.fd =
+                   open_i2c_sensor(buf1, buf2, n, &obj->data.i2c.arg,
+                                   obj->data.i2c.devtype);
+               strcpy(obj->data.i2c.type, buf2);
+       }
+       
+       END OBJ(top, INFO_TOP)
+                       char buf[64];
+       int n;
+       if(!arg) {
+               ERR("top needs arguments");
+               obj->type = OBJ_text;
+               obj->data.s = strdup("${top}");
+               return;
+       }
+       if(sscanf(arg, "%63s %i", buf, &n) == 2) {
+               if(strcmp(buf, "name") == 0) {
+                       obj->data.top.type = TOP_NAME;
+               }
+               else if(strcmp(buf, "cpu") == 0) {
+                       obj->data.top.type = TOP_CPU;
+               }
+               else if(strcmp(buf, "pid") == 0) {
+                       obj->data.top.type = TOP_PID;
+               }
+               else if(strcmp(buf, "mem") == 0) {
+                       obj->data.top.type = TOP_MEM;
+               }
+               else
+               {
+                       ERR("invalid arg for top");
+                       return;
+               }
+               if(n < 1 || n > 10) {
+                       CRIT_ERR("invalid arg for top");
+                       return;
+               }
+               else {
+                       obj->data.top.num = n-1;
+               }
+       }
+       else {
+               ERR("invalid args given for top");
+               return;
+       }
+       END 
+  OBJ(addr, INFO_NET)
+     obj->data.net = get_net_stat(arg);
+  END
+  OBJ(linkstatus, INFO_WIFI)
+     obj->data.net = get_net_stat(arg);
+  END
+        OBJ(tail, 0)
+       char buf[64];
+       int n1, n2;
+       if(!arg) {
+               ERR("tail needs arguments");
+               obj->type = OBJ_text;
+               obj->data.s = strdup("${tail}");
+               return;
+       }
+       if(sscanf(arg, "%63s %i %i", buf, &n1, &n2) == 2) {
+               if(n1 < 1 || n1 > 30) {
+                       CRIT_ERR("invalid arg for tail, number of lines must be between 1 and 30");
+                       return;
+               }
+               else {
+                       FILE * fp;
+                       fp = fopen (buf,"rt");
+                       if (fp != NULL) {
+                               obj->data.tail.logfile = malloc(TEXT_BUFFER_SIZE);
+                               strcpy(obj->data.tail.logfile, buf);
+                               obj->data.tail.wantedlines = n1-1;
+                               obj->data.tail.interval = update_interval*2;
+                               fclose (fp);
+                       }
+                       else {
+                               //fclose (fp);
+                               CRIT_ERR("tail logfile does not exist, or you do not have correct permissions");
+                       }
+               }
+       }
+       else if (sscanf(arg, "%63s %i %i", buf, &n1, &n2) == 3) {
+               if(n1 < 1 || n1 > 30) {
+                       CRIT_ERR("invalid arg for tail, number of lines must be between 1 and 30");
+                       return;
+               }
+               else if(n2 < 1 || n2 < update_interval) {
+                       CRIT_ERR("invalid arg for tail, interval must be greater than 0 and Conky's interval");
+                       return;
+               }
+               else {
+                       FILE * fp;
+                       fp = fopen (buf,"rt");
+                       if (fp != NULL) {
+                               obj->data.tail.logfile = malloc(TEXT_BUFFER_SIZE);
+                               strcpy(obj->data.tail.logfile, buf);
+                               obj->data.tail.wantedlines = n1-1;
+                               obj->data.tail.interval = n2;
+                               fclose (fp);
+                       }
+                       else {
+                               //fclose (fp);
+                               CRIT_ERR("tail logfile does not exist, or you do not have correct permissions");
+                       }
+               }
+       }
+
+       else {
+               ERR("invalid args given for tail");
+               return;
+       }
+                       END 
+                       OBJ(loadavg, INFO_LOADAVG) int a = 1, b = 2, c = 3, r = 3;
+       if (arg) {
+               r = sscanf(arg, "%d %d %d", &a, &b, &c);
+               if (r >= 3 && (c < 1 || c > 3))
+                       r--;
+               if (r >= 2 && (b < 1 || b > 3))
+                       r--, b = c;
+               if (r >= 1 && (a < 1 || a > 3))
+                       r--, a = b, b = c;
+       }
+       obj->data.loadavg[0] = (r >= 1) ? (unsigned char) a : 0;
+       obj->data.loadavg[1] = (r >= 2) ? (unsigned char) b : 0;
+       obj->data.loadavg[2] = (r >= 3) ? (unsigned char) c : 0;
+       END
+                          OBJ(if_existing,0)
+                               if(blockdepth>=MAX_IF_BLOCK_DEPTH)
+                                 {CRIT_ERR("MAX_IF_BLOCK_DEPTH exceeded");}
+               if(!arg) {
+                         ERR("if_existing needs an argument");
+                         obj->data.ifblock.s = 0;
+                       }
+                       else
+                         obj->data.ifblock.s = strdup(arg);
+                       blockstart[blockdepth] = text_object_count;
+                       obj->data.ifblock.pos = text_object_count + 2;
+                       blockdepth++;
+                  END
+                                  OBJ(if_mounted,0)
+                                       if(blockdepth>=MAX_IF_BLOCK_DEPTH)
+                                         {CRIT_ERR("MAX_IF_BLOCK_DEPTH exceeded");}
+                       if(!arg) {
+                                 ERR("if_mounted needs an argument");
+                                 obj->data.ifblock.s = 0;
+                               }
+                               else
+                                         obj->data.ifblock.s = strdup(arg);
+                               blockstart[blockdepth] = text_object_count;
+                               obj->data.ifblock.pos = text_object_count + 2;
+                               blockdepth++;
+                          END
+                                          OBJ(if_running,0)
+                                               if(blockdepth>=MAX_IF_BLOCK_DEPTH)
+                                                 {CRIT_ERR("MAX_IF_BLOCK_DEPTH exceeded");}
+                               if(arg) {
+                                         char buf[256];
+                                         snprintf(buf,256,"pidof %s >/dev/null",arg);
+                                         obj->data.ifblock.s = strdup(buf);
+                                       } else {
+                                                 ERR("if_running needs an argument");
+                                                 obj->data.ifblock.s = 0;
+                                               }
+                                               blockstart[blockdepth] = text_object_count;
+                                               obj->data.ifblock.pos = text_object_count + 2;
+                                               blockdepth++;
+                                          END  
+                       OBJ(kernel, 0)
+       END OBJ(machine, 0)
+       END OBJ(mails, INFO_MAIL)
+       END OBJ(mem, INFO_MEM)
+       END OBJ(memmax, INFO_MEM)
+       END OBJ(memperc, INFO_MEM)
+       END OBJ(membar, INFO_MEM)
+        (void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
+       END OBJ(mixer, INFO_MIXER) obj->data.l = mixer_init(arg);
+       END OBJ(mixerl, INFO_MIXER) obj->data.l = mixer_init(arg);
+       END OBJ(mixerr, INFO_MIXER) obj->data.l = mixer_init(arg);
+       END OBJ(mixerbar, INFO_MIXER)
+           scan_mixer_bar(arg, &obj->data.mixerbar.l,
+                          &obj->data.mixerbar.w, &obj->data.mixerbar.h);
+       END OBJ(mixerlbar, INFO_MIXER)
+           scan_mixer_bar(arg, &obj->data.mixerbar.l,
+                          &obj->data.mixerbar.w, &obj->data.mixerbar.h);
+       END OBJ(mixerrbar, INFO_MIXER)
+           scan_mixer_bar(arg, &obj->data.mixerbar.l,
+                          &obj->data.mixerbar.w, &obj->data.mixerbar.h);
+       END
+                        #ifdef MLDONKEY
+                          OBJ(ml_upload_counter, INFO_MLDONKEY)
+                          END
+                         OBJ(ml_download_counter, INFO_MLDONKEY)
+                          END
+                          OBJ(ml_nshared_files, INFO_MLDONKEY)
+                         END
+                          OBJ(ml_shared_counter, INFO_MLDONKEY)
+                          END
+                          OBJ(ml_tcp_upload_rate, INFO_MLDONKEY)
+                          END
+                          OBJ(ml_tcp_download_rate, INFO_MLDONKEY)
+                          END
+                          OBJ(ml_udp_upload_rate, INFO_MLDONKEY)
+                          END
+                          OBJ(ml_udp_download_rate, INFO_MLDONKEY)
+                          END
+                          OBJ(ml_ndownloaded_files, INFO_MLDONKEY)
+                          END
+                          OBJ(ml_ndownloading_files, INFO_MLDONKEY)
+                          END
+                        #endif
+                       OBJ(new_mails, INFO_MAIL)
+       END OBJ(nodename, 0)
+       END OBJ(processes, INFO_PROCS)
+       END OBJ(running_processes, INFO_RUN_PROCS)
+       END OBJ(shadecolor, 0)
+           obj->data.l = arg ? get_x11_color(arg) : default_bg_color;
+       END OBJ(outlinecolor, 0)
+           obj->data.l = arg ? get_x11_color(arg) : default_out_color;
+       END OBJ(stippled_hr, 0) int a = stippled_borders, b = 1;
+       if (arg) {
+               if (sscanf(arg, "%d %d", &a, &b) != 2)
+                       sscanf(arg, "%d", &b);
+       }
+       if (a <= 0)
+               a = 1;
+       obj->data.pair.a = a;
+       obj->data.pair.b = b;
+       END OBJ(swap, INFO_MEM)
+       END OBJ(swapmax, INFO_MEM)
+       END OBJ(swapperc, INFO_MEM)
+       END OBJ(swapbar, INFO_MEM)
+        (void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
+       END OBJ(sysname, 0) END OBJ(temp1, INFO_I2C) obj->type = OBJ_i2c;
+       obj->data.i2c.fd =
+           open_i2c_sensor(0, "temp", 1, &obj->data.i2c.arg,
+                           obj->data.i2c.devtype);
+       END OBJ(temp2, INFO_I2C) obj->type = OBJ_i2c;
+       obj->data.i2c.fd =
+           open_i2c_sensor(0, "temp", 2, &obj->data.i2c.arg,
+                           obj->data.i2c.devtype);
+       END OBJ(time, 0) obj->data.s = strdup(arg ? arg : "%F %T");
+       END OBJ(utime, 0) obj->data.s = strdup(arg ? arg : "%F %T");
+       END OBJ(totaldown, INFO_NET) obj->data.net = get_net_stat(arg);
+       END OBJ(totalup, INFO_NET) obj->data.net = get_net_stat(arg);
+       END OBJ(updates, 0)
+END
+                       OBJ(alignr, 0)
+                       obj->data.i = arg ? atoi(arg) : 1;
+       END
+
+                       OBJ(alignc, 0)
+                       obj->data.i = arg ? atoi(arg) : 1;
+       END OBJ(upspeed, INFO_NET) obj->data.net = get_net_stat(arg);
+       END OBJ(upspeedf, INFO_NET) obj->data.net = get_net_stat(arg);
+       END OBJ(uptime_short, INFO_UPTIME) END OBJ(uptime, INFO_UPTIME) END
+                       OBJ(adt746xcpu, 0)
+                       END
+                       OBJ(adt746xfan, 0)
+                       END
+
+#ifdef SETI
+        OBJ(seti_prog, INFO_SETI) END OBJ(seti_progbar, INFO_SETI)
+        (void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
+       END OBJ(seti_credit, INFO_SETI) END
+#endif
+#ifdef METAR
+                          OBJ(metar_ob_time, INFO_METAR)
+                          END
+                       OBJ(metar_temp, INFO_METAR)
+                       END
+                       OBJ(metar_tempf, INFO_METAR)
+                       END
+                       OBJ(metar_windchill, INFO_METAR)
+                          END
+                          OBJ(metar_dew_point, INFO_METAR)
+                          END
+                          OBJ(metar_rh, INFO_METAR)
+   END
+
+                          OBJ(metar_windspeed, INFO_METAR)
+                          END
+                          OBJ(metar_winddir, INFO_METAR)
+                          END
+                          OBJ(metar_swinddir, INFO_METAR)
+                          END
+
+                          OBJ(metar_cloud, INFO_METAR)
+                          END
+                          OBJ(metar_u2d_time, INFO_METAR)
+                       END
+#endif
+                       
+#ifdef MPD
+        OBJ(mpd_artist, INFO_MPD) 
+                       END OBJ(mpd_title, INFO_MPD)
+                       END OBJ(mpd_album, INFO_MPD) END OBJ(mpd_vol, INFO_MPD) END OBJ(mpd_bitrate, INFO_MPD) END
+                       OBJ(mpd_status, INFO_MPD) END
+                       OBJ(mpd_bar, INFO_MPD)
+                       (void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
+       END
+#endif
+{
+               char buf[256];
+               ERR("unknown variable %s", s);
+               obj->type = OBJ_text;
+               snprintf(buf, 256, "${%s}", s);
+               obj->data.s = strdup(buf);
+}
+#undef OBJ
+}
+
+/* append_text() appends text to last text_object if it's text, if it isn't
+ * it creates a new text_object */
+static void append_text(const char *s)
+{
+       struct text_object *obj;
+
+       if (s == NULL || *s == '\0')
+               return;
+
+       obj = text_object_count ? &text_objects[text_object_count - 1] : 0;
+
+       /* create a new text object? */
+       if (!obj || obj->type != OBJ_text) {
+               obj = new_text_object();
+               obj->type = OBJ_text;
+               obj->data.s = strdup(s);
+       } else {
+               /* append */
+               obj->data.s = (char *) realloc(obj->data.s,
+                                              strlen(obj->data.s) +
+                                              strlen(s) + 1);
+               strcat(obj->data.s, s);
+       }
+}
+
+static void extract_variable_text(const char *p)
+{
+       const char *s = p;
+
+       free_text_objects();
+
+       while (*p) {
+               if (*p == '$') {
+                       *(char *) p = '\0';
+                       append_text(s);
+                       *(char *) p = '$';
+                       p++;
+                       s = p;
+
+                       if (*p != '$') {
+                               char buf[256];
+                               const char *var;
+                               unsigned int len;
+
+                               /* variable is either $foo or ${foo} */
+                               if (*p == '{') {
+                                       p++;
+                                       s = p;
+                                       while (*p && *p != '}')
+                                               p++;
+                               } else {
+                                       s = p;
+                                       if (*p == '#')
+                                               p++;
+                                       while (*p && (isalnum((int) *p)
+                                                     || *p == '_'))
+                                               p++;
+                               }
+
+                               /* copy variable to buffer */
+                               len = (p - s > 255) ? 255 : (p - s);
+                               strncpy(buf, s, len);
+                               buf[len] = '\0';
+
+                               if (*p == '}')
+                                       p++;
+                               s = p;
+
+                               var = getenv(buf);
+
+                               /* if variable wasn't found from environment, use some special */
+                               if (!var) {
+                                       char *p;
+                                       char *arg = 0;
+
+                                       /* split arg */
+                                       if (strchr(buf, ' ')) {
+                                               arg = strchr(buf, ' ');
+                                               *arg = '\0';
+                                               arg++;
+                                               while (isspace((int) *arg))
+                                                       arg++;
+                                               if (!*arg)
+                                                       arg = 0;
+                                       }
+
+                                       /* lowercase variable name */
+                                       p = buf;
+                                       while (*p) {
+                                               *p = tolower(*p);
+                                               p++;
+                                       }
+
+                                       construct_text_object(buf, arg);
+                               }
+                               continue;
+                       } else
+                               append_text("$");
+               }
+
+               p++;
+       }
+       append_text(s);
+       if(blockdepth) ERR("one or more $endif's are missing");
+}
+
+double current_update_time, last_update_time;
+
+static void generate_text()
+{
+       unsigned int i, n;
+       struct information *cur = &info;
+       char *p;
+
+       special_count = 0;
+
+       /* update info */
+
+       current_update_time = get_time();
+
+       update_stuff(cur);
+
+       /* generate text */
+
+       n = TEXT_BUFFER_SIZE*4 - 2;
+       p = text_buffer;
+
+       for (i = 0; i < text_object_count; i++) {
+               struct text_object *obj = &text_objects[i];
+
+#define OBJ(a) break; case OBJ_##a:
+
+               switch (obj->type) {
+               default:
+                       {
+                               ERR("not implemented obj type %d",
+                                   obj->type);
+                       }
+                       OBJ(acpitemp) {
+                               /* does anyone have decimals in acpi temperature? */                            
+                               if(!use_spacer)
+                                       snprintf(p, n, "%d",
+                                               (int) get_acpi_temperature(obj->
+                                                               data.
+                                                               i));
+                               else
+                                       snprintf(p, 5, "%d    ",
+                                               (int) get_acpi_temperature(obj->
+                                                               data.
+                                                               i));
+                       }
+                       OBJ(freq) {
+                               snprintf(p, n, "%s", get_freq());
+                       }
+                       OBJ(adt746xcpu) {
+                               snprintf(p, n, "%s", get_adt746x_cpu());
+                       }
+                       OBJ(adt746xfan) {
+                               snprintf(p, n, "%s", get_adt746x_fan());
+                       }
+                       OBJ(acpifan) {
+                               snprintf(p, n, "%s", get_acpi_fan());
+                       }
+                       OBJ(acpiacadapter) {
+                               snprintf(p, n, "%s",
+                                        get_acpi_ac_adapter());
+                       }
+                       OBJ(battery) {
+                               get_battery_stuff(p, n, obj->data.s);
+                       }
+                       OBJ(buffers) {
+                               human_readable(cur->buffers * 1024, p, 255);
+                       }
+                       OBJ(cached) {
+                               human_readable(cur->cached * 1024, p, 255);
+                       }
+                       OBJ(cpu) {
+                               if(!use_spacer)
+                               snprintf(p, n, "%*d", pad_percents,
+                                                                               (int) (cur->cpu_usage * 100.0));                
+                               else
+                               snprintf(p, 4, "%*d    ", pad_percents,
+                                        (int) (cur->cpu_usage * 100.0));
+                       }
+                       OBJ(cpubar) {
+                               new_bar(p, obj->data.pair.a,
+                                       obj->data.pair.b,
+                                       (int) (cur->cpu_usage * 255.0));
+                       }
+                       OBJ(color) {
+                               new_fg(p, obj->data.l);
+                       }
+                       OBJ(downspeed) {
+                               if(!use_spacer)
+                                       snprintf(p, n, "%d",
+                                        (int) (obj->data.net->recv_speed /
+                                               1024));
+                               else
+                                       snprintf(p, 6, "%d     ",
+                                               (int) (obj->data.net->recv_speed /
+                                                               1024));
+                       }
+                       OBJ(downspeedf) {
+                               if(!use_spacer)
+                                       snprintf(p, n, "%.1f",
+                                        obj->data.net->recv_speed /
+                                        1024.0);
+                               else
+                                       snprintf(p, 8, "%.1f       ",
+                                               obj->data.net->recv_speed /
+                                                               1024.0);
+                       }
+                               OBJ(else) {
+                                 if(!if_jumped)
+                                 {
+                                                       i=obj->data.ifblock.pos-2;
+                                                 }
+                                                 else
+                                                         {
+                                                               if_jumped = 0;
+                                                         }
+                                                    }
+                                                       OBJ(endif) {
+                                                                 if_jumped = 0;
+                                                            }
+                       
+#ifdef HAVE_POPEN
+                       OBJ(exec) {
+                               char *p2 = p;
+                               FILE *fp = popen(obj->data.s, "r");
+                               int n2 = fread(p, 1, n, fp);
+                               (void) pclose(fp);
+                       
+                               p[n2] = '\0';
+                               if (n2 && p[n2 - 1] == '\n')
+                                       p[n2 - 1] = '\0';
+                       
+                               while (*p2) {
+                                       if (*p2 == '\001')
+                                               *p2 = ' ';
+                                       p2++;
+                               }
+                       }
+                       OBJ(execbar) {
+                               char *p2 = p;
+                               FILE *fp = popen(obj->data.s, "r");
+                               int n2 = fread(p, 1, n, fp);
+                               (void) pclose(fp);
+
+                               p[n2] = '\0';
+                               if (n2 && p[n2 - 1] == '\n')
+                                       p[n2 - 1] = '\0';
+    OBJ(addr) {
+      snprintf(p, n, "%u.%u.%u.%u",
+               obj->data.net->addr.sa_data[2] & 255,
+               obj->data.net->addr.sa_data[3] & 255,
+               obj->data.net->addr.sa_data[4] & 255,
+               obj->data.net->addr.sa_data[5] & 255);
+               
+               }
+    OBJ(linkstatus) {
+      snprintf(p, n, "%d", obj->data.net->linkstatus);
+    }
+                               while (*p2) {
+                                       if (*p2 == '\001')
+                                               *p2 = ' ';
+                                       p2++;
+                               }
+                               double barnum;
+                               if (sscanf(p, "%lf", &barnum) == 0)
+                               {
+                                       ERR("reading execbar value failed (perhaps it's not the correct format?)");
+                               }
+                               if (barnum > 100 || barnum < 0)
+                               {
+                                       ERR("your execbar value is not between 0 and 100, therefore it will be ignored");
+                               }
+                               else
+                               {
+                                       barnum = barnum/100.0;
+                                       new_bar(p, 0,
+                                                       4,
+                                                       (int) (barnum * 255.0));
+                       }
+                               
+                       }
+                       OBJ(execi) {
+                               if (current_update_time -
+                                   obj->data.execi.last_update <
+                                   obj->data.execi.interval) {
+                                       snprintf(p, n, "%s",
+                                                obj->data.execi.buffer);
+                               } else {
+                                       char *p2 = obj->data.execi.buffer;
+                                       FILE *fp =
+                                           popen(obj->data.execi.cmd,
+                                                 "r");
+                                       int n2 =
+                                           fread(p2, 1, TEXT_BUFFER_SIZE,
+                                                 fp);
+                                       (void) pclose(fp);
+
+                                       p2[n2] = '\0';
+                                       if (n2 && p2[n2 - 1] == '\n')
+                                               p2[n2 - 1] = '\0';
+
+                                       while (*p2) {
+                                               if (*p2 == '\001')
+                                                       *p2 = ' ';
+                                               p2++;
+                                       }
+
+                                       snprintf(p, n, "%s",
+                                                obj->data.execi.buffer);
+
+                                       obj->data.execi.last_update =
+                                           current_update_time;
+                               }
+                       }
+#endif
+                       OBJ(fs_bar) {
+                               if (obj->data.fs != NULL) {
+                                       if (obj->data.fs->size == 0)
+                                               new_bar(p,
+                                                       obj->data.fsbar.w,
+                                                       obj->data.fsbar.h,
+                                                       255);
+                                       else
+                                               new_bar(p,
+                                                       obj->data.fsbar.w,
+                                                       obj->data.fsbar.h,
+                                                       (int) (255 -
+                                                              obj->data.
+                                                              fsbar.fs->
+                                                              avail *
+                                                              255 /
+                                                              obj->data.
+                                                              fs->size));
+                               }
+                       }
+                       OBJ(fs_free) {
+                               if (obj->data.fs != NULL)
+                                       human_readable(obj->data.fs->avail,
+                                                      p, 255);
+                       }
+                       OBJ(fs_free_perc) {
+                               if (obj->data.fs != NULL) {
+                                       if (obj->data.fs->size)
+                                               snprintf(p, n, "%*d", pad_percents, (int) ((obj->data.fs->avail *100) / obj->data.fs->size));
+                                       else
+                                                       snprintf(p, n, "0");
+                       }
+                       }
+                       OBJ(fs_size) {
+                               if (obj->data.fs != NULL)
+                                       human_readable(obj->data.fs->size,
+                                                      p, 255);
+                       }
+                       OBJ(fs_used) {
+                               if (obj->data.fs != NULL)
+                                       human_readable(obj->data.fs->size -
+                                                      obj->data.fs->avail,
+                                                      p, 255);
+                       }
+                       OBJ(fs_bar_free) {
+                               if (obj->data.fs != NULL) {
+                                       if (obj->data.fs->size == 0)
+                                               new_bar(p,
+                                                       obj->data.fsbar.w,
+                                                       obj->data.fsbar.h,
+                                                       255);
+                                       else
+                                               new_bar(p,
+                                                       obj->data.fsbar.w,
+                                                       obj->data.fsbar.h,
+                                                       (int) (obj->data.
+                                                              fsbar.fs->
+                                                              avail *
+                                                              255 /
+                                                              obj->data.
+                                                              fs->size));
+                               }
+                       }
+                       OBJ(fs_used_perc) {
+                               if (obj->data.fs != NULL) {
+                                       if (obj->data.fs->size)
+                                               snprintf(p, 4, "%d",
+                                                        100 - ((int)
+                                                               ((obj->
+                                                                 data.fs->
+                                                                 avail *
+                                                                 100) /
+                                                                obj->data.
+                                                                fs->
+                                                                size)));
+                                       else
+                                               snprintf(p, n, "0");
+                               }
+                       }
+                       OBJ(loadavg) {
+                               float *v = info.loadavg;
+
+                               if (obj->data.loadavg[2])
+                                       snprintf(p, n, "%.2f %.2f %.2f",
+                                                v[obj->data.loadavg[0] -
+                                                  1],
+                                                v[obj->data.loadavg[1] -
+                                                  1],
+                                                v[obj->data.loadavg[2] -
+                                                  1]);
+                               else if (obj->data.loadavg[1])
+                                       snprintf(p, n, "%.2f %.2f",
+                                                v[obj->data.loadavg[0] -
+                                                  1],
+                                                v[obj->data.loadavg[1] -
+                                                  1]);
+                               else if (obj->data.loadavg[0])
+                                       snprintf(p, n, "%.2f",
+                                                v[obj->data.loadavg[0] -
+                                                  1]);
+                       }
+                       OBJ(hr) {
+                               new_hr(p, obj->data.i);
+                       }
+                       OBJ(i2c) {
+                               double r;
+
+                               r = get_i2c_info(&obj->data.i2c.fd,
+                                                obj->data.i2c.arg,
+                                                obj->data.i2c.devtype,
+                                                obj->data.i2c.type);
+
+                               if (r >= 100.0 || r == 0)
+                                       snprintf(p, n,"%d", (int) r);
+                               else
+                                       snprintf(p, n, "%.1f", r);
+                       }
+                       OBJ(alignr) {
+                               new_alignr(p, obj->data.i);
+                       }
+                       OBJ(alignc) {
+                               new_alignc(p, obj->data.i);
+                       }
+                           OBJ(if_existing) {
+                                      struct stat tmp;
+                                      if((obj->data.ifblock.s)&&(stat(obj->data.ifblock.s,&tmp) == -1)) {
+                                                       i=obj->data.ifblock.pos-2;
+                                                       if_jumped = 1;
+                                                 } else if_jumped = 0;
+                                            }
+                                            OBJ(if_mounted) {
+                                                         if((obj->data.ifblock.s)&&(!check_mount(obj->data.ifblock.s))) {
+                                                                       i=obj->data.ifblock.pos-2;
+                                                                       if_jumped = 1;
+                                                                 } else if_jumped = 0;
+                                                            }
+                                                            OBJ(if_running) {
+                                                                         if((obj->data.ifblock.s)&&system(obj->data.ifblock.s)) {
+                                                                                   i=obj->data.ifblock.pos-2;
+                                                                                       if_jumped = 1;
+                                                                                 } else if_jumped = 0;
+                                                                            }
+                       OBJ(kernel) {
+                               snprintf(p, n, "%s", cur->uname_s.release);
+                       }
+                       OBJ(machine) {
+                               snprintf(p, n, "%s", cur->uname_s.machine);
+                       }
+
+                       /* memory stuff */
+                       OBJ(mem) {
+                               human_readable(cur->mem * 1024, p, 6);
+                       }
+                       OBJ(memmax) {
+                               human_readable(cur->memmax * 1024, p, 255);
+                       }
+                       OBJ(memperc) {
+                               if (cur->memmax)
+                               {
+                                       if(!use_spacer)
+                                               snprintf(p, n, "%*d", pad_percents,
+                                                       (cur->mem * 100) /
+                                                                       (cur->memmax));
+                                       else
+                                               snprintf(p, 4, "%*d   ", pad_percents,
+                                                       (cur->mem * 100) /
+                                                                       (cur->memmax));
+                               }
+                       }
+                       OBJ(membar) {
+                               new_bar(p, obj->data.pair.a,
+                                       obj->data.pair.b,
+                                       cur->memmax ? (cur->mem * 255) /
+                                       (cur->memmax) : 0);
+                       }
+
+                       /* mixer stuff */
+                       OBJ(mixer) {
+                               snprintf(p, n, "%d",
+                                        mixer_get_avg(obj->data.l));
+                       }
+                       OBJ(mixerl) {
+                               snprintf(p, n, "%d",
+                                        mixer_get_left(obj->data.l));
+                       }
+                       OBJ(mixerr) {
+                               snprintf(p, n, "%d",
+                                        mixer_get_right(obj->data.l));
+                       }
+                       OBJ(mixerbar) {
+                               new_bar(p, obj->data.mixerbar.w,
+                                       obj->data.mixerbar.h,
+                                       mixer_get_avg(obj->data.mixerbar.
+                                                     l) * 255 / 100);
+                       }
+                       OBJ(mixerlbar) {
+                               new_bar(p, obj->data.mixerbar.w,
+                                       obj->data.mixerbar.h,
+                                       mixer_get_left(obj->data.mixerbar.
+                                                      l) * 255 / 100);
+                       }
+                       OBJ(mixerrbar) {
+                               new_bar(p, obj->data.mixerbar.w,
+                                       obj->data.mixerbar.h,
+                                       mixer_get_right(obj->data.mixerbar.
+                                                       l) * 255 / 100);
+                       }
+
+                       /* mail stuff */
+                       OBJ(mails) {
+                               snprintf(p, n, "%d", cur->mail_count);
+                       }
+                       OBJ(new_mails) {
+                               snprintf(p, n, "%d", cur->new_mail_count);
+                       }
+#ifdef MLDONKEY
+       OBJ(ml_upload_counter) {
+                 snprintf(p, n, "%lld", mlinfo.upload_counter/1048576);
+               }
+            OBJ(ml_download_counter) {
+                         snprintf(p, n, "%lld", mlinfo.download_counter/1048576);
+                       }
+                    OBJ(ml_nshared_files) {
+                                 snprintf(p, n, "%i", mlinfo.nshared_files);
+                               }
+                            OBJ(ml_shared_counter) {
+                                         snprintf(p, n, "%lld", mlinfo.shared_counter/1048576);
+                                       }
+                                    OBJ(ml_tcp_upload_rate) {
+                                                 snprintf(p, n, "%.2f", (float)mlinfo.tcp_upload_rate/1024);
+                                               }
+                                            OBJ(ml_tcp_download_rate) {
+                                                         snprintf(p, n, "%.2f",(float)mlinfo.tcp_download_rate/1024);
+                                                       }
+                                                    OBJ(ml_udp_upload_rate) {
+                                                                 snprintf(p, n, "%.2f",(float)mlinfo.udp_upload_rate/1024);
+                                                               }
+                                                            OBJ(ml_udp_download_rate) {
+                                                                         snprintf(p, n, "%.2f",(float)mlinfo.udp_download_rate/1024);
+                                                                       }
+                                                                    OBJ(ml_ndownloaded_files) {
+                                                                                 snprintf(p, n, "%i", mlinfo.ndownloaded_files);
+                                                                               }
+                                                                            OBJ(ml_ndownloading_files) {
+                                                                                         snprintf(p, n, "%i", mlinfo.ndownloading_files);
+                                                                                       }
+                                                                                #endif
+
+                       OBJ(nodename) {
+                               snprintf(p, n, "%s",
+                                        cur->uname_s.nodename);
+                       }
+                       OBJ(outlinecolor) {
+                               new_outline(p, obj->data.l);
+                       }
+                       OBJ(processes) {
+                               if(!use_spacer)
+                                       snprintf(p, n, "%d", cur->procs);
+                               else
+                                       snprintf(p, 5, "%d    ", cur->procs);
+                       }
+                       OBJ(running_processes) {
+                               if(!use_spacer)
+                                       snprintf(p, n, "%d", cur->run_procs);
+                               else
+                                       snprintf(p, 3, "%d     ", cur->run_procs);
+                       }
+                       OBJ(text) {
+                               snprintf(p, n, "%s", obj->data.s);
+                       }
+                       OBJ(shadecolor) {
+                               new_bg(p, obj->data.l);
+                       }
+                       OBJ(stippled_hr) {
+                               new_stippled_hr(p, obj->data.pair.a,
+                                               obj->data.pair.b);
+                       }
+                       OBJ(swap) {
+                               human_readable(cur->swap * 1024, p, 255);
+                       }
+                       OBJ(swapmax) {
+                               human_readable(cur->swapmax * 1024, p, 255);
+                       }
+                       OBJ(swapperc) {
+                               if (cur->swapmax == 0) {
+                                       strncpy(p, "No swap", 255);
+                               } else {
+                                       if(!use_spacer)
+                                               snprintf(p, 255, "%*u",
+                                                       pad_percents,
+                                                       (cur->swap * 100) /
+                                                                       cur->swapmax);
+                                       else
+                                               snprintf(p, 4, "%*u   ",
+                                                       pad_percents,
+                                                       (cur->swap * 100) /
+                                                                       cur->swapmax);
+                               }
+                       }
+                       OBJ(swapbar) {
+                               new_bar(p, obj->data.pair.a,
+                                       obj->data.pair.b,
+                                       cur->swapmax ? (cur->swap * 255) /
+                                       (cur->swapmax) : 0);
+                       }
+                       OBJ(sysname) {
+                               snprintf(p, n, "%s", cur->uname_s.sysname);
+                       }
+                       OBJ(time) {
+                               time_t t = time(NULL);
+                               struct tm *tm = localtime(&t);
+                               setlocale(LC_TIME, "");
+                               strftime(p, n, obj->data.s, tm);
+                       }
+                       OBJ(utime) {
+                               time_t t = time(NULL);
+                               struct tm *tm = gmtime(&t);
+                               strftime(p, n, obj->data.s, tm);
+                       }
+                       OBJ(totaldown) {
+                               human_readable(obj->data.net->recv, p, 255);
+                       }
+                       OBJ(totalup) {
+                               human_readable(obj->data.net->trans, p, 255);
+                       }
+                       OBJ(updates) {
+                               snprintf(p, n, "%d", total_updates);
+                       }
+                       OBJ(upspeed) {
+                               if(!use_spacer)
+                                       snprintf(p, n, "%d",
+                                               (int) (obj->data.net->
+                                                               trans_speed / 1024));
+                               else
+                                       snprintf(p, 5, "%d     ",
+                                               (int) (obj->data.net->
+                                                               trans_speed / 1024));
+                       }
+                       OBJ(upspeedf) {
+                               if(!use_spacer)
+                                       snprintf(p, n, "%.1f",
+                                               obj->data.net->trans_speed /
+                                                               1024.0);
+                               else
+                                       snprintf(p, 8, "%.1f       ",
+                                               obj->data.net->trans_speed /
+                                                               1024.0);
+                       }
+                       OBJ(uptime_short) {
+                               format_seconds_short(p, n,
+                                                    (int) cur->uptime);
+                       }
+                       OBJ(uptime) {
+                               format_seconds(p, n, (int) cur->uptime);
+                       }
+
+#ifdef SETI
+                       OBJ(seti_prog) {
+                               snprintf(p, n, "%.2f",
+                                        cur->seti_prog * 100.0f);
+                       }
+                       OBJ(seti_progbar) {
+                               new_bar(p, obj->data.pair.a,
+                                       obj->data.pair.b,
+                                       (int) (cur->seti_prog * 255.0f));
+                       }
+                       OBJ(seti_credit) {
+                               snprintf(p, n, "%.0f", cur->seti_credit);
+                       }
+#endif
+
+#ifdef MPD
+                       OBJ(mpd_title) {
+                               snprintf(p, n, "%s", cur->mpd.title);
+                       }
+                       OBJ(mpd_artist) {
+                               snprintf(p, n, "%s", cur->mpd.artist);
+                       }
+                       OBJ(mpd_album) {
+                               snprintf(p, n, "%s", cur->mpd.album);
+                       }
+                       OBJ(mpd_vol) {
+                               snprintf(p, n, "%i", cur->mpd.volume);
+                       }
+                       OBJ(mpd_bitrate) {
+                               snprintf(p, n, "%i", cur->mpd.bitrate);
+                       }
+                       OBJ(mpd_status) {
+                               snprintf(p, n, "%s", cur->mpd.status);
+                       }
+                       OBJ(mpd_bar) {
+                               new_bar(p, obj->data.pair.a,
+                                       obj->data.pair.b,
+                                       (int) (cur->mpd.progress * 255.0f));
+                       }
+#endif
+                       OBJ(top) {
+       if (obj->data.top.type == TOP_NAME && obj->data.top.num >= 0 && obj->data.top.num < 10){
+                                       // if we limit the buffer and add a bunch of space after, it stops the thing from
+                                       // moving other shit around, which is really fucking annoying
+               snprintf(p, 17, "%s                              ", cur->tops[obj->data.top.num]->name);
+       }
+       else if (obj->data.top.type == TOP_CPU && obj->data.top.num >= 0 && obj->data.top.num < 10) {
+               snprintf(p, 7, "%3.2f      ", cur->tops[obj->data.top.num]->amount);
+       }
+       else if (obj->data.top.type == TOP_PID && obj->data.top.num >= 0 && obj->data.top.num < 10) {
+               snprintf(p, 8, "%i           ", cur->tops[obj->data.top.num]->pid);
+       }
+       else if (obj->data.top.type == TOP_MEM && obj->data.top.num >= 0 && obj->data.top.num < 10) {
+               snprintf(p, 7, "%3.2f       ", cur->tops[obj->data.top.num]->totalmem);
+       }
+                       }
+                       
+                       
+                       
+                       /*
+                        * I'm tired of everything being packed in
+                        * pee
+                        * poop
+                        */
+                       
+                       
+                       OBJ(tail) {
+                               if (current_update_time -
+                               obj->data.tail.last_update <
+                                               obj->data.tail.interval) {
+                                       snprintf(p, n, "%s",
+                                                       obj->data.tail.buffer);
+                                               } else {
+                                                       
+                                                       obj->data.tail.last_update =
+                                                                       current_update_time;
+                       
+                               FILE * fp;
+                               int i;
+                               tailstring *head = NULL;
+                               tailstring *headtmp1 = NULL;
+                               tailstring *headtmp2 = NULL;
+                               tailstring *headtmp2tmp = NULL;
+                               fp = fopen (obj->data.tail.logfile , "rt");
+                               if (fp == NULL) ERR("tail logfile failed to open");
+                               else {
+                                       obj->data.tail.readlines = 0;
+                                       
+                                       while (fgets(obj->data.tail.buffer, TEXT_BUFFER_SIZE*4, fp) != NULL) {
+                                               addtail(&head, obj->data.tail.buffer);
+                                               obj->data.tail.readlines++;
+                                       }
+                                       
+                                       fclose(fp);
+                                       
+                                       headtmp1 = head;
+                                       if (obj->data.tail.readlines > 0) {
+                                               for(i=0;i<obj->data.tail.wantedlines;i++) {
+                                                       if(head)
+                                                       {
+                                                               addtail(&headtmp2, head->data);
+                                                               head = head->next;
+                                                       }
+                                                       else
+                                                               break;
+                                               }
+                                               headtmp2tmp = headtmp2;
+                                               for(i=0;i<obj->data.tail.wantedlines;i++) {
+                                                       if(headtmp2) {
+                                                               strncat(obj->data.tail.buffer, headtmp2->data, TEXT_BUFFER_SIZE*4/obj->data.tail.wantedlines);
+                                                               headtmp2 = headtmp2->next;
+                                                       }
+                                               }
+                                               
+                                               /* this is good enough for now. */
+                                               snprintf(p, n, "%s", obj->data.tail.buffer);
+                                               
+                                               freetail(headtmp2tmp);
+                                       }
+                                       freetail(headtmp1);
+                               }
+                       }
+                       }       
+                       
+                       
+                        #ifdef METAR
+                        // Hmm, it's expensive to calculate this shit every time FIXME
+                            OBJ(metar_ob_time){
+                              if ( data.ob_hour != INT_MAX && data.ob_minute != INT_MAX && metar_worked )
+                                      format_seconds(p, n, data.ob_hour*3600+data.ob_minute*60);
+                              else
+                                                      format_seconds(p, n, 0);
+                                    }
+                                    OBJ(metar_temp){
+                                      if ( data.temp != INT_MAX && metar_worked)
+                                              snprintf(p, n, "%i", data.temp);
+                                      else
+                                        snprintf(p, n, "-");
+                                    }
+                                    OBJ(metar_tempf){
+                                            if ( data.temp != INT_MAX && metar_worked)
+                                                    snprintf(p, n, "%3.1f", (data.temp+40)*9.0/5-40);
+                                            else
+                                                    snprintf(p, n, "-");
+                                    }
+                                    OBJ(metar_windchill){
+                                      if ( data.temp != INT_MAX && data.winData.windSpeed != INT_MAX && metar_worked)
+                                                snprintf(p, n, "%i", calculateWindChill(data.temp, data.winData.windSpeed));
+                                              else
+                                                snprintf(p, n, "-");
+                                            }
+                                            OBJ(metar_dew_point){
+                                              if ( data.dew_pt_temp != INT_MAX && metar_worked)
+                                                snprintf(p, n, "%i", data.dew_pt_temp);
+                                              else
+                                                snprintf(p, n, "-");
+                                            }
+                                                 OBJ(metar_rh){
+                                                           if ( data.temp != INT_MAX && data.dew_pt_temp != INT_MAX && metar_worked)
+                                                                     snprintf(p, n, "%i", calculateRelativeHumidity(data.temp, data.dew_pt_temp));
+                                                           else
+                                                                     snprintf(p, n, "-");
+                                                         }
+
+                                            OBJ(metar_windspeed){
+                                              if ( data.winData.windSpeed != INT_MAX && metar_worked)
+                                                snprintf(p, n, "%i", knTokph(data.winData.windSpeed));
+                                              else
+                                                snprintf(p, n, "-");
+                                            }
+                                            OBJ(metar_winddir){
+                                                    if ( data.winData.windDir != INT_MAX && metar_worked)
+                                                               snprintf(p, n, "%s", calculateWindDirectionString(data.winData.windDir));
+                                              else
+                                                snprintf(p, n, "-");
+                                            }
+                                                 OBJ(metar_swinddir){
+                                                           if ( data.winData.windDir != INT_MAX && metar_worked)
+                                                                     snprintf(p, n, "%s", calculateShortWindDirectionString(data.winData.windDir));
+                                                           else
+                                                                     snprintf(p, n, "-");
+                                                         }
+
+                                            OBJ(metar_cloud){
+                                              if (data.cldTypHgt[0].cloud_type[0] != '\0' && metar_worked){
+                                                if ( strcmp(&data.cldTypHgt[0].cloud_type[0], "SKC") == 0 )
+                                                  snprintf(p, n, "Clear Sky");
+                                                else if ( strcmp(&data.cldTypHgt[0].cloud_type[0], "CLR") == 0 )
+                                                  snprintf(p, n, "Clear Sky");
+                                                else if ( strcmp(&data.cldTypHgt[0].cloud_type[0], "FEW") == 0 )
+                                                  snprintf(p, n, "Few clouds");
+                                                else if ( strcmp(&data.cldTypHgt[0].cloud_type[0], "SCT") == 0 )
+                                                  snprintf(p, n, "Scattered");
+                                                else if ( strcmp(&data.cldTypHgt[0].cloud_type[0], "BKN") == 0 )
+                                                  snprintf(p, n, "Broken");
+                                                else if ( strcmp(&data.cldTypHgt[0].cloud_type[0], "OVC") == 0 )
+                                                  snprintf(p, n, "Overcast");
+                                                                                        else
+                                                                                          snprintf(p, n, "Checking...");
+                                                                                      }
+                                                                                      else
+                                                                                        snprintf(p, n, "Checking...");
+                                                                                    }
+                                                                                    OBJ(metar_u2d_time){
+                                                                                     format_seconds(p, n, (int)last_metar_update%(3600*24)+3600);
+                                                                                    }
+                                                                                #endif
+
+                       break;
+               }
+
+               {
+                       unsigned int a = strlen(p);
+                       p += a;
+                       n -= a;
+               }
+       }
+
+       if (stuff_in_upper_case) {
+               char *p;
+
+               p = text_buffer;
+               while (*p) {
+                       *p = toupper(*p);
+                       p++;
+               }
+       }
+
+       last_update_time = current_update_time;
+       total_updates++;
+       //free(p);
+}
+
+/*
+ * text size
+ */
+
+static int text_start_x, text_start_y; /* text start position in window */
+static int text_width, text_height;
+
+static inline int get_string_width(const char *s)
+{
+       return *s ? calc_text_width(s, strlen(s)) : 0;
+}
+
+static void text_size_updater(char *s)
+{
+       int w = 0;
+       char *p;
+
+       /* get string widths and skip specials */
+       p = s;
+       while (*p) {
+               if (*p == SPECIAL_CHAR) {
+                       *p = '\0';
+                       w += get_string_width(s);
+                       *p = SPECIAL_CHAR;
+
+                       if (specials[special_index].type == BAR) {
+                               w += specials[special_index].width;
+                       }
+
+                       special_index++;
+                       s = p + 1;
+               }
+               p++;
+       }
+
+       w += get_string_width(s);
+
+       if (w > text_width)
+               text_width = w;
+
+       text_height += font_height();
+}
+
+static void update_text_area()
+{
+       int x, y;
+
+       /* update text size if it isn't fixed */
+#ifdef OWN_WINDOW
+       if (!fixed_size)
+#endif
+       {
+               text_width = minimum_width;
+               text_height = 0;
+               special_index = 0;
+               for_each_line(text_buffer, text_size_updater);
+               text_width += 1;
+               if (text_height < minimum_height)
+                       text_height = minimum_height;
+       }
+
+       /* get text position on workarea */
+       switch (text_alignment) {
+       case TOP_LEFT:
+               x = gap_x;
+               y = gap_y;
+               break;
+
+       case TOP_RIGHT:
+               x = workarea[2] - text_width - gap_x;
+               y = gap_y;
+               break;
+
+       default:
+       case BOTTOM_LEFT:
+               x = gap_x;
+               y = workarea[3] - text_height - gap_y;
+               break;
+
+       case BOTTOM_RIGHT:
+               x = workarea[2] - text_width - gap_x;
+               y = workarea[3] - text_height - gap_y;
+               break;
+       }
+
+#ifdef OWN_WINDOW
+       if (own_window) {
+               x += workarea[0];
+               y += workarea[1];
+               text_start_x = border_margin + 1;
+               text_start_y = border_margin + 1;
+               window.x = x - border_margin - 1;
+               window.y = y - border_margin - 1;
+       } else
+#endif
+       {
+               /* If window size doesn't match to workarea's size, then window
+                * probably includes panels (gnome).
+                * Blah, doesn't work on KDE. */
+               if (workarea[2] != window.width
+                   || workarea[3] != window.height) {
+                       y += workarea[1];
+                       x += workarea[0];
+               }
+
+               text_start_x = x;
+               text_start_y = y;
+       }
+}
+
+/*
+ * drawing stuff
+ */
+
+static int cur_x, cur_y;       /* current x and y for drawing */
+static int draw_mode;          /* FG, BG or OUTLINE */
+static long current_color;
+
+static inline void set_foreground_color(long c)
+{
+       current_color = c;
+       XSetForeground(display, window.gc, c);
+}
+
+static void draw_string(const char *s)
+{
+       if (s[0] == '\0')
+               return;
+       int i, i2, pos, width_of_s;
+       int max, added;
+       width_of_s = get_string_width(s);
+       if (out_to_console)
+       {
+               printf("%s\n", s);
+       }
+       strcpy(tmpstring1, s);
+       pos = 0;
+       added = 0;
+       char space[2];
+       snprintf(space, 2, " ");
+       max = ((text_width-width_of_s)/get_string_width(space));
+       //printf("width: %i, length: %i, max: %i space: %i\n", text_width, width_of_s, max, get_string_width(space));
+       /*
+        * This code looks for tabs in the text and coverts them to spaces.
+        * The trick is getting the correct number of spaces,
+        * and not going over the window's size without forcing
+        * the window larger.
+        */
+       for(i=0;i<TEXT_BUFFER_SIZE;i++)
+       {
+               if (tmpstring1[i] == '\t') // 9 is ascii tab
+               {
+                       i2=0;
+                       for(i2=0;i2<(8-(1+pos)%8) && added <= max;i2++)
+                       {
+                               //printf("pos thinger %i added %i max %i\n",(8-(1+pos)%8), added, max);
+                               //printf("adding tab to: %s\n", s);
+                               tmpstring2[pos+i2] = ' ';
+                               added++;
+                       }
+                       pos += i2;
+                       //printf("not adding tab to: %s\n", s);
+               }
+               else
+               {
+                       if (tmpstring1[i] != 9) {
+                               tmpstring2[pos] = tmpstring1[i];
+                               pos++;
+                       }
+/*                     else {
+                               tmpstring2[pos] = ' ';
+                               pos++;
+               }*/
+       }
+}
+       s = tmpstring2;
+#ifdef XFT
+       if (use_xft) {
+               XColor c;
+               XftColor c2;
+               c.pixel = current_color;
+               XQueryColor(display, DefaultColormap(display, screen), &c);
+
+               c2.pixel = c.pixel;
+               c2.color.red = c.red;
+               c2.color.green = c.green;
+               c2.color.blue = c.blue;
+               c2.color.alpha = font_alpha;
+               //printf("at: %i, %i\nstring: %s", cur_x, cur_y, s);
+               XftDrawString8(window.xftdraw, &c2, xftfont,
+                              cur_x, cur_y, (XftChar8 *) s, strlen(s));
+       } else
+#endif
+       {
+               XDrawString(display, window.drawable, window.gc,
+                           cur_x, cur_y, s, strlen(s));
+       }
+       memcpy(tmpstring1, s, TEXT_BUFFER_SIZE);
+       cur_x += width_of_s;
+
+
+}
+
+static void draw_line(char *s)
+{
+       char *p;
+
+       cur_x = text_start_x;
+       cur_y += font_ascent();
+
+       /* find specials and draw stuff */
+       p = s;
+       while (*p) {
+               if (*p == SPECIAL_CHAR) {
+                       int w = 0;
+
+                       /* draw string before special */
+                       *p = '\0';
+                       draw_string(s);
+                       *p = SPECIAL_CHAR;
+                       s = p + 1;
+
+                       /* draw special */
+                       switch (specials[special_index].type) {
+                       case HORIZONTAL_LINE:
+                               {
+                                       int h =
+                                           specials[special_index].height;
+                                       int mid = font_ascent() / 2;
+                                       w = text_start_x + text_width -
+                                           cur_x;
+
+                                       XSetLineAttributes(display,
+                                                          window.gc, h,
+                                                          LineSolid,
+                                                          CapButt,
+                                                          JoinMiter);
+                                       XDrawLine(display, window.drawable,
+                                                 window.gc, cur_x,
+                                                 cur_y - mid, cur_x + w,
+                                                 cur_y - mid);
+                               }
+                               break;
+
+                       case STIPPLED_HR:
+                               {
+                                       int h =
+                                           specials[special_index].height;
+                                       int s =
+                                           specials[special_index].arg;
+                                       int mid = font_ascent() / 2;
+                                       char ss[2] = { s, s };
+                                       w = text_start_x + text_width -
+                                           cur_x - 1;
+
+                                       XSetLineAttributes(display,
+                                                          window.gc, h,
+                                                          LineOnOffDash,
+                                                          CapButt,
+                                                          JoinMiter);
+                                       XSetDashes(display, window.gc, 0,
+                                                  ss, 2);
+                                       XDrawLine(display, window.drawable,
+                                                 window.gc, cur_x,
+                                                 cur_y - mid, cur_x + w,
+                                                 cur_y - mid);
+                               }
+                               break;
+
+                       case BAR:
+                               {
+                                       int h =
+                                           specials[special_index].height;
+                                       int bar_usage =
+                                           specials[special_index].arg;
+                                       int by =
+                                           cur_y - (font_ascent() +
+                                                    h) / 2 + 1;
+                                       w = specials[special_index].width;
+                                       if (w == 0)
+                                               w = text_start_x +
+                                                   text_width - cur_x - 1;
+                                       if (w < 0)
+                                               w = 0;
+
+                                       XSetLineAttributes(display,
+                                                          window.gc, 1,
+                                                          LineSolid,
+                                                          CapButt,
+                                                          JoinMiter);
+
+                                       XDrawRectangle(display,
+                                                      window.drawable,
+                                                      window.gc, cur_x,
+                                                      by, w, h);
+                                       XFillRectangle(display,
+                                                      window.drawable,
+                                                      window.gc, cur_x,
+                                                      by,
+                                                      w * bar_usage / 255,
+                                                      h);
+                               }
+                               break;
+
+                       case FG:
+                               if (draw_mode == FG)
+                                       set_foreground_color(specials
+                                                            [special_index].
+                                                            arg);
+                               break;
+
+                       case BG:
+                               if (draw_mode == BG)
+                                       set_foreground_color(specials
+                                                            [special_index].
+                                                            arg);
+                               break;
+
+                               case OUTLINE:
+                                       if (draw_mode == OUTLINE)
+                                               set_foreground_color(specials
+                                                               [special_index].
+                                                               arg);
+                                       break;
+
+                               case ALIGNR:
+                               {
+                                       int pos_x = text_start_x + text_width - cur_x - 1 - get_string_width(p);
+                                       if ( pos_x > specials[special_index].arg)
+                                               w = pos_x - specials[special_index].arg;
+                               }
+                               break;
+
+                               case ALIGNC:
+                               {
+                                       int pos_x = text_start_x + text_width - cur_x - 1 - get_string_width(p)/2 - (text_width/2);
+                                       if ( pos_x > specials[special_index].arg)
+                                               w = pos_x - specials[special_index].arg;
+                               }
+                               break;
+
+                       }
+
+                       cur_x += w;
+
+                       special_index++;
+               }
+
+               p++;
+       }
+
+       draw_string(s);
+
+       cur_y += font_descent();
+}
+
+static void draw_text()
+{
+       cur_y = text_start_y;
+
+       /* draw borders */
+       if (draw_borders && border_width > 0) {
+               unsigned int b = (border_width + 1) / 2;
+
+               if (stippled_borders) {
+                       char ss[2] =
+                           { stippled_borders, stippled_borders };
+                       XSetLineAttributes(display, window.gc,
+                                          border_width, LineOnOffDash,
+                                          CapButt, JoinMiter);
+                       XSetDashes(display, window.gc, 0, ss, 2);
+               } else {
+                       XSetLineAttributes(display, window.gc,
+                                          border_width, LineSolid,
+                                          CapButt, JoinMiter);
+               }
+
+               XDrawRectangle(display, window.drawable, window.gc,
+                              text_start_x - border_margin + b,
+                              text_start_y - border_margin + b,
+                              text_width + border_margin * 2 - 1 - b * 2,
+                              text_height + border_margin * 2 - 1 -
+                              b * 2);
+       }
+
+       /* draw text */
+       special_index = 0;
+       for_each_line(text_buffer, draw_line);
+}
+
+static void draw_stuff()
+{
+       if (draw_shades && !draw_outline) {
+               text_start_x++;
+               text_start_y++;
+               set_foreground_color(default_bg_color);
+               draw_mode = BG;
+               draw_text();
+               text_start_x--;
+               text_start_y--;
+       }
+
+       if (draw_outline) {
+               int i, j;
+               for (i = -1; i < 2; i++)
+                       for (j = -1; j < 2; j++) {
+                               if (i == 0 && j == 0)
+                                       continue;
+                               text_start_x += i;
+                               text_start_y += j;
+                               set_foreground_color(default_out_color);
+                               draw_mode = OUTLINE;
+                               draw_text();
+                               text_start_x -= i;
+                               text_start_y -= j;
+                       }
+       }
+
+       set_foreground_color(default_fg_color);
+       draw_mode = FG;
+       draw_text();
+
+#ifdef XDBE
+       if (use_xdbe) {
+               XdbeSwapInfo swap;
+               swap.swap_window = window.window;
+               swap.swap_action = XdbeBackground;
+               XdbeSwapBuffers(display, &swap, 1);
+       }
+#endif
+/*#ifdef METAR wtf is this for exactly? aside from trying to cause segfaults?
+if (metar_station != NULL) {
+       free(metar_station);
+       metar_station = NULL;
+}
+if (metar_server != NULL) {
+       free(metar_server);
+       metar_server = NULL;
+}
+if (metar_path != NULL) {
+       free(metar_path);
+       metar_path = NULL;
+}
+#endif*/
+
+}
+
+static void clear_text(int exposures)
+{
+#ifdef XDBE
+       if (use_xdbe)
+               return;         /* The swap action is XdbeBackground, which clears */
+#endif
+       /* there is some extra space for borders and outlines */
+       XClearArea(display, window.drawable,
+                  text_start_x - border_margin - 1,
+                  text_start_y - border_margin - 1,
+                  text_width + border_margin * 2 + 2,
+                  text_height + border_margin * 2 + 2,
+                  exposures ? True : 0);
+}
+
+static int need_to_update;
+
+/* update_text() generates new text and clears old text area */
+static void update_text()
+{
+       generate_text();
+       clear_text(1);
+       need_to_update = 1;
+}
+
+static void main_loop()
+{
+       Region region = XCreateRegion();
+       info.looped = 0;
+       while (total_run_times == 0 || info.looped < total_run_times) {
+               info.looped++;
+               XFlush(display);
+
+               /* wait for X event or timeout */
+
+               if (!XPending(display)) {
+                       fd_set fdsr;
+                       struct timeval tv;
+                       int s;
+                       double t =
+                           update_interval - (get_time() -
+                                              last_update_time);
+
+                       if (t < 0)
+                               t = 0;
+
+                       tv.tv_sec = (long) t;
+                       tv.tv_usec = (long) (t * 1000000) % 1000000;
+
+                       FD_ZERO(&fdsr);
+                       FD_SET(ConnectionNumber(display), &fdsr);
+
+                       s = select(ConnectionNumber(display) + 1, &fdsr, 0,
+                                  0, &tv);
+                       if (s == -1) {
+                               if (errno != EINTR)
+                                       ERR("can't select(): %s",
+                                           strerror(errno));
+                       } else {
+                               /* timeout */
+                               if (s == 0)
+                                       update_text();
+                       }
+               }
+
+               if (need_to_update) {
+#ifdef OWN_WINDOW
+                       int wx = window.x, wy = window.y;
+#endif
+
+                       need_to_update = 0;
+
+                       update_text_area();
+
+#ifdef OWN_WINDOW
+                       if (own_window) {
+                               /* resize window if it isn't right size */
+                               if (!fixed_size &&
+                                   (text_width + border_margin * 2 !=
+                                    window.width
+                                    || text_height + border_margin * 2 !=
+                                    window.height)) {
+                                       window.width =
+                                           text_width +
+                                           border_margin * 2 + 1;
+                                       window.height =
+                                           text_height +
+                                           border_margin * 2 + 1;
+                                       XResizeWindow(display,
+                                                     window.window,
+                                                     window.width,
+                                                     window.height);
+                               }
+
+                               /* move window if it isn't in right position */
+                               if (!fixed_pos
+                                   && (window.x != wx
+                                       || window.y != wy)) {
+                                       XMoveWindow(display, window.window,
+                                                   window.x, window.y);
+                               }
+                       }
+#endif
+
+                       clear_text(1);
+
+#ifdef XDBE
+                       if (use_xdbe) {
+                               XRectangle r;
+                               r.x = text_start_x - border_margin;
+                               r.y = text_start_y - border_margin;
+                               r.width = text_width + border_margin * 2;
+                               r.height = text_height + border_margin * 2;
+                               XUnionRectWithRegion(&r, region, region);
+                       }
+#endif
+               }
+
+               /* handle X events */
+
+               while (XPending(display)) {
+                       XEvent ev;
+                       XNextEvent(display, &ev);
+
+                       switch (ev.type) {
+                       case Expose:
+                               {
+                                       XRectangle r;
+                                       r.x = ev.xexpose.x;
+                                       r.y = ev.xexpose.y;
+                                       r.width = ev.xexpose.width;
+                                       r.height = ev.xexpose.height;
+                                       XUnionRectWithRegion(&r, region,
+                                                            region);
+                               }
+                               break;
+
+#ifdef OWN_WINDOW
+                       case ReparentNotify:
+                               /* set background to ParentRelative for all parents */
+                               if (own_window)
+                                       set_transparent_background(window.
+                                                                  window);
+                               break;
+
+                       case ConfigureNotify:
+                               if (own_window) {
+                                       /* if window size isn't what expected, set fixed size */
+                                       if (ev.xconfigure.width !=
+                                           window.width
+                                           || ev.xconfigure.height !=
+                                           window.height) {
+                                               if (window.width != 0
+                                                   && window.height != 0)
+                                                       fixed_size = 1;
+
+                                               /* clear old stuff before screwing up size and pos */
+                                               clear_text(1);
+
+                                               {
+                                                       XWindowAttributes
+                                                           attrs;
+                                                       if (XGetWindowAttributes(display, window.window, &attrs)) {
+                                                               window.
+                                                                   width =
+                                                                   attrs.
+                                                                   width;
+                                                               window.
+                                                                   height
+                                                                   =
+                                                                   attrs.
+                                                                   height;
+                                                       }
+                                               }
+
+                                               text_width =
+                                                   window.width -
+                                                   border_margin * 2 - 1;
+                                               text_height =
+                                                   window.height -
+                                                   border_margin * 2 - 1;
+                                       }
+
+                                       /* if position isn't what expected, set fixed pos, total_updates
+                                        * avoids setting fixed_pos when window is set to weird locations
+                                        * when started */
+                                       if (total_updates >= 2
+                                           && !fixed_pos
+                                           && (window.x != ev.xconfigure.x
+                                               || window.y !=
+                                               ev.xconfigure.y)
+                                           && (ev.xconfigure.x != 0
+                                               || ev.xconfigure.y != 0)) {
+                                               fixed_pos = 1;
+                                       }
+                               }
+                               break;
+#endif
+
+                       default:
+                               break;
+                       }
+               }
+
+               /* XDBE doesn't seem to provide a way to clear the back buffer without
+                * interfering with the front buffer, other than passing XdbeBackground
+                * to XdbeSwapBuffers. That means that if we're using XDBE, we need to
+                * redraw the text even if it wasn't part of the exposed area. OTOH,
+                * if we're not going to call draw_stuff at all, then no swap happens
+                * and we can safely do nothing.
+                */
+
+               if (!XEmptyRegion(region)) {
+#ifdef XDBE
+                       if (use_xdbe) {
+                               XRectangle r;
+                               r.x = text_start_x - border_margin;
+                               r.y = text_start_y - border_margin;
+                               r.width = text_width + border_margin * 2;
+                               r.height = text_height + border_margin * 2;
+                               XUnionRectWithRegion(&r, region, region);
+                       }
+#endif
+                       XSetRegion(display, window.gc, region);
+#ifdef XFT
+                       if (use_xft)
+                               XftDrawSetClip(window.xftdraw, region);
+#endif
+                       draw_stuff();
+                       XDestroyRegion(region);
+                       region = XCreateRegion();
+               }
+       }
+}
+
+static void load_font()
+{
+#ifdef XFT
+       /* load Xft font */
+       if (use_xft) {
+               if (xftfont != NULL)
+                       XftFontClose(display, xftfont);
+
+               if ((xftfont =
+                    XftFontOpenName(display, screen, font_name)) != NULL)
+                       return;
+
+               ERR("can't load Xft font '%s'", font_name);
+               if ((xftfont =
+                    XftFontOpenName(display, screen,
+                                    "courier-12")) != NULL)
+                       return;
+
+               ERR("can't load Xft font '%s'", "courier-12");
+
+               if ((font = XLoadQueryFont(display, "fixed")) == NULL) {
+                       CRIT_ERR("can't load font '%s'", "fixed");
+               }
+               use_xft = 0;
+
+               return;
+       }
+#endif
+
+       /* load normal font */
+       if (font != NULL)
+               XFreeFont(display, font);
+
+       if ((font = XLoadQueryFont(display, font_name)) == NULL) {
+               ERR("can't load font '%s'", font_name);
+               if ((font = XLoadQueryFont(display, "fixed")) == NULL) {
+                       CRIT_ERR("can't load font '%s'", "fixed");
+               }
+       }
+}
+
+static void set_font()
+{
+#ifdef XFT
+       if (use_xft) {
+               if (window.xftdraw != NULL)
+                       XftDrawDestroy(window.xftdraw);
+               window.xftdraw = XftDrawCreate(display, window.drawable,
+                                              DefaultVisual(display,
+                                                            screen),
+                                              DefaultColormap(display,
+                                                              screen));
+       } else
+#endif
+       {
+               XSetFont(display, window.gc, font->fid);
+       }
+}
+
+static void load_config_file(const char *);
+
+/* signal handler that reloads config file */
+static void reload_handler(int a)
+{
+       fprintf(stderr, "Conky: received signal %d, reloading config\n",
+               a);
+
+       if (current_config) {
+               clear_fs_stats();
+               load_config_file(current_config);
+               load_font();
+               set_font();
+               extract_variable_text(text);
+               free(text);
+               text = NULL;
+               update_text();
+       }
+}
+
+static void clean_up()
+{
+#ifdef XDBE
+       if (use_xdbe)
+               XdbeDeallocateBackBufferName(display, window.back_buffer);
+#endif
+#ifdef OWN_WINDOW
+       if (own_window)
+               XDestroyWindow(display, window.window);
+       else
+#endif
+       {
+               clear_text(1);
+               XFlush(display);
+       }
+
+       XFreeGC(display, window.gc);
+
+       /* it is really pointless to free() memory at the end of program but ak|ra
+        * wants me to do this */
+
+       free_text_objects();
+
+       if (text != original_text)
+               free(text);
+
+       free(current_config);
+       free(current_mail_spool);
+#ifdef SETI
+       free(seti_dir);
+#endif
+}
+
+static void term_handler(int a)
+{
+       a = a;                  /* to get rid of warning */
+       clean_up();
+       exit(0);
+}
+
+static int string_to_bool(const char *s)
+{
+       if (!s)
+               return 1;
+       if (strcasecmp(s, "yes") == 0)
+               return 1;
+       if (strcasecmp(s, "true") == 0)
+               return 1;
+       if (strcasecmp(s, "1") == 0)
+               return 1;
+       return 0;
+}
+
+static enum alignment string_to_alignment(const char *s)
+{
+       if (strcasecmp(s, "top_left") == 0)
+               return TOP_LEFT;
+       else if (strcasecmp(s, "top_right") == 0)
+               return TOP_RIGHT;
+       else if (strcasecmp(s, "bottom_left") == 0)
+               return BOTTOM_LEFT;
+       else if (strcasecmp(s, "bottom_right") == 0)
+               return BOTTOM_RIGHT;
+       else if (strcasecmp(s, "tl") == 0)
+               return TOP_LEFT;
+       else if (strcasecmp(s, "tr") == 0)
+               return TOP_RIGHT;
+       else if (strcasecmp(s, "bl") == 0)
+               return BOTTOM_LEFT;
+       else if (strcasecmp(s, "br") == 0)
+               return BOTTOM_RIGHT;
+
+       return TOP_LEFT;
+}
+
+static void set_default_configurations(void)
+{
+       text_alignment = BOTTOM_LEFT;
+       fork_to_background = 0;
+       border_margin = 3;
+       border_width = 1;
+       total_run_times = 0;
+       info.cpu_avg_samples = 2;
+       info.net_avg_samples = 2;
+       info.memmax = 0;
+#ifdef MPD
+       info.mpd.host = "localhost";
+       info.mpd.port = 6600;
+       info.mpd.status = "Checking status...";
+#endif
+       out_to_console = 0;
+       top_sort_cpu = 1;
+       use_spacer = 0;
+       default_fg_color = WhitePixel(display, screen);
+       default_bg_color = BlackPixel(display, screen);
+       default_out_color = BlackPixel(display, screen);
+       draw_borders = 0;
+       draw_shades = 1;
+       draw_outline = 0;
+       free(font_name);
+#ifdef XFT
+       use_xft = 1;
+       font_name = strdup("courier-12");
+#else
+       font_name = strdup("6x10");
+#endif
+       gap_x = 5;
+       gap_y = 5;
+
+       free(current_mail_spool);
+       {
+               char buf[256];
+               variable_substitute(MAIL_FILE, buf, 256);
+               if (buf[0] != '\0')
+                       current_mail_spool = strdup(buf);
+       }
+
+       minimum_width = 5;
+       minimum_height = 5;
+       no_buffers = 1;
+#ifdef OWN_WINDOW
+       own_window = 0;
+#endif
+       stippled_borders = 0;
+       update_interval = 10.0;
+       stuff_in_upper_case = 0;
+        #ifdef MLDONKEY
+          mlconfig.mldonkey_hostname="127.0.0.1";
+          mlconfig.mldonkey_port=4001;
+          mlconfig.mldonkey_login=NULL;
+          mlconfig.mldonkey_password=NULL;
+        #endif
+#ifdef METAR
+        metar_station = NULL;
+        metar_server = NULL;
+        metar_path = NULL;
+        last_metar_update = 0;
+#endif
+}
+
+static void load_config_file(const char *f)
+{
+#define CONF_ERR ERR("%s: %d: config file error", f, line);
+       int line = 0;
+       FILE *fp;
+
+       set_default_configurations();
+
+       fp = open_file(f, 0);
+       if (!fp)
+               return;
+
+       while (!feof(fp)) {
+               char buf[256], *p, *p2, *name, *value;
+               line++;
+               if (fgets(buf, 256, fp) == NULL)
+                       break;
+
+               p = buf;
+
+               /* break at comment */
+               p2 = strchr(p, '#');
+               if (p2)
+                       *p2 = '\0';
+
+               /* skip spaces */
+               while (*p && isspace((int) *p))
+                       p++;
+               if (*p == '\0')
+                       continue;       /* empty line */
+
+               name = p;
+
+               /* skip name */
+               p2 = p;
+               while (*p2 && !isspace((int) *p2))
+                       p2++;
+               if (*p2 != '\0') {
+                       *p2 = '\0';     /* break at name's end */
+                       p2++;
+               }
+
+               /* get value */
+               if (*p2) {
+                       p = p2;
+                       while (*p && isspace((int) *p))
+                               p++;
+
+                       value = p;
+
+                       p2 = value + strlen(value);
+                       while (isspace((int) *(p2 - 1)))
+                               *--p2 = '\0';
+               } else {
+                       value = 0;
+               }
+
+#define CONF2(a) if (strcasecmp(name, a) == 0)
+#define CONF(a) else CONF2(a)
+#define CONF3(a,b) \
+else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
+
+
+               CONF2("alignment") {
+       if (value) {
+               int a = string_to_alignment(value);
+               if (a <= 0)
+                       CONF_ERR
+                                       else
+                                       text_alignment = a;
+       } else
+               CONF_ERR}
+               CONF("background") {
+                       fork_to_background = string_to_bool(value);
+               }
+               CONF("border_margin") {
+                       if (value)
+                               border_margin =
+                                               strtol(value, 0, 0);
+                       else
+                               CONF_ERR}
+                       CONF("border_width") {
+                               if (value)
+                                       border_width =
+                                                       strtol(value, 0, 0);
+                               else
+                                       CONF_ERR}
+                               CONF("default_color") {
+                                       if (value)
+                                               default_fg_color =
+                                                               get_x11_color
+                                                               (value);
+                                       else
+                                               CONF_ERR}
+                                       CONF3
+                                                       ("default_shade_color",
+                                                       "default_shadecolor")
+                                       {
+                                               if (value)
+                                                       default_bg_color
+                                                                       =
+                                                                       get_x11_color
+                                                                       (value);
+                                               else
+                                                       CONF_ERR}
+                                               CONF3
+                                                               ("default_outline_color",
+                                                               "default_outlinecolor")
+                                               {
+                                                       if (value)
+                                                               default_out_color
+                                                                               =
+                                                                               get_x11_color
+                                                                               (value);
+                                                       else
+                                                               CONF_ERR}
+#ifdef MPD
+                                                                       CONF("mpd_host") {
+       if (value)
+               info.
+                               mpd.
+                               host
+                               =
+                               value;
+       else
+               CONF_ERR}
+       CONF("mpd_port") {
+               if (value) {
+                       info.
+                                       mpd.
+                                       port
+                                       =
+                                       strtol
+                                       (value,
+                                        0,
+                                        0);
+                       if (info.mpd.port < 1 || info.mpd.port > 0xffff)
+                               CONF_ERR}
+       }
+#endif
+                                                                                                       CONF("cpu_avg_samples") {
+       if (value) {
+               cpu_avg_samples
+                               =
+                               strtol
+                               (value,
+                                0,
+                                0);
+               if (cpu_avg_samples < 1 || cpu_avg_samples > 14)
+                       CONF_ERR
+                                       else
+                                       info.
+                                       cpu_avg_samples
+                                       =
+                                       cpu_avg_samples;
+       } else
+               CONF_ERR}
+               CONF("net_avg_samples") {
+                       if (value) {
+                               net_avg_samples
+                                               =
+                                               strtol
+                                               (value,
+                                               0,
+                                               0);
+                               if (net_avg_samples < 1 || net_avg_samples > 14)
+                                       CONF_ERR
+                                                       else
+                                                       info.
+                                                       net_avg_samples
+                                                       =
+                                                       net_avg_samples;
+                       } else
+                               CONF_ERR}
+
+
+
+
+
+
+#ifdef XDBE
+                                                                                                                       CONF("double_buffer") {
+       use_xdbe
+                       =
+                       string_to_bool
+                       (value);
+                                                                               }
+#endif
+                                                                                                               CONF("draw_borders") {
+       draw_borders
+                       =
+                       string_to_bool
+                       (value);
+                                                                               }
+                                                                               CONF("draw_shades") {
+                                                                               draw_shades
+                                                                               =
+                                                                               string_to_bool
+                                                                               (value);
+                                                                               }
+                                                                               CONF("draw_outline") {
+                                                                               draw_outline
+                                                                               =
+                                                                               string_to_bool
+                                                                               (value);
+                                                                               }
+                                                                               CONF("out_to_console") {
+                                                                               out_to_console
+                                                                               =
+                                                                               string_to_bool
+                                                                               (value);
+                                                                               }
+                                                                               CONF("top_sort_cpu") {
+                                                                               top_sort_cpu
+                                                                               =
+                                                                               string_to_bool
+                                                                               (value);
+                                                                               }
+                                                                               CONF("use_spacer") {
+                                                                               use_spacer
+                                                                               =
+                                                                               string_to_bool
+                                                                               (value);
+                                                                               }
+#ifdef XFT
+                                                                                                               CONF("use_xft") {
+       use_xft
+                       =
+                       string_to_bool
+                       (value);
+                                                                               }
+                                                                               CONF("font") {
+                                                                               /* font silently ignored when Xft */
+                                                                               }
+                                                                               CONF("xftalpha") {
+                                                                               if (value)
+                                                                               font_alpha
+                                                                               =
+                                                                               atof
+                                                                               (value)
+                                                                               *
+                                                                               65535.0;
+                                                                               else
+                                                                               CONF_ERR}
+                                                                               CONF("xftfont") {
+#else
+                                                                                                               CONF("use_xft") {
+       if (string_to_bool(value))
+               ERR("Xft not enabled");
+                                                                               }
+                                                                               CONF("xftfont") {
+                                                                               /* xftfont silently ignored when no Xft */
+                                                                               }
+                                                                               CONF("xftalpha") {
+                                                                               /* xftalpha is silently ignored when no Xft */
+                                                                               }
+                                                                               CONF("font") {
+#endif
+                                                                                                                       if (value) {
+       free(font_name);
+       font_name
+                       =
+                       strdup
+                       (value);
+                                                                               } else
+                                                                               CONF_ERR}
+                                                                               CONF("gap_x") {
+                                                                               if (value)
+                                                                               gap_x
+                                                                               =
+                                                                               atoi
+                                                                               (value);
+                                                                               else
+                                                                               CONF_ERR}
+                                                                               CONF("gap_y") {
+                                                                               if (value)
+                                                                               gap_y
+                                                                               =
+                                                                               atoi
+                                                                               (value);
+                                                                               else
+                                                                               CONF_ERR}
+                                                                               CONF("mail_spool") {
+                                                                               if (value) {
+                                                                               char buf[256];
+                                                                               variable_substitute
+                                                                               (value,
+                                                                               buf,
+                                                                               256);
+
+                                                                               if (buf[0]
+                                                                               !=
+                                                                               '\0')
+                                                                               {
+                                                                               if (current_mail_spool)
+                                                                               free(current_mail_spool);
+                                                                               current_mail_spool
+                                                                               =
+                                                                               strdup
+                                                                               (buf);
+                                                                               }
+                                                                               } else
+                                                                               CONF_ERR}
+                                                                               CONF("minimum_size") {
+                                                                               if (value) {
+                                                                               if (sscanf(value, "%d %d", &minimum_width, &minimum_height) != 2)
+                                                                               if (sscanf(value, "%d", &minimum_width) != 1)
+                                                                               CONF_ERR}
+                                                                               else
+                                                                               CONF_ERR}
+                                                                               CONF("no_buffers") {
+                                                                               no_buffers
+                                                                               =
+                                                                               string_to_bool(value);
+                                                                               }
+#ifdef MLDONKEY
+CONF("mldonkey_hostname") {
+if (value)
+       mlconfig.mldonkey_hostname = strdup(value);
+else
+CONF_ERR
+}
+CONF("mldonkey_port") {
+if (value)
+       mlconfig.mldonkey_port = atoi(value);
+else
+       CONF_ERR
+}
+CONF("mldonkey_login") {
+if (value)
+       mlconfig.mldonkey_login = strdup(value);
+else
+       CONF_ERR
+}
+CONF("mldonkey_password") {
+if (value)
+       mlconfig.mldonkey_password = strdup(value);
+else
+       CONF_ERR
+}
+#endif
+#ifdef OWN_WINDOW
+                                                                                                                                                               CONF("own_window") {
+       own_window
+                       =
+                       string_to_bool
+                       (value);
+                                                                               }
+#endif
+                                                                                                                                                               CONF("pad_percents") {
+       pad_percents
+                       =
+                       atoi
+                       (value);
+                                                                               }
+                                                                               CONF("stippled_borders") {
+                                                                               if (value)
+                                                                               stippled_borders
+                                                                               =
+                                                                               strtol
+                                                                               (value,
+                                                                               0,
+                                                                               0);
+                                                                               else
+                                                                               stippled_borders
+                                                                               =
+                                                                               4;
+                                                                               }
+                                                                               CONF("temp1") {
+                                                                               ERR("temp1 configuration is obsolete, use ${i2c <i2c device here> temp 1}");
+                                                                               }
+                                                                               CONF("temp1") {
+                                                                               ERR("temp2 configuration is obsolete, use ${i2c <i2c device here> temp 2}");
+                                                                               }
+                                                                               CONF("update_interval") {
+                                                                               if (value)
+                                                                               update_interval
+                                                                               =
+                                                                               strtod
+                                                                               (value,
+                                                                               0);
+                                                                               else
+                                                                               CONF_ERR}                                                                               CONF("total_run_times") {
+                                                                               if (value)
+                                                                               total_run_times
+                                                                               =
+                                                                               strtod
+                                                                               (value,
+                                                                               0);
+                                                                               else
+                                                                               CONF_ERR}
+                                                                               CONF("uppercase") {
+                                                                               stuff_in_upper_case
+                                                                               =
+                                                                               string_to_bool
+                                                                               (value);
+                                                                               }
+#ifdef SETI
+                                                                                                                                                                       CONF("seti_dir") {
+       seti_dir
+                       =
+                       (char
+                       *)
+                       malloc
+                       (strlen
+                       (value)
+                       +
+                       1);
+       strcpy
+                       (seti_dir,
+                        value);
+                                                                               }
+#endif
+#ifdef METAR
+     CONF("metar_station"){
+              metar_station = (char*)malloc(strlen(value) + 5);
+              strcpy(metar_station, value);
+              strcat(metar_station,".TXT");
+            }
+            CONF("metar_server"){
+                      metar_server = (char*)malloc(strlen(value) + 1);
+                      strcpy(metar_server, value);      
+                    }
+                    CONF("metar_path"){
+                              metar_path = (char*)malloc(strlen(value) + 1);
+                              strcpy(metar_path, value);
+
+            }
+        #endif
+                                                                                                                                                                       CONF("text") {
+       if (text != original_text)
+               free(text);
+
+       text = (char *)
+                       malloc
+                       (1);
+       text[0]
+                       =
+                       '\0';
+
+       while
+       (!feof
+                (fp))
+       {
+               unsigned
+                               int
+                               l
+                               =
+                               strlen
+                               (text);
+               if (fgets(buf, 256, fp) == NULL)
+                       break;
+               text = (char *)
+                               realloc
+                               (text,
+                                l
+                                                +
+                                                strlen
+                                                (buf)
+                                                +
+                                                1);
+               strcat
+                               (text,
+                                buf);
+
+               if (strlen(text) > 1024 * 8)
+                       break;
+       }
+       fclose
+                       (fp);
+       return;
+                                                                               }
+                                                                               else
+                                                                               ERR("%s: %d: no such configuration: '%s'", f, line, name);
+
+#undef CONF
+#undef CONF2
+                                                                               }
+
+                                                                               fclose
+                                                                               (fp);
+#undef CONF_ERR
+       }
+
+       /* : means that character before that takes an argument */
+       static
+                       const
+                       char
+                       *getopt_string
+                       =
+                       "vVdt:f:u:i:hc:w:x:y:a:"
+#ifdef OWN_WINDOW
+                       "o"
+#endif
+#ifdef XDBE
+                       "b"
+#endif
+;
+
+
+       int main(int argc, char **argv) {
+               /* handle command line parameters that don't change configs */
+               while
+               (1)
+               {
+                       int c = getopt(argc,
+                               argv,
+                               getopt_string);
+                       if (c == -1)
+                               break;
+
+                       switch
+                       (c)
+                       {
+                               case 'v':
+                               case 'V':
+                                       printf
+                                                       ("Conky "
+                                                       VERSION
+                                                       " compiled "
+                                                       __DATE__
+                                                       "\n");
+                                       return
+                                                       0;
+
+                               case 'c':
+                                                                                                                                                                               /* if current_config is set to a strdup of CONFIG_FILE, free it (even
+                                                                               * though free() does the NULL check itself;), then load optarg value */
+                                       if (current_config)
+                                               free(current_config);
+                                       current_config
+                                                       =
+                                                       strdup
+                                                       (optarg);
+                                       break;
+
+                               case 'h':
+                                       printf
+                                                       ("Usage: %s [OPTION]...\n"
+                                                       "Conky is a system monitor that renders text on desktop or to own transparent\n"
+                                                       "window. Command line options will override configurations defined in config\n"
+                                                       "file.\n"
+                                                       "   -V            version\n"
+                                                       "   -a ALIGNMENT  text alignment on screen, {top,bottom}_{left,right}\n"
+                                                       "   -c FILE       config file to load instead of "
+                                                       CONFIG_FILE
+                                                       "\n"
+                                                       "   -d            daemonize, fork to background\n"
+                                                       "   -f FONT       font to use\n"
+                                                       "   -h            help\n"
+#ifdef OWN_WINDOW
+                                                       "   -o            create own window to draw\n"
+#endif
+#ifdef XDBE
+                                                       "   -b            double buffer (prevents flickering)\n"
+#endif
+                                                       "   -t TEXT       text to render, remember single quotes, like -t '$uptime'\n"
+                                                       "   -u SECS       update interval\n"
+                                                       "   -i NUM        number of times to update Conky\n"
+                                                       "   -w WIN_ID     window id to draw\n"
+                                                       "   -x X          x position\n"
+                                                       "   -y Y          y position\n",
+                                       argv
+                                                       [0]);
+                                       return
+                                                       0;
+
+                               case 'w':
+                                       window.
+                                                       window
+                                                       =
+                                                       strtol
+                                                       (optarg,
+                                                       0,
+                                                       0);
+                                       break;
+
+                               case '?':
+                                       exit(EXIT_FAILURE);
+                       }
+               }
+               /* initalize X BEFORE we load config. (we need to so that 'screen' is set) */
+               init_X11
+                       ();
+               
+               tmpstring1 = (char*)malloc(2*TEXT_BUFFER_SIZE);
+               tmpstring2 = (char*)malloc(2*TEXT_BUFFER_SIZE);
+
+               /* load current_config or CONFIG_FILE */
+
+#ifdef CONFIG_FILE
+                                                                                                                                                               if (current_config == NULL) {
+       /* load default config file */
+       char buf[256];
+
+       variable_substitute
+                       (CONFIG_FILE,
+                       buf,
+                       256);
+
+       if (buf[0] != '\0')
+               current_config
+                               =
+                               strdup
+                               (buf);
+                                                                               }
+#endif
+
+                                                                                                                                                               if (current_config != NULL)
+                                                                                                                                                                       load_config_file
+                                                                                                                                                                       (current_config);
+                                                                                                                                                               else
+                                                                               set_default_configurations
+                                                                               ();
+
+#ifdef MAIL_FILE
+                                                                                                                                                               if (current_mail_spool == NULL) {
+       char buf[256];
+       variable_substitute
+                       (MAIL_FILE,
+                       buf,
+                       256);
+
+       if (buf[0] != '\0')
+               current_mail_spool
+                               =
+                               strdup
+                               (buf);
+                                                                               }
+#endif
+
+                                                                                                                                                               /* handle other command line arguments */
+
+                                                                                                                                                               optind = 0;
+
+                                                                                                                                                               while
+                                                                               (1)
+                                                                               {
+                                                                               int c = getopt(argc,
+                                                                               argv,
+                                                                               getopt_string);
+                                                                               if (c == -1)
+                                                                               break;
+
+                                                                               switch
+                                                                               (c)
+                                                                               {
+                                                                               case 'a':
+                                                                               text_alignment
+                                                                               =
+                                                                               string_to_alignment
+                                                                               (optarg);
+                                                                               break;
+
+                                                                               case 'd':
+                                                                               fork_to_background
+                                                                               =
+                                                                               1;
+                                                                               break;
+
+                                                                               case 'f':
+                                                                               font_name
+                                                                               =
+                                                                               strdup
+                                                                               (optarg);
+                                                                               break;
+
+#ifdef OWN_WINDOW
+                                                                               case 'o':
+                                                                               own_window
+                                                                               =
+                                                                               1;
+                                                                               break;
+#endif
+#ifdef XDBE
+                                                                               case 'b':
+                                                                               use_xdbe
+                                                                               =
+                                                                               1;
+                                                                               break;
+#endif
+
+                                                                               case 't':
+                                                                               if (text != original_text)
+                                                                               free(text);
+                                                                               text = strdup(optarg);
+                                                                               convert_escapes
+                                                                               (text);
+                                                                               break;
+
+                                                                               case 'u':
+                                                                               update_interval
+                                                                               =
+                                                                               strtod
+                                                                               (optarg,
+                                                                               0);
+                                                                               break;
+                                                                               
+                                                                               case 'i':
+                                                                               total_run_times
+                                                                               =
+                                                                               strtod
+                                                                               (optarg,
+                                                                               0);
+                                                                               break;
+
+                                                                               case 'x':
+                                                                               gap_x
+                                                                               =
+                                                                               atoi
+                                                                               (optarg);
+                                                                               break;
+
+                                                                               case 'y':
+                                                                               gap_y
+                                                                               =
+                                                                               atoi
+                                                                               (optarg);
+                                                                               break;
+
+                                                                               case '?':
+                                                                               exit(EXIT_FAILURE);
+                                                                               }
+                                                                               }
+
+                                                                               /* load font */
+                                                                               load_font
+                                                                               ();
+
+                                                                               /* generate text and get initial size */
+                                                                               extract_variable_text
+                                                                               (text);
+                                                                               if (text != original_text)
+                                                                               free(text);
+                                                                               text = NULL;
+
+                                                                               update_uname
+                                                                               ();
+
+                                                                               generate_text
+                                                                               ();
+                                                                               update_text_area();     /* to get initial size of the window */
+
+                                                                               init_window
+                                                                               (own_window,
+                                                                               text_width
+                                                                               +
+                                                                               border_margin
+                                                                               *
+                                                                               2
+                                                                               +
+                                                                               1,
+                                                                               text_height
+                                                                               +
+                                                                               border_margin
+                                                                               *
+                                                                               2
+                                                                               +
+                                                                               1);
+
+                                                                               update_text_area();     /* to position text/window on screen */
+
+#ifdef CAIRO
+// why the fuck not?
+//do_it();
+#endif
+
+#ifdef OWN_WINDOW
+                                                                                                                                                               if (own_window)
+                                                                                                                                                                       XMoveWindow
+                                                                                                                                                                       (display,
+               window.
+                               window,
+               window.
+                               x,
+               window.
+                               y);
+#endif
+
+                                                                                                                                                               create_gc
+                                                                                                                                                               ();
+
+                                                                                                                                                               set_font
+                                                                               ();
+
+                                                                               draw_stuff
+                                                                               ();
+
+                                                                               /* fork */
+                                                                               if (fork_to_background) {
+                                                                               int ret = fork();
+                                                                               switch
+                                                                               (ret)
+                                                                               {
+                                                                               case -1:
+                                                                               ERR("can't fork() to background: %s", strerror(errno));
+                                                                               break;
+
+                                                                               case 0:
+                                                                               break;
+
+                                                                               default:
+                                                                               fprintf
+                                                                               (stderr,
+                                                                               "Conky: forked to background, pid is %d\n",
+                                                                               ret);
+                                                                               return 0;
+                                                                               }
+                                                                               }
+
+                                                                               /* set SIGUSR1, SIGINT and SIGTERM handlers */
+                                                                               {
+                                                                               struct
+                                                                               sigaction
+                                                                               sa;
+
+                                                                               sa.sa_handler = reload_handler;
+                                                                               sigemptyset
+                                                                               (&sa.
+                                                                               sa_mask);
+                                                                               sa.sa_flags = SA_RESTART;
+                                                                               if (sigaction(SIGUSR1, &sa, NULL) != 0)
+                                                                               ERR("can't set signal handler for SIGUSR1: %s", strerror(errno));
+
+                                                                               sa.sa_handler = term_handler;
+                                                                               sigemptyset
+                                                                               (&sa.
+                                                                               sa_mask);
+                                                                               sa.sa_flags = SA_RESTART;
+                                                                               if (sigaction(SIGINT, &sa, NULL) != 0)
+                                                                               ERR("can't set signal handler for SIGINT: %s", strerror(errno));
+
+                                                                               sa.sa_handler = term_handler;
+                                                                               sigemptyset
+                                                                               (&sa.
+                                                                               sa_mask);
+                                                                               sa.sa_flags = SA_RESTART;
+                                                                               if (sigaction(SIGTERM, &sa, NULL) != 0)
+                                                                               ERR("can't set signal handler for SIGTERM: %s", strerror(errno));
+                                                                               }
+                                                                               main_loop
+                                                                               ();
+                                                                               free(tmpstring1);
+                                                                               free(tmpstring2);
+                                                                               return
+                                                                               0;
+       }
diff --git a/conky.h b/conky.h
new file mode 100644 (file)
index 0000000..58cfa55
--- /dev/null
+++ b/conky.h
@@ -0,0 +1,383 @@
+#ifndef _conky_h_
+#define _conky_h_
+
+//#include <mcheck.h>
+#include "config.h"
+#include <sys/utsname.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#if defined(HAVE_CAIRO_H) && defined(HAVE_CAIRO_XLIB_H) && defined(WANT_CAIRO)
+#define CAIRO
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <cairo.h>
+#include <cairo-xlib.h>
+#endif
+
+#define TOP_CPU 1
+#define TOP_NAME 2
+#define TOP_PID 3
+#define TOP_MEM 4
+
+#define TEXT_BUFFER_SIZE (1024*4)
+
+#ifdef METAR
+#include <metar.h>
+#endif
+
+#include <sys/socket.h>
+
+#define ERR(s, varargs...) \
+fprintf(stderr, "Conky: " s "\n", ##varargs)
+
+/* critical error */
+#define CRIT_ERR(s, varargs...) \
+{ fprintf(stderr, "Conky: " s "\n", ##varargs);  exit(EXIT_FAILURE); }
+
+struct net_stat {
+       const char *dev;
+       int up;
+       long long last_read_recv, last_read_trans;
+       long long recv, trans;
+       double recv_speed, trans_speed;
+       struct sockaddr addr;
+       int linkstatus;
+       double net_rec[15], net_trans[15];
+};
+
+struct fs_stat {
+       int fd;
+       char *path;
+       long long size;
+       long long avail;
+};
+
+struct cpu_stat {
+       unsigned int user, nice, system, idle, iowait, irq, softirq;
+       int cpu_avg_samples;
+};
+
+#ifdef MPD
+struct mpd_s {
+       char *title;
+       char *artist;
+       char *album;
+       char *status;
+       int volume;
+       unsigned int port;
+       char *host;
+       float progress;
+       int bitrate;
+};
+#endif
+
+enum {
+       INFO_CPU = 0,
+       INFO_MAIL = 1,
+       INFO_MEM = 2,
+       INFO_NET = 3,
+#ifdef SETI
+       INFO_SETI = 4,
+#endif
+       INFO_PROCS = 5,
+       INFO_RUN_PROCS = 6,
+       INFO_UPTIME = 7,
+       INFO_BUFFERS = 8,
+       INFO_FS = 9,
+       INFO_I2C = 10,
+       INFO_MIXER = 11,
+       INFO_LOADAVG = 12,
+       INFO_UNAME = 13,
+       INFO_FREQ = 14,
+#ifdef MPD
+       INFO_MPD = 15,
+#endif
+       INFO_TOP = 16,
+#ifdef METAR
+       INFO_METAR     = 17,
+#endif
+#ifdef MLDONKEY
+       INFO_MLDONKEY = 18,
+#endif
+        INFO_WIFI = 19,
+};
+
+
+#ifdef MPD
+#include "libmpdclient.h"
+#endif
+
+struct information {
+       unsigned int mask;
+
+       struct utsname uname_s;
+
+       char freq[10];
+
+       double uptime;
+
+       /* memory information in kilobytes */
+       unsigned int mem, memmax, swap, swapmax;
+       unsigned int bufmem, buffers, cached;
+
+       unsigned int procs;
+       unsigned int run_procs;
+
+       float cpu_usage;
+       struct cpu_stat cpu_summed;
+       unsigned int cpu_count;
+       unsigned int cpu_avg_samples;
+
+       unsigned int net_avg_samples;
+
+       float loadavg[3];
+
+       int new_mail_count, mail_count;
+#ifdef SETI
+       float seti_prog;
+       float seti_credit;
+#endif
+#ifdef MPD
+       struct mpd_s mpd;
+       mpd_Connection *conn;
+#endif
+       struct process *tops[10];
+       unsigned long looped;
+};
+
+/* in x11.c */
+
+#include <X11/Xlib.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+
+#ifdef XFT
+#include <X11/Xft/Xft.h>
+#endif
+
+#if defined(HAVE_XDBE) && defined(DOUBLE_BUFFER)
+#define XDBE
+#include <X11/extensions/Xdbe.h>
+#endif
+
+#define ATOM(a) XInternAtom(display, #a, False)
+
+struct conky_window {
+       Window window;
+       Drawable drawable;
+       GC gc;
+#ifdef XDBE
+       XdbeBackBuffer back_buffer;
+#endif
+#ifdef XFT
+       XftDraw *xftdraw;
+#endif
+
+       int width;
+       int height;
+#ifdef OWN_WINDOW
+       int x;
+       int y;
+#endif
+};
+
+#ifdef XDBE
+extern int use_xdbe;
+#endif
+
+int out_to_console;
+
+int top_sort_cpu;
+
+int use_spacer;
+
+char *tmpstring1;
+char *tmpstring2;
+
+#ifdef XFT
+extern int use_xft;
+#endif
+
+extern Display *display;
+extern int display_width;
+extern int display_height;
+extern int screen;
+
+extern int workarea[4];
+
+extern struct conky_window window;
+
+void init_X11();
+void init_window(int use_own_window, int width, int height);
+void create_gc();
+void set_transparent_background(Window win);
+long get_x11_color(const char *);
+
+/* in common.c */
+
+/* struct that has all info */
+struct information info;
+
+void update_uname();
+double get_time(void);
+FILE *open_file(const char *file, int *reported);
+void variable_substitute(const char *s, char *dest, unsigned int n);
+void format_seconds(char *buf, unsigned int n, long t);
+void format_seconds_short(char *buf, unsigned int n, long t);
+struct net_stat *get_net_stat(const char *dev);
+
+void update_stuff();
+
+#define SET_NEED(a) need_mask |= 1 << (a)
+extern unsigned int need_mask;
+
+extern double current_update_time, last_update_time;
+
+extern int no_buffers;
+
+/* system dependant (in linux.c) */
+
+void prepare_update(void);
+void update_uptime(void);
+void update_meminfo(void);
+void update_net_stats(void);
+void update_wifi_stats(void);
+void update_cpu_usage(void);
+void update_total_processes(void);
+void update_running_processes(void);
+char *get_freq();
+void update_load_average();
+int open_i2c_sensor(const char *dev, const char *type, int n, int *div,
+                   char *devtype);
+double get_i2c_info(int *fd, int arg, char *devtype, char *type);
+
+char *get_adt746x_cpu(void);
+char *get_adt746x_fan(void);
+
+int open_acpi_temperature(const char *name);
+double get_acpi_temperature(int fd);
+char *get_acpi_ac_adapter(void);
+char *get_acpi_fan(void);
+void get_battery_stuff(char *buf, unsigned int n, const char *bat);
+
+struct process {
+       struct process *next;
+       struct process *previous;
+
+       pid_t pid;
+       char *name;
+       float amount;
+       unsigned int user_time;
+       unsigned int total;
+       unsigned int kernel_time;
+       unsigned int previous_user_time;
+       unsigned int previous_kernel_time;
+       unsigned int vsize;
+       unsigned int rss;
+       unsigned int time_stamp;
+       unsigned int counted;
+       unsigned int changed;
+       float totalmem;
+};
+
+#ifdef METAR
+double last_metar_update;
+extern char *metar_station;
+extern char *metar_server;
+extern char *metar_path;
+extern char ftp_ok;
+extern char metar_worked;
+extern Decoded_METAR data;
+
+extern int calculateRelativeHumidity(int, int);
+extern int calculateWindChill(int, int);
+extern int knTokph(int);
+extern const char *calculateWindDirectionString(int);
+extern const char *calculateShortWindDirectionString(int);
+
+void update_metar();
+#endif
+
+
+
+void update_top();
+
+
+/* fs-stuff is possibly system dependant (in fs.c) */
+
+void update_fs_stats(void);
+struct fs_stat *prepare_fs_stat(const char *path);
+void clear_fs_stats(void);
+
+/* in mixer.c */
+
+int mixer_init(const char *);
+int mixer_get_avg(int);
+int mixer_get_left(int);
+int mixer_get_right(int);
+
+/* in mail.c */
+
+extern char *current_mail_spool;
+
+void update_mail_count();
+
+/* in seti.c */
+
+#ifdef SETI
+extern char *seti_dir;
+
+void update_seti();
+#endif
+
+/* in mpd.c */
+
+#ifdef MPD
+void update_mpd();
+#endif
+
+#ifdef MLDONKEY
+/* in mldonkey.c */
+typedef long long int64;
+/* The info necessary to connect to mldonkey. login and password can be NULL. */
+typedef struct mldonkey_config {
+       char *mldonkey_hostname;
+       int mldonkey_port;
+       char *mldonkey_login;
+       char *mldonkey_password;
+} mldonkey_config;
+
+/* The MLDonkey status returned */
+typedef struct mldonkey_info {
+       int64  upload_counter;
+       int64 download_counter;
+       int nshared_files;
+       int64 shared_counter;
+       int  tcp_upload_rate;
+       int  tcp_download_rate;
+       int  udp_upload_rate;
+       int  udp_download_rate;
+       int  ndownloaded_files;
+       int ndownloading_files;
+       int nconnected_networks;
+       int connected_networks[1];
+} mldonkey_info;
+       
+extern mldonkey_info mlinfo;
+extern mldonkey_config mlconfig;
+       
+int get_mldonkey_status(mldonkey_config *config, mldonkey_info *info);
+#endif
+
+
+
+/* in linux.c */
+
+extern int show_nice_processes;
+
+/* in cairo.c */
+
+extern int do_it(void);
+
+#endif
diff --git a/conky.x b/conky.x
new file mode 100644 (file)
index 0000000..0c717c6
--- /dev/null
+++ b/conky.x
@@ -0,0 +1,16 @@
+[NAME]
+Conky
+[DESCRIPTION]
+.\" Add any additional description here
+[EXAMPLES]
+.B
+conky -t '${time %D %H:%m}' -o -u 30
+.PP
+Start Conky in its own window with date and clock as text and 30 sec update interval.
+
+.B
+conky -a top_left -x 5 -y 500 -d
+.PP
+Start Conky to background at coordinates (5, 500).
+[FILES]
+~/.conkyrc default configuration file
diff --git a/conkyrc.sample b/conkyrc.sample
new file mode 100644 (file)
index 0000000..83dda90
--- /dev/null
@@ -0,0 +1,315 @@
+# conky configuration
+
+# set to yes if you want tormo to be forked in the background
+background no
+
+# X font when Xft is disabled, you can pick one with program xfontsel
+#font 5x7
+#font 6x10
+#font 7x13
+#font 8x13
+font 9x15
+#font *mintsmild.se*
+#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*
+
+# Use Xft?
+use_xft no
+
+# Print everything to stdout?
+# out_to_console no
+
+# MPD host/port
+# mpd_host localhost
+# mpd_port 6600
+
+# Print everything to console?
+# out_to_console no
+
+# Xft font when Xft is enabled
+xftfont courier-12
+
+# Text alpha when using Xft
+xftalpha 0.8
+
+# mail spool
+mail_spool $MAIL
+
+# Update interval in seconds
+update_interval 5.0
+
+# This is the number of times Conky will update before quitting.
+# Set to zero to run forever.
+total_run_times 0
+
+# Create own window instead of using desktop (required in nautilus)
+own_window no
+
+# Use double buffering (reduces flicker, may not work for everyone)
+double_buffer no
+
+# Minimum size of text area
+minimum_size 280 5
+
+# Draw shades?
+draw_shades yes
+
+# Draw outlines?
+draw_outline no
+
+# Draw borders around text
+draw_borders yes
+
+# Stippled borders?
+stippled_borders 8
+
+# border margins
+border_margin 4
+
+# border width
+border_width 1
+
+# Default colors and also border colors
+default_color white
+default_shade_color black
+default_outline_color black
+
+# Text alignment, other possible values are commented
+#alignment top_left
+#alignment top_right
+alignment bottom_left
+#alignment bottom_right
+
+# Gap between borders of screen and text
+gap_x 12
+gap_y 12
+
+# Subtract file system buffers from used memory?
+no_buffers yes
+
+# set to yes if you want all text to be in uppercase
+uppercase no
+
+# number of cpu samples to average
+# set to 1 to disable averaging
+cpu_avg_samples 4
+
+# number of net samples to average
+# set to 1 to disable averaging
+net_avg_samples 4
+
+# Add spaces to keep things from moving about?  This only affects certain objects.
+use_spacer no
+
+# Set to no to sort top output by mem usage instead of cpu
+top_sort_cpu yes
+
+#   mldonkey_hostname     Hostname for mldonkey stuff, defaults to localhost
+#   mldonkey_port         Mldonkey port, 4001 default
+#   mldonkey_login        Mldonkey login, default none
+#   mldonkey_password     Mldonkey password, default none
+
+# METAR station code for weather, get codes from weather.noaa.gov or google
+metar_station  CYBW
+
+# METAR ftp server
+# metar_server weather.noaa.gov
+
+# METAR path on server
+# metar_path /data/observations/metar/stations
+
+# boinc (seti) dir
+# seti_dir /opt/seti
+
+# Possible variables to be used:
+#
+#      Variable         Arguments                  Description                
+
+#  addr              (interface)     IP address for an interface
+#  acpiacadapter                     ACPI ac adapter state.                   
+#  acpifan                           ACPI fan state                           
+#  acpitemp                          ACPI temperature.                        
+#  adt746xcpu                        CPU temperature from therm_adt746x       
+#  adt746xfan                        Fan speed from therm_adt746x             
+#  alignr            (num)           Right-justify text, with space of N
+#  alignc                            Align text to centre
+#  battery           (num)           Remaining capasity in ACPI or APM        
+#                                    battery. ACPI battery number can be      
+#                                    given as argument (default is BAT0).     
+#  buffers                           Amount of memory buffered                
+#  cached                            Amount of memory cached                  
+#  color             (color)         Change drawing color to color            
+#  cpu                               CPU usage in percents                    
+#  cpubar            (height)        Bar that shows CPU usage, height is      
+#                                    bar's height in pixels                   
+#  downspeed         net             Download speed in kilobytes              
+#  downspeedf        net             Download speed in kilobytes with one     
+#                                    decimal                                  
+#  exec              shell command   Executes a shell command and displays    
+#                                    the output in conky. warning: this      
+#                                    takes a lot more resources than other    
+#                                    variables. I'd recommend coding wanted   
+#                                    behaviour in C and posting a patch :-).  
+#  execbar           shell command   Same as exec, except if the first value
+#                                    return is a value between 0-100, it
+#                                    will use that number for a bar.
+#                                    The size for the bar is currently fixed,
+#                                    but that may change in the future.
+#  execi             interval, shell Same as exec but with specific interval. 
+#                    command         Interval can't be less than              
+#                                    update_interval in configuration.        
+#  fs_bar            (height), (fs)  Bar that shows how much space is used on 
+#                                    a file system. height is the height in   
+#                                    pixels. fs is any file on that file      
+#                                    system.                                  
+#  fs_free           (fs)            Free space on a file system available    
+#                                    for users.                               
+#  fs_free_perc      (fs)            Free percentage of space on a file       
+#                                    system available for users.              
+#  fs_size           (fs)            File system size                         
+#  fs_used           (fs)            File system used space                   
+#  hr                (height)        Horizontal line, height is the height in 
+#                                    pixels                                   
+#  i2c               (dev), type, n  I2C sensor from sysfs (Linux 2.6). dev   
+#                                    may be omitted if you have only one I2C  
+#                                    device. type is either in (or vol)       
+#                                    meaning voltage, fan meaning fan or
+#                                    temp/tempf (first in C, second in F)
+#                                    meaning temperature. n is number of the  
+#                                    sensor. See /sys/bus/i2c/devices/ on     
+#                                    your local computer.                     
+#  if_running        (process)       if PROCESS is running, display
+#                                    everything if_running and the matching $endif
+#  if_existing       (file)          if FILE exists, display everything between
+#                                    if_existing and the matching $endif
+#  if_mounted        (mountpoint)    if MOUNTPOINT is mounted, display everything between
+#                                    if_mounted and the matching $endif
+#  else                              Text to show if any of the above are not true
+#  kernel                            Kernel version                          
+#  linkstatus        (interface)     Get the link status for wireless connections
+#  loadavg           (1), (2), (3)   System load average, 1 is for past 1     
+#                                    minute, 2 for past 5 minutes and 3 for   
+#                                    past 15 minutes.                         
+#  machine                           Machine, i686 for example                
+#  mails                             Mail count in mail spool. You can use    
+#                                    program like fetchmail to get mails from 
+#                                    some server using your favourite         
+#                                    protocol. See also new_mails.            
+#  mem                               Amount of memory in use                  
+#  membar            (height)        Bar that shows amount of memory in use   
+#  memmax                            Total amount of memory                   
+#  memperc                           Percentage of memory in use
+#  
+#  metar_ob_time
+#  metar_temp
+#  metar_tempf                      Temp in F
+#  metar_windchill
+#  metar_dew_point                   There are a bunch of these
+#  metar_rh                          and they are self-explanatory
+#  metar_windspeed
+#  metar_winddir
+#  metar_swinddir
+#  metar_cloud
+#  metar_u2d_time
+
+#  ml_upload_counter                 total session upload in mb
+#  ml_download_counter               total session download in mb
+#  ml_nshared_files                  number of shared files
+#  ml_shared_counter                 total session shared in mb, buggy
+#                                    in some mldonkey versions
+#  ml_tcp_upload_rate                tcp upload rate in kb/s
+#  ml_tcp_download_rate              tcp download rate in kb/s
+#  ml_udp_upload_rate                udp upload rate in kb/s
+#  ml_udp_download_rate              udp download rate in kb/s
+#  ml_ndownloaded_files              number of completed files
+#  ml_ndownloading_files             number of downloading files
+#  
+#  mpd_artist                      Artist in current MPD song
+#                                    (must be enabled at compile)
+#  mpd_album                       Album in current MPD song
+#  mpd_bar           (height)        Bar of mpd's progress
+#  mpd_bitrate                       Bitrate of current song
+#  mpd_status                        Playing, stopped, et cetera.
+#  mpd_title                       Title of current MPD song
+#  mpd_vol                         MPD's volume
+#  new_mails                         Unread mail count in mail spool.         
+#  nodename                          Hostname                                 
+#  outlinecolor      (color)         Change outline color                     
+#  pre_exec          shell command   Executes a shell command one time before 
+#                                    conky displays anything and puts output 
+#                                    as text.                                 
+#  processes                         Total processes (sleeping and running)   
+#  running_processes                 Running processes (not sleeping),        
+#                                    requires Linux 2.6                       
+#  shadecolor        (color)         Change shading color                     
+#  stippled_hr       (space),        Stippled (dashed) horizontal line        
+#                    (height)        
+#  swapbar           (height)        Bar that shows amount of swap in use     
+#  swap                              Amount of swap in use                    
+#  swapmax                           Total amount of swap                     
+#  swapperc                          Percentage of swap in use                
+#  sysname                           System name, Linux for example           
+#  tail              logfile, lines (interval)
+#                                    Displays last N lines of supplied text
+#                                    text file.  If interval is not supplied,
+#                                    Conky assumes 2x Conky's interval.
+#                                    Max of 30 lines.
+#                                    Max of 30 lines can be displayed.
+#  time              (format)        Local time, see man strftime to get more 
+#                                    information about format                 
+#  totaldown         net             Total download, overflows at 4 GB on     
+#                                    Linux with 32-bit arch and there doesn't 
+#                                    seem to be a way to know how many times  
+#                                    it has already done that before conky   
+#                                    has started.                            
+#  top               type, num      This takes arguments in the form:
+#                                    top <name> <number>
+#                                    Basically, processes are ranked from 
+#                                    highest to lowest in terms of cpu
+#                                    usage, which is what <num> represents.
+#                                    The types are: "name", "pid", "cpu", and
+#                                    "mem".
+#                                    There can be a max of 10 processes listed.
+#  totalup           net             Total upload, this one too, may overflow 
+#  updates                           Number of updates (for debugging)        
+#  upspeed           net             Upload speed in kilobytes                
+#  upspeedf          net             Upload speed in kilobytes with one       
+#                                    decimal                                  
+#  uptime                            Uptime                                   
+#  uptime_short                      Uptime in a shorter format               
+#
+#  seti_prog                         Seti@home current progress
+#  seti_progbar      (height)        Seti@home current progress bar
+#  seti_credit                       Seti@hoome total user credit
+
+
+# variable is given either in format $variable or in ${variable}. Latter
+# allows characters right after the variable and must be used in network
+# stuff because of an argument
+
+# stuff after 'TEXT' will be formatted on screen
+
+TEXT
+$nodename - $sysname $kernel on $machine
+$stippled_hr
+${color grey}Uptime$color $uptime
+${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 6}
+${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 6}
+${color grey}CPU Usage:$color $cpu% ${cpubar 6}
+${color grey}Processes:$color $processes  ${color grey}Running:$color $running_processes
+${color grey}Mails: ${color}$mails${color grey} New: ${color}$new_mails${color grey}
+$color$stippled_hr
+${color grey}Networking:
+ Up:$color ${upspeed eth0} k/s${color grey} - Down:$color ${downspeed eth0} k/s
+${color grey}File systems:
+ / $color${fs_free /}/${fs_size /} ${fs_bar 6 /}
+${color grey}Temperatures:
+ CPU:$color ${i2c temp 1}°C${color grey} - MB:$color ${i2c temp 2}°C
+${color grey}MPD:
+$mpd_status ${alignc}$mpd_artist - $mpd_title from $mpd_album at $mpd_vol $mpd_bitrate
+$mpd_bar
+${color grey}Name             PID CPU% MEM%
+ ${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
+ ${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
+ ${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
+${tail /var/log/Xorg.0.log 3 30}
+${metar_temp}C $metar_cloud
diff --git a/depcomp b/depcomp
new file mode 100644 (file)
index 0000000..ffcd540
--- /dev/null
+++ b/depcomp
@@ -0,0 +1,529 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-02-09.22
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 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.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+  stat=$?
+
+  if test -f "$tmpdepfile"; then :
+  else
+    stripped=`echo "$stripped" | sed 's,^.*/,,'`
+    tmpdepfile="$stripped.u"
+  fi
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    outname="$stripped.o"
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mecanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      exit $stat
+   fi
+
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[   ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+       set fnord "$@"
+       shift
+       shift
+       ;;
+    *)
+       set fnord "$@" "$arg"
+       shift
+       shift
+       ;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::   \1 \\:p' >> "$depfile"
+  echo "       " >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/freebsd.c b/freebsd.c
new file mode 100644 (file)
index 0000000..72d3779
--- /dev/null
+++ b/freebsd.c
@@ -0,0 +1,445 @@
+#include "conky.h"
+#include <fcntl.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <kvm.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+#include <sys/dkstat.h>
+#include <unistd.h>
+#include <sys/user.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include <net/if_mib.h>
+#include <sys/socket.h>
+#include <ifaddrs.h>
+
+#define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var))
+#define KELVTOC(x)      ((x - 2732) / 10.0)
+
+#if defined(i386) || defined(__i386__)
+static unsigned int get_timer();
+static unsigned int get_cpu_speed(void);
+static inline unsigned long long int rdtsc( void );
+
+/* cpu frequency detection code based on mplayer's one */
+
+static unsigned int get_timer() {
+       struct timeval tv;
+       struct timezone tz;
+       gettimeofday(&tv,&tz);
+       
+       return (tv.tv_sec*1000000+tv.tv_usec);
+}
+
+static inline unsigned long long int rdtsc( void )
+{
+       unsigned long long int retval;
+       __asm __volatile ("rdtsc":"=A"(retval)::"memory");
+       return retval;
+}
+                                   
+static unsigned int get_cpu_speed(void)
+{
+       unsigned long long int tscstart, tscstop;
+       unsigned int start, stop;
+    
+       tscstart = rdtsc();
+       start = get_timer();
+       usleep(50000);
+       stop = get_timer();
+       tscstop = rdtsc();
+
+       return((tscstop-tscstart)/((stop-start)/1000.0));
+} 
+#endif
+
+
+static int getsysctl(char *name, void *ptr, size_t len)
+{
+       size_t nlen = len;
+       if (sysctlbyname(name, ptr, &nlen, NULL, 0) == -1) {
+               return -1;
+       }
+
+       if (nlen != len) {
+               return -1;
+       }
+
+       return 0;
+}
+
+static kvm_t *kd = NULL;
+struct ifmibdata *data = NULL;
+size_t len = 0;
+
+
+static int swapmode(int *retavail, int *retfree)
+{
+       int n;
+       int pagesize = getpagesize();
+       struct kvm_swap swapary[1];
+       static int kd_init = 1;
+
+       if (kd_init) {
+               kd_init = 0;
+               if ((kd = kvm_open("/dev/null", "/dev/null", "/dev/null",
+                                  O_RDONLY, "kvm_open")) == NULL) {
+                       (void) fprintf(stderr, "Cannot read kvm.");
+                       return -1;
+               }
+       }
+
+       if (kd == NULL) {
+               return -1;
+       }
+
+       *retavail = 0;
+       *retfree = 0;
+
+#define CONVERT(v)      ((quad_t)(v) * pagesize / 1024)
+
+       n = kvm_getswapinfo(kd, swapary, 1, 0);
+       if (n < 0 || swapary[0].ksw_total == 0)
+               return (0);
+
+       *retavail = CONVERT(swapary[0].ksw_total);
+       *retfree = CONVERT(swapary[0].ksw_total - swapary[0].ksw_used);
+
+       n = (int) ((double) swapary[0].ksw_used * 100.0 /
+                  (double) swapary[0].ksw_total);
+
+       return n;
+}
+
+
+void prepare_update()
+{
+}
+
+/*double get_uptime() */
+void update_uptime()
+{
+       int mib[2] = { CTL_KERN, KERN_BOOTTIME };
+       struct timeval boottime;
+       time_t now;
+       size_t size = sizeof(boottime);
+
+       if ((sysctl(mib, 2, &boottime, &size, NULL, 0) != -1)
+           && (boottime.tv_sec != 0)) {
+               time(&now);
+               info.uptime = now - boottime.tv_sec;
+       } else {
+               (void) fprintf(stderr, "Could not get uptime\n");
+               info.uptime = 0;
+       }
+}
+
+
+void update_meminfo()
+{
+       int total_pages, inactive_pages, free_pages;
+       int swap_avail, swap_free;
+
+       int pagesize = getpagesize();
+
+       if (GETSYSCTL("vm.stats.vm.v_page_count", total_pages))
+               (void) fprintf(stderr,
+                              "Cannot read sysctl \"vm.stats.vm.v_page_count\"");
+
+       if (GETSYSCTL("vm.stats.vm.v_free_count", free_pages))
+               (void) fprintf(stderr,
+                              "Cannot read sysctl \"vm.stats.vm.v_free_count\"");
+
+       if (GETSYSCTL("vm.stats.vm.v_inactive_count", inactive_pages))
+               (void) fprintf(stderr,
+                              "Cannot read sysctl \"vm.stats.vm.v_inactive_count\"");
+
+       info.memmax = (total_pages * pagesize) >> 10;
+       info.mem =
+           ((total_pages - free_pages - inactive_pages) * pagesize) >> 10;
+
+
+       if ((swapmode(&swap_avail, &swap_free)) >= 0) {
+               info.swapmax = swap_avail;
+               info.swap = (swap_avail - swap_free);
+       } else {
+               info.swapmax = 0;
+               info.swap = 0;
+       }
+}
+
+void update_net_stats()
+{
+       struct net_stat *ns;
+       double delta;
+       long long r, t, last_recv, last_trans;
+       struct ifaddrs *ifap, *ifa;
+       struct if_data *ifd;
+
+
+       /* get delta */
+       delta = current_update_time - last_update_time;
+       if (delta <= 0.0001)
+               return;
+
+       if (getifaddrs(&ifap) < 0)
+               return;
+
+       for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
+               ns = get_net_stat((const char *) ifa->ifa_name);
+
+               if (ifa->ifa_flags & IFF_UP) {
+                       last_recv = ns->recv;
+                       last_trans = ns->trans;
+
+                       if (ifa->ifa_addr->sa_family != AF_LINK)
+                               continue;
+
+                       ifd = (struct if_data *) ifa->ifa_data;
+                       r = ifd->ifi_ibytes;
+                       t = ifd->ifi_obytes;
+
+                       if (r < ns->last_read_recv)
+                               ns->recv +=
+                                   ((long long) 4294967295U -
+                                    ns->last_read_recv) + r;
+                       else
+                               ns->recv += (r - ns->last_read_recv);
+
+                       ns->last_read_recv = r;
+
+                       if (t < ns->last_read_trans)
+                               ns->trans +=
+                                   ((long long) 4294967295U -
+                                    ns->last_read_trans) + t;
+                       else
+                               ns->trans += (t - ns->last_read_trans);
+
+                       ns->last_read_trans = t;
+
+
+                       /* calculate speeds */
+                       ns->recv_speed = (ns->recv - last_recv) / delta;
+                       ns->trans_speed = (ns->trans - last_trans) / delta;
+               }
+       }
+
+       freeifaddrs(ifap);
+}
+
+void update_total_processes()
+{
+       /* It's easier to use kvm here than sysctl */
+
+       int n_processes;
+       static int kd_init = 1;
+
+       if (kd_init) {
+               kd_init = 0;
+               if ((kd = kvm_open("/dev/null", "/dev/null", "/dev/null",
+                                  O_RDONLY, "kvm_open")) == NULL) {
+                       (void) fprintf(stderr, "Cannot read kvm.");
+                       return;
+               }
+       }
+
+
+       if (kd != NULL)
+               kvm_getprocs(kd, KERN_PROC_ALL, 0, &n_processes);
+       else
+               return;
+
+       info.procs = n_processes;
+}
+
+void update_running_processes()
+{
+       static int kd_init = 1;
+       struct kinfo_proc *p;
+       int n_processes;
+       int i, cnt = 0;
+
+       if (kd_init) {
+               kd_init = 0;
+               if ((kd =
+                    kvm_open("/dev/null", "/dev/null", "/dev/null",
+                             O_RDONLY, "kvm_open")) == NULL) {
+                       (void) fprintf(stderr, "Cannot read kvm.");
+               }
+       }
+
+       if (kd != NULL) {
+               p = kvm_getprocs(kd, KERN_PROC_ALL, 0, &n_processes);
+               for (i = 0; i < n_processes; i++) {
+#if __FreeBSD__ < 5
+                       if (p[i].kp_proc.p_stat == SRUN)
+#else
+                       if (p[i].ki_stat == SRUN)
+#endif
+                               cnt++;
+               }
+       } else
+               return;
+
+       info.run_procs = cnt;
+}
+
+struct cpu_load_struct {
+       unsigned long load[5];
+};
+
+struct cpu_load_struct fresh = { {0, 0, 0, 0, 0} };
+long cpu_used, oldtotal, oldused;
+
+void update_cpu_usage()
+{
+       long used, total;
+       long cp_time[CPUSTATES];
+       size_t len = sizeof(cp_time);
+
+       if (sysctlbyname("kern.cp_time", &cp_time, &len, NULL, 0) < 0) {
+               (void) fprintf(stderr, "Cannot get kern.cp_time");
+       }
+
+       fresh.load[0] = cp_time[CP_USER];
+       fresh.load[1] = cp_time[CP_NICE];
+       fresh.load[2] = cp_time[CP_SYS];
+       fresh.load[3] = cp_time[CP_IDLE];
+       fresh.load[4] = cp_time[CP_IDLE];
+
+       used = fresh.load[0] + fresh.load[1] + fresh.load[2];
+       total =
+           fresh.load[0] + fresh.load[1] + fresh.load[2] + fresh.load[3];
+
+       if ((total - oldtotal) != 0) {
+               info.cpu_usage =
+                   ((double) (used - oldused)) / (double) (total -
+                                                           oldtotal);
+       } else {
+               info.cpu_usage = 0;
+       }
+
+       oldused = used;
+       oldtotal = total;
+}
+
+double get_i2c_info(int *fd, int div, char *devtype)
+{
+       return 0;
+}
+
+void update_load_average()
+{
+       double v[3];
+       getloadavg(v, 3);
+
+       info.loadavg[0] = (float) v[0];
+       info.loadavg[1] = (float) v[1];
+       info.loadavg[2] = (float) v[2];
+}
+
+double get_acpi_temperature(int fd)
+{
+       int temp;
+
+       if (GETSYSCTL("hw.acpi.thermal.tz0.temperature", temp)) {
+               (void) fprintf(stderr,
+                              "Cannot read sysctl \"hw.acpi.thermal.tz0.temperature\"\n");
+               return 0.0;
+       }
+
+       return KELVTOC(temp);
+}
+
+void get_battery_stuff(char *buf, unsigned int n, const char *bat)
+{
+       int battime;
+
+       if (GETSYSCTL("hw.acpi.battery.time", battime))
+               (void) fprintf(stderr,
+                              "Cannot read sysctl \"hw.acpi.battery.time\"\n");
+
+       if (battime != -1)
+               snprintf(buf, n, "Discharging, remaining %d:%2.2d",
+                        battime / 60, battime % 60);
+       else
+               snprintf(buf, n, "Battery is charging");
+}
+
+int
+open_i2c_sensor(const char *dev, const char *type, int n, int *div,
+               char *devtype)
+{
+       return 0;
+}
+
+int open_acpi_temperature(const char *name)
+{
+       return 0;
+}
+
+char *get_acpi_ac_adapter(void)
+{
+       int state;
+       char *acstate = (char *) malloc(100);
+
+       if (GETSYSCTL("hw.acpi.acline", state)) {
+               (void) fprintf(stderr,
+                              "Cannot read sysctl \"hw.acpi.acline\"\n");
+               return "n\\a";
+       }
+
+
+       if (state)
+               strcpy(acstate, "Running on AC Power");
+       else
+               strcpy(acstate, "Running on battery");
+
+       return acstate;
+}
+
+char *get_acpi_fan()
+{
+       return "";
+}
+
+char* get_adt746x_cpu() {
+       return "";
+}
+
+char* get_adt746x_fan() {
+       return "";
+}
+
+char* get_freq() {
+#if defined(i386) || defined(__i386__)
+       int i;
+       char *cpuspeed;
+
+       if ((cpuspeed = (char *)malloc(16)) == NULL)
+               exit(1);
+       
+       i = 0;
+       if ((i = get_cpu_speed()) > 0) {
+               if (i < 1000000) {
+                       i += 50; /* for rounding */
+                       snprintf(cpuspeed, 15, "%d.%d MHz", i/1000, (i/100)%10);
+               } else {
+                       snprintf(cpuspeed, 15, "%d MHz", i/1000);
+               }
+       } else {
+               cpuspeed = "";
+       }
+
+       return cpuspeed;
+#else
+       return "";
+#endif
+}
diff --git a/fs.c b/fs.c
new file mode 100644 (file)
index 0000000..c5f2fa8
--- /dev/null
+++ b/fs.c
@@ -0,0 +1,100 @@
+#include "conky.h"
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+/* linux */
+#ifdef HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+
+/* freebsd && netbsd */
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+
+/* TODO: benchmark which is faster, fstatvfs() or pre-opened fd and
+ * statvfs() (fstatvfs() would handle mounts I think...) */
+
+static struct fs_stat fs_stats_[64];
+struct fs_stat *fs_stats = fs_stats_;
+
+void update_fs_stats()
+{
+       unsigned int i;
+       struct statfs s;
+       for (i = 0; i < 16; i++) {
+               if (fs_stats[i].fd <= 0)
+                       break;
+
+               fstatfs(fs_stats[i].fd, &s);
+
+               fs_stats[i].size = (long long) s.f_blocks * s.f_bsize;
+               /* bfree (root) or bavail (non-roots) ? */
+               fs_stats[i].avail = (long long) s.f_bavail * s.f_bsize;
+       }
+}
+
+void clear_fs_stats()
+{
+       unsigned int i;
+       for (i = 0; i < 16; i++) {
+               if (fs_stats[i].fd) {
+                       close(fs_stats[i].fd);
+                       fs_stats[i].fd = -1;
+               }
+
+               if (fs_stats[i].path != NULL) {
+                       free(fs_stats[i].path);
+                       fs_stats[i].path = NULL;
+               }
+       }
+}
+
+struct fs_stat *prepare_fs_stat(const char *s)
+{
+       unsigned int i;
+
+       for (i = 0; i < 16; i++) {
+               struct fs_stat *fs = &fs_stats[i];
+
+               if (fs->path && strcmp(fs->path, s) == 0)
+                       return fs;
+
+               if (fs->fd <= 0) {
+                       /* when compiled with icc, it crashes when leaving function and open()
+                        * is used, I don't know why */
+
+                       /* this icc workaround didn't seem to work */
+#if 0
+                       {
+                               FILE *fp = fopen(s, "r");
+                               if (fp)
+                                       fs->fd = fileno(fp);
+                               else
+                                       fs->fd = -1;
+                       }
+#endif
+
+                       fs->fd = open(s, O_RDONLY);
+
+                       if (fs->fd <= 0) {      /* 0 isn't error but actually it is :) */
+                               ERR("open '%s': %s", s, strerror(errno));
+                               return 0;
+                       }
+
+                       fs->path = strdup(s);
+                       update_fs_stats();
+                       return fs;
+               }
+       }
+
+       ERR("too many fs stats");
+       return 0;
+}
diff --git a/ftp.c b/ftp.c
new file mode 100644 (file)
index 0000000..28d101c
--- /dev/null
+++ b/ftp.c
@@ -0,0 +1,889 @@
+/*
+ * ftp.c: basic handling of an FTP command connection to check for
+ *        directory availability. No transfer is needed.
+ *
+ *  Reference: RFC 959
+ */
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <resolv.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <netdb.h>
+#include <string.h>
+
+#include "ftp.h"
+
+/* #define DEBUG_FTP 1  */
+#ifdef STANDALONE
+#define DEBUG_FTP 1
+#endif
+
+static int ftpFd = -1;
+static struct sockaddr_in ftpAddr;
+static char hostname[100];
+static int ftpPassive = 1;
+static int dataFd = -1;
+
+#define FTP_COMMAND_OK          200
+#define FTP_SYNTAX_ERROR        500
+#define FTP_GET_PASSWD          331
+
+/*
+ * Initialize the FTP handling.
+ */
+
+void initFtp(void) {
+    gethostname(hostname, sizeof(hostname));
+}
+
+/*
+ * Parsing of the server answer, we just extract the code.
+ * return 0 for errors
+ *     +XXX for last line of response
+ *     -XXX for response to be continued
+ */
+int parseFtpResponse(char *buf, int len) {
+    int val = 0;
+
+    if (len < 3) return(-1);
+    if ((*buf >= '0') && (*buf <= '9')) 
+        val = val * 10 + (*buf - '0');
+    else
+        return(0);
+    buf++;
+    if ((*buf >= '0') && (*buf <= '9')) 
+        val = val * 10 + (*buf - '0');
+    else
+        return(0);
+    buf++;
+    if ((*buf >= '0') && (*buf <= '9')) 
+        val = val * 10 + (*buf - '0');
+    else
+        return(0);
+    buf++;
+    if (*buf == '-') 
+        return(-val);
+    return(val);
+}
+
+/*
+ * Read the response from the FTP server after a command.
+ * Returns the code number
+ *
+ */
+int readFtpResponse(char *buf, int size) {
+    char *ptr, *end;
+    int len;
+    int res = -1;
+
+    if (size <= 0) return(-1);
+
+get_more:
+    if ((len = recv(ftpFd, buf, size - 1, 0)) < 0) {
+        close(ftpFd); ftpFd = -1;
+        ftpFd = -1;
+        return(-1);
+    }
+    if (len == 0) {
+        return(-1);
+    }
+
+    end = &buf[len];
+    *end = 0;
+#ifdef DEBUG_FTP
+    printf(buf);
+#endif
+    ptr = buf;
+    while (ptr < end) {
+        res = parseFtpResponse(ptr, end - ptr);
+        if (res > 0) break;
+        if (res == 0) {
+#ifdef DEBUG_FTP
+            fprintf(stderr, "readFtpResponse failed: %s\n", ptr);
+#endif
+            return(-1);
+        }
+        while ((ptr < end) && (*ptr != '\n')) ptr++;
+        if (ptr >= end) {
+#ifdef DEBUG_FTP
+            fprintf(stderr, "readFtpResponse: unexpected end %s\n", buf);
+#endif
+            return((-res) / 100);
+        }
+        if (*ptr != '\r') ptr++;
+    }
+
+    if (res < 0) goto get_more;
+
+#ifdef DEBUG_FTP
+    printf("Got %d\n", res);
+#endif
+    return(res / 100);
+}
+
+/*
+ * Get the response from the FTP server after a command.
+ * Returns the code number
+ *
+ */
+int getFtpResponse(void) {
+    char buf[16 * 1024 + 1];
+
+/**************
+    fd_set rfd;
+    struct timeval tv;
+    int res;
+
+    tv.tv_sec = 10;
+    tv.tv_usec = 0;
+    FD_ZERO(&rfd);
+    FD_SET(ftpFd, &rfd);
+    res = select(ftpFd + 1, &rfd, NULL, NULL, &tv);
+    if (res <= 0) return(res);
+ **************/
+
+    return(readFtpResponse(buf, 16 * 1024));
+}
+
+/*
+ * Check if there is a response from the FTP server after a command.
+ * Returns the code number, or 0
+ */
+int checkFtpResponse(void) {
+    char buf[1024 + 1];
+    fd_set rfd;
+    struct timeval tv;
+
+    tv.tv_sec = 0;
+    tv.tv_usec = 0;
+    FD_ZERO(&rfd);
+    FD_SET(ftpFd, &rfd);
+    switch(select(ftpFd + 1, &rfd, NULL, NULL, &tv)) {
+        case 0:
+            return(0);
+        case -1:
+#ifdef DEBUG_FTP
+            perror("select");
+#endif
+            return(-1);
+                        
+    }
+
+    return(readFtpResponse(buf, 1024));
+}
+
+/*
+ * Send the user authentification
+ */
+
+int sendUser(void) {
+    char buf[200];
+    int len;
+    int res;
+
+    len = snprintf(buf, sizeof(buf), "USER anonymous\r\n");
+#ifdef DEBUG_FTP
+    printf(buf);
+#endif
+    res = send(ftpFd, buf, len, 0);
+    if (res < 0) return(res);
+    return(0);
+}
+
+/*
+ * Send the password authentification
+ */
+
+int sendPasswd(void) {
+    char buf[200];
+    int len;
+    int res;
+
+    len = snprintf(buf, sizeof(buf), "PASS mirrorfind@%s\r\n", hostname);
+#ifdef DEBUG_FTP
+    printf(buf);
+#endif
+    res = send(ftpFd, buf, len, 0);
+    if (res < 0) return(res);
+    return(0);
+}
+
+/*
+ * Send a QUIT
+ */
+
+int sendQuit(void) {
+    char buf[200];
+    int len;
+    int res;
+
+    len = snprintf(buf, sizeof(buf), "QUIT\r\n");
+#ifdef DEBUG_FTP
+    printf(buf);
+#endif
+    res = send(ftpFd, buf, len, 0);
+    return(0);
+}
+
+/*
+ * Connecting to the server, port 21 by default.
+ */
+
+int connectFtp(const char *server, int port) {
+    struct hostent *hp;
+    int res;
+
+    /*
+     * do the blocking DNS query.
+     */
+    hp = gethostbyname(server);
+    if (hp == NULL)
+        return(-1);
+
+    /*
+     * Prepare the socket
+     */
+    memset(&ftpAddr, 0, sizeof(ftpAddr));
+    ftpAddr.sin_family = AF_INET;
+    memcpy(&ftpAddr.sin_addr, hp->h_addr_list[0], hp->h_length);
+    if (port == 0)
+        port = 21;
+    ftpAddr.sin_port = htons(port);
+    ftpFd = socket(AF_INET, SOCK_STREAM, 0);
+    if (ftpFd < 0)
+        return(-1);
+
+    /*
+     * Do the connect.
+     */
+    if (connect(ftpFd, (struct sockaddr *) &ftpAddr,
+                sizeof(struct sockaddr_in)) < 0) {
+        close(ftpFd); ftpFd = -1;
+        ftpFd = -1;
+        return(-1);
+    }
+
+    /*
+     * Wait for the HELLO from the server.
+     */
+    res = getFtpResponse();
+    if (res != 2) {
+        close(ftpFd); ftpFd = -1;
+        ftpFd = -1;
+        return(-1);
+    }
+
+    /*
+     * State diagram for the login operation on the FTP server
+     *
+     * Reference: RFC 959
+     *
+     *                       1
+     * +---+   USER    +---+------------->+---+
+     * | B |---------->| W | 2       ---->| E |
+     * +---+           +---+------  |  -->+---+
+     *                  | |       | | |
+     *                3 | | 4,5   | | |
+     *    --------------   -----  | | |
+     *   |                      | | | |
+     *   |                      | | | |
+     *   |                 ---------  |
+     *   |               1|     | |   |
+     *   V                |     | |   |
+     * +---+   PASS    +---+ 2  |  ------>+---+
+     * |   |---------->| W |------------->| S |
+     * +---+           +---+   ---------->+---+
+     *                  | |   | |     |
+     *                3 | |4,5| |     |
+     *    --------------   --------   |
+     *   |                    | |  |  |
+     *   |                    | |  |  |
+     *   |                 -----------
+     *   |             1,3|   | |  |
+     *   V                |  2| |  |
+     * +---+   ACCT    +---+--  |   ----->+---+
+     * |   |---------->| W | 4,5 -------->| F |
+     * +---+           +---+------------->+---+
+     */
+    res = sendUser();
+    if (res < 0) {
+        close(ftpFd); ftpFd = -1;
+        ftpFd = -1;
+        return(-1);
+    }
+    res = getFtpResponse();
+    switch (res) {
+        case 2:
+            return(0);
+        case 3:
+            break;
+        case 1:
+        case 4:
+        case 5:
+        case -1:
+        default:
+            close(ftpFd); ftpFd = -1;
+            ftpFd = -1;
+            return(-1);
+    }
+    res = sendPasswd();
+    if (res < 0) {
+        close(ftpFd); ftpFd = -1;
+        ftpFd = -1;
+        return(-1);
+    }
+    res = getFtpResponse();
+    switch (res) {
+        case 2:
+            return(0);
+        case 3:
+            fprintf(stderr, "FTP server asking for ACCNT on anonymous\n");
+        case 1:
+        case 4:
+        case 5:
+        case -1:
+        default:
+            close(ftpFd); ftpFd = -1;
+            ftpFd = -1;
+            return(-1);
+    }
+
+    return(0);
+}
+
+/*
+ * Check an FTP directory on the server
+ */
+
+int changeFtpDirectory(char *directory) {
+    char buf[400];
+    int len;
+    int res;
+
+    /*
+     * Expected response code for CWD:
+     *
+     * CWD
+     *     250
+     *     500, 501, 502, 421, 530, 550
+     */
+    len = snprintf(buf, sizeof(buf), "CWD %s\r\n", directory);
+#ifdef DEBUG_FTP
+    printf(buf);
+#endif
+    res = send(ftpFd, buf, len, 0);
+    if (res < 0) return(res);
+    res = getFtpResponse();
+    if (res == 4) {
+        close(ftpFd); ftpFd = -1;
+        ftpFd = -1;
+        return(-1);
+    }
+    if (res == 2) return(1);
+    if (res == 5) {
+        return(0);
+    }
+    return(0);
+}
+
+/*
+ * dataConnectFtp
+ */
+int dataConnectFtp() {
+    char buf[200];
+    int len, i;
+    int res;
+    unsigned char ad[6], *cur, *adp, *portp;
+    unsigned int temp[6];
+    struct sockaddr_in dataAddr;
+    size_t dataAddrLen;
+
+    dataFd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
+    if (dataFd < 0) {
+        fprintf(stderr, "dataConnectFtp: failed to create socket\n");
+    }
+    dataAddrLen = sizeof(dataAddr);
+    memset(&dataAddr, 0, dataAddrLen);
+    dataAddr.sin_family = AF_INET;
+
+    if (ftpPassive) {
+        len = snprintf(buf, sizeof(buf), "PASV\r\n");
+#ifdef DEBUG_FTP
+        printf(buf);
+#endif
+        res = send(ftpFd, buf, len, 0);
+        if (res < 0) {
+            close(dataFd); dataFd = -1;
+            return(res);
+        }
+        res = readFtpResponse(buf, sizeof(buf) -1);
+        if (res != 2) {
+            if (res == 5) {
+                close(dataFd); dataFd = -1;
+                return(-1);
+            } else {
+                /*
+                 * retry with an active connection
+                 */
+                close(dataFd); dataFd = -1;
+                ftpPassive = 0;
+            }
+        }
+        cur = &buf[4];
+        while (((*cur < '0') || (*cur > '9')) && *cur != '\0') cur++;
+        if (sscanf(cur, "%d,%d,%d,%d,%d,%d", &temp[0], &temp[1], &temp[2],
+                    &temp[3], &temp[4], &temp[5]) != 6) {
+            fprintf(stderr, "Invalid answer to PASV\n");
+            close(dataFd); dataFd = -1;
+            return(-1);
+        }
+        for (i=0; i<6; i++) ad[i] = (unsigned char) (temp[i] & 0xff);
+        memcpy(&dataAddr.sin_addr, &ad[0], 4);
+        memcpy(&dataAddr.sin_port, &ad[4], 2);
+        if (connect(dataFd, (struct sockaddr *) &dataAddr, dataAddrLen) < 0) {
+            fprintf(stderr, "Failed to create a data connection\n");
+            close(dataFd); dataFd = -1;
+            return (-1);
+        }
+    } else {
+        getsockname(dataFd, (struct sockaddr *) &dataAddr, &dataAddrLen);
+        dataAddr.sin_port = 0;
+        if (bind(dataFd, (struct sockaddr *) &dataAddr, dataAddrLen) < 0) {
+            fprintf(stderr, "Failed to bind a port\n");
+            close(dataFd); dataFd = -1;
+            return (-1);
+        }
+        getsockname(dataFd, (struct sockaddr *) &dataAddr, &dataAddrLen);
+
+        if (listen(dataFd, 1) < 0) {
+            fprintf(stderr, "Could not listen on port %d\n",
+                    ntohs(dataAddr.sin_port));
+            close(dataFd); dataFd = -1;
+            return (-1);
+        }
+        adp = (unsigned char *) &dataAddr.sin_addr;
+        portp = (unsigned char *) &dataAddr.sin_port;
+        len = snprintf(buf, sizeof(buf), "PORT %d,%d,%d,%d,%d,%d\r\n",
+                       adp[0] & 0xff, adp[1] & 0xff, adp[2] & 0xff, adp[3] & 0xff,
+                       portp[0] & 0xff, portp[1] & 0xff);
+        buf[sizeof(buf) - 1] = 0;
+#ifdef DEBUG_FTP
+        printf(buf);
+#endif
+
+        res = send(ftpFd, buf, len, 0);
+        if (res < 0) {
+            close(dataFd); dataFd = -1;
+            return(res);
+        }
+        res = getFtpResponse();
+        if (res != 2) {
+            close(dataFd); dataFd = -1;
+            return(-1);
+        }
+    }
+    return(dataFd);
+    
+}
+
+/*
+ * dataConnectEndFtp
+ */
+int dataConnectEndFtp() {
+    int res;
+
+    close(dataFd); dataFd = -1;
+    res = getFtpResponse();
+    if (res != 2) {
+        close(dataFd); dataFd = -1;
+        close(ftpFd); ftpFd = -1;
+        return(-1);
+    }
+    return(0);
+}
+
+/*
+ * parseListFtp
+ */
+
+int parseListFtp(const char *list, ftpListCallback callback, void *userData) {
+    const char *cur = list;
+    char filename[151];
+    char attrib[11];
+    char owner[11];
+    char group[11];
+    char month[4];
+    int year = 0;
+    int minute = 0;
+    int hour = 0;
+    int day = 0;
+    unsigned long size = 0;
+    int links = 0;
+    int i;
+
+    if (!strncmp(cur, "total", 5)) {
+        cur += 5;
+        while (*cur == ' ') cur++;
+        while ((*cur >= '0') && (*cur <= '9'))
+            links = (links * 10) + (*cur++ - '0');
+        while ((*cur == ' ') || (*cur == '\n')  || (*cur == '\r'))
+            cur++;
+        return(cur - list);
+    } else if (*list == '+') {
+        return(0);
+    } else {
+        while ((*cur == ' ') || (*cur == '\n')  || (*cur == '\r'))
+            cur++;
+        if (*cur == 0) return(0);
+        i = 0;
+        while (*cur != ' ') {
+            if (i < 10) 
+                attrib[i++] = *cur;
+            cur++;
+            if (*cur == 0) return(0);
+        }
+        attrib[10] = 0;
+        while (*cur == ' ') cur++;
+        if (*cur == 0) return(0);
+        while ((*cur >= '0') && (*cur <= '9'))
+            links = (links * 10) + (*cur++ - '0');
+        while (*cur == ' ') cur++;
+        if (*cur == 0) return(0);
+        i = 0;
+        while (*cur != ' ') {
+            if (i < 10) 
+                owner[i++] = *cur;
+            cur++;
+            if (*cur == 0) return(0);
+        }
+        owner[i] = 0;
+        while (*cur == ' ') cur++;
+        if (*cur == 0) return(0);
+        i = 0;
+        while (*cur != ' ') {
+            if (i < 10) 
+                group[i++] = *cur;
+            cur++;
+            if (*cur == 0) return(0);
+        }
+        group[i] = 0;
+        while (*cur == ' ') cur++;
+        if (*cur == 0) return(0);
+        while ((*cur >= '0') && (*cur <= '9'))
+            size = (size * 10) + (*cur++ - '0');
+        while (*cur == ' ') cur++;
+        if (*cur == 0) return(0);
+        i = 0;
+        while (*cur != ' ') {
+            if (i < 3)
+                month[i++] = *cur;
+            cur++;
+            if (*cur == 0) return(0);
+        }
+        month[i] = 0;
+        while (*cur == ' ') cur++;
+        if (*cur == 0) return(0);
+        while ((*cur >= '0') && (*cur <= '9'))
+            day = (day * 10) + (*cur++ - '0');
+        while (*cur == ' ') cur++;
+        if (*cur == 0) return(0);
+        if ((cur[1] == 0) || (cur[2] == 0)) return(0);
+        if ((cur[1] == ':') || (cur[2] == ':')) {
+            while ((*cur >= '0') && (*cur <= '9'))
+                hour = (hour * 10) + (*cur++ - '0');
+            if (*cur == ':') cur++;
+            while ((*cur >= '0') && (*cur <= '9'))
+                minute = (minute * 10) + (*cur++ - '0');
+        } else {
+            while ((*cur >= '0') && (*cur <= '9'))
+                year = (year * 10) + (*cur++ - '0');
+        }
+        while (*cur == ' ') cur++;
+        if (*cur == 0) return(0);
+        i = 0;
+        while ((*cur != '\n')  && (*cur != '\r')) {
+            if (i < 150)
+                filename[i++] = *cur;
+            cur++;
+            if (*cur == 0) return(0);
+        }
+        filename[i] = 0;
+        if ((*cur != '\n') && (*cur != '\r'))
+            return(0);
+        while ((*cur == '\n')  || (*cur == '\r'))
+            cur++;
+    }
+    if (callback != NULL) {
+        callback(userData, filename, attrib, owner, group, size, links,
+                 year, month, day, minute);
+    }
+    return(cur - list);
+}
+
+/*
+ * listFtp
+ */
+int listFtp(ftpListCallback callback, void *userData) {
+    char buf[4096 + 1];
+    int len, res;
+    int index = 0, base;
+    fd_set rfd, efd;
+    struct timeval tv;
+
+    dataFd = dataConnectFtp();
+
+    len = snprintf(buf, sizeof(buf), "LIST -L\r\n");
+#ifdef DEBUG_FTP
+    printf(buf);
+#endif
+    res = send(ftpFd, buf, len, 0);
+    if (res < 0) {
+        close(dataFd); dataFd = -1;
+        return(res);
+    }
+    res = readFtpResponse(buf, sizeof(buf) -1);
+    if (res != 1) {
+        close(dataFd); dataFd = -1;
+        return(-res);
+    }
+
+    do {
+        tv.tv_sec = 1;
+        tv.tv_usec = 0;
+        FD_ZERO(&rfd);
+        FD_SET(dataFd, &rfd);
+        FD_ZERO(&efd);
+        FD_SET(dataFd, &efd);
+        res = select(dataFd + 1, &rfd, NULL, &efd, &tv);
+        if (res < 0) {
+#ifdef DEBUG_FTP
+            perror("select");
+#endif
+            close(dataFd); dataFd = -1;
+            return(-1);
+        }
+        if (res == 0) {
+            res = checkFtpResponse();
+            if (res < 0) {
+                close(dataFd); dataFd = -1;
+                dataFd = -1;
+                return(-1);
+            }
+            if (res == 2) {
+                close(dataFd); dataFd = -1;
+                return(0);
+            }
+
+            continue;
+        }
+
+        if ((len = read(dataFd, &buf[index], sizeof(buf) - (index + 1))) < 0) {
+#ifdef DEBUG_FTP
+            perror("read");
+#endif
+            close(dataFd); dataFd = -1;
+            dataFd = -1;
+            return(-1);
+        }
+#ifdef DEBUG_FTP
+        write(1, &buf[index], len);
+#endif
+        index += len;
+        buf[index] = 0;
+        base = 0;
+        do {
+            res = parseListFtp(&buf[base], callback, userData);
+            base += res;
+        } while (res > 0);
+
+        memmove(&buf[0], &buf[base], index - base);
+        index -= base;
+    } while (len != 0);
+    dataConnectEndFtp();
+    return(0);
+}
+
+/*
+ * getFtpSocket:
+ */
+
+int getFtpSocket(const char *filename) {
+    char buf[300];
+    int res, len;
+    if (filename == NULL)
+        return(-1);
+    dataFd = dataConnectFtp();
+
+    len = snprintf(buf, sizeof(buf), "TYPE I\r\n");
+#ifdef DEBUG_FTP
+    printf(buf);
+#endif
+    res = send(ftpFd, buf, len, 0);
+    if (res < 0) {
+        close(dataFd); dataFd = -1;
+        return(res);
+    }
+    res = readFtpResponse(buf, sizeof(buf) -1);
+    if (res != 2) {
+        close(dataFd); dataFd = -1;
+        return(-res);
+    }
+    len = snprintf(buf, sizeof(buf), "RETR %s\r\n", filename);
+#ifdef DEBUG_FTP
+    printf(buf);
+#endif
+    res = send(ftpFd, buf, len, 0);
+    if (res < 0) {
+        close(dataFd); dataFd = -1;
+        return(res);
+    }
+    res = readFtpResponse(buf, sizeof(buf) -1);
+    if (res != 1) {
+        close(dataFd); dataFd = -1;
+        return(-res);
+    }
+    return(dataFd);
+}
+
+/*
+ * closeFtpSocket
+ */
+
+int closeFtpSocket(int socket) {
+    return(dataConnectEndFtp());
+}
+
+/*
+ * listFtp
+ */
+int getFtp(ftpDataCallback callback, void *userData, const char *filename) {
+    char buf[4096];
+    int len = 0, res;
+    fd_set rfd;
+    struct timeval tv;
+
+    if (filename == NULL)
+        return(-1);
+    if (callback == NULL)
+        return(-1);
+    if (getFtpSocket(filename) < 0)
+        return(-1);
+
+    do {
+        tv.tv_sec = 1;
+        tv.tv_usec = 0;
+        FD_ZERO(&rfd);
+        FD_SET(dataFd, &rfd);
+        res = select(dataFd + 1, &rfd, NULL, NULL, &tv);
+        if (res < 0) {
+#ifdef DEBUG_FTP
+            perror("select");
+#endif
+            close(dataFd); dataFd = -1;
+            return(-1);
+        }
+        if (res == 0) {
+            res = checkFtpResponse();
+            if (res < 0) {
+                close(dataFd); dataFd = -1;
+                dataFd = -1;
+                return(-1);
+            }
+            if (res == 2) {
+                close(dataFd); dataFd = -1;
+                return(0);
+            }
+
+            continue;
+        }
+        if ((len = read(dataFd, &buf, sizeof(buf))) < 0) {
+            callback(userData, buf, len);
+            close(dataFd); dataFd = -1;
+            ftpFd = -1;
+            return(-1);
+        }
+        callback(userData, buf, len);
+    } while (len != 0);
+
+    return(closeFtpSocket(dataFd));
+}
+
+/*
+ * Disconnect from the FTP server.
+ */
+
+int disconnectFtp(void) {
+    if (ftpFd < 0) return(-1);
+    sendQuit();
+    close(ftpFd); ftpFd = -1;
+    ftpFd = -1;
+    return(0);
+}
+
+#ifdef STANDALONE
+void ftpList(void *userData, const char *filename, const char* attrib,
+             const char *owner, const char *group, unsigned long size, int links,
+             int year, const char *month, int day, int minute) {
+    printf("%s %s %s %ld %s\n", attrib, owner, group, size, filename);
+}
+void ftpData(void *userData, const char *data, int len) {
+    if (userData == NULL) return;
+    if (len <= 0) {
+        fclose(userData);
+        return;
+    }   
+    fwrite(data, len, 1, userData);
+}
+
+int main(int argc, char **argv) {
+    int res;
+    FILE *output;
+    const char *tstfile = "tstfile";
+
+    initFtp();
+    if (argc > 1) {
+        res = connectFtp(argv[1], 0);
+        if (argc > 2)
+            tstfile = argv[2];
+    } else
+        res = connectFtp("localhost", 0);
+    if (res < 0) {
+        fprintf(stderr, "Couldn't connect to localhost\n");
+        exit(1);
+    }
+    res = changeFtpDirectory("/linux");
+    if (res < 0) {
+        fprintf(stderr, "disconnected\n");
+        disconnectFtp();
+        exit(1);
+    }
+    if (res == 0) {
+        fprintf(stderr, "/linux : CWD failed\n");
+    } else {
+        fprintf(stderr, "/linux : CWD successful\n");
+    }
+    res = changeFtpDirectory("/toto");
+    if (res < 0) {
+        fprintf(stderr, "disconnected\n");
+        disconnectFtp();
+        exit(1);
+    }
+    if (res == 0) {
+        fprintf(stderr, "/toto : CWD failed\n");
+    } else {
+        fprintf(stderr, "/toto : CWD successful\n");
+    }
+    listFtp(ftpList, NULL);
+    output = fopen("/tmp/tstdata", "w");
+    if (output != NULL) {
+        if (getFtp(ftpData, (void *) output, tstfile) < 0)
+            fprintf(stderr, "Failed to get file %s\n", tstfile);
+        
+    }
+    disconnectFtp();
+    exit(0);
+}
+#endif /* STANDALONE */
diff --git a/ftp.h b/ftp.h
new file mode 100644 (file)
index 0000000..adfef1f
--- /dev/null
+++ b/ftp.h
@@ -0,0 +1,26 @@
+/*
+ * ftp.h: interface for basic handling of an FTP command connection
+ *        to check for directory availability. No transfer is needed.
+ *
+ *  Reference: RFC 959
+ */
+
+#ifndef __MIRRORS_FTP_H__
+#define __MIRRORS_FTP_H__
+typedef void (*ftpListCallback) (void *userData,
+                const char *filename, const char* attrib,
+                const char *owner, const char *group,
+                unsigned long size, int links, int year,
+                const char *month, int day, int minute);
+
+typedef void (*ftpDataCallback) (void *userData,
+                const char *data, int len);
+
+
+extern void initFtp(void);
+extern int connectFtp(const char *server, int port);
+extern int changeFtpDirectory(char *directory);
+extern int disconnectFtp(void);
+int getFtp(ftpDataCallback, void *, const char *);
+
+#endif /* __MIRRORS_FTP_H__ */
diff --git a/install-sh b/install-sh
new file mode 100644 (file)
index 0000000..e9de238
--- /dev/null
@@ -0,0 +1,251 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission.  M.I.T. makes no representations about the
+# suitability of this software for any purpose.  It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+       -c) instcmd="$cpprog"
+           shift
+           continue;;
+
+       -d) dir_arg=true
+           shift
+           continue;;
+
+       -m) chmodcmd="$chmodprog $2"
+           shift
+           shift
+           continue;;
+
+       -o) chowncmd="$chownprog $2"
+           shift
+           shift
+           continue;;
+
+       -g) chgrpcmd="$chgrpprog $2"
+           shift
+           shift
+           continue;;
+
+       -s) stripcmd="$stripprog"
+           shift
+           continue;;
+
+       -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+           shift
+           continue;;
+
+       -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+           shift
+           continue;;
+
+       *)  if [ x"$src" = x ]
+           then
+               src=$1
+           else
+               # this colon is to work around a 386BSD /bin/sh bug
+               :
+               dst=$1
+           fi
+           shift
+           continue;;
+    esac
+done
+
+if [ x"$src" = x ]
+then
+       echo "install:  no input file specified"
+       exit 1
+else
+       true
+fi
+
+if [ x"$dir_arg" != x ]; then
+       dst=$src
+       src=""
+       
+       if [ -d $dst ]; then
+               instcmd=:
+               chmodcmd=""
+       else
+               instcmd=mkdir
+       fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad 
+# if $src (and thus $dsttmp) contains '*'.
+
+       if [ -f $src -o -d $src ]
+       then
+               true
+       else
+               echo "install:  $src does not exist"
+               exit 1
+       fi
+       
+       if [ x"$dst" = x ]
+       then
+               echo "install:  no destination specified"
+               exit 1
+       else
+               true
+       fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+       if [ -d $dst ]
+       then
+               dst="$dst"/`basename $src`
+       else
+               true
+       fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+#  this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='   
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+       pathcomp="${pathcomp}${1}"
+       shift
+
+       if [ ! -d "${pathcomp}" ] ;
+        then
+               $mkdirprog "${pathcomp}"
+       else
+               true
+       fi
+
+       pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+       $doit $instcmd $dst &&
+
+       if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+       if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+       if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+       if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+       if [ x"$transformarg" = x ] 
+       then
+               dstfile=`basename $dst`
+       else
+               dstfile=`basename $dst $transformbasename | 
+                       sed $transformarg`$transformbasename
+       fi
+
+# don't allow the sed command to completely eliminate the filename
+
+       if [ x"$dstfile" = x ] 
+       then
+               dstfile=`basename $dst`
+       else
+               true
+       fi
+
+# Make a temp file name in the proper directory.
+
+       dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+       $doit $instcmd $src $dsttmp &&
+
+       trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing.  If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+       if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+       if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+       if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+       if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+       $doit $rmcmd -f $dstdir/$dstfile &&
+       $doit $mvcmd $dsttmp $dstdir/$dstfile 
+
+fi &&
+
+
+exit 0
diff --git a/libmpdclient.c b/libmpdclient.c
new file mode 100644 (file)
index 0000000..d1b5604
--- /dev/null
@@ -0,0 +1,1517 @@
+/* libmpdclient
+   (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
+   This project's homepage is: http://www.musicpd.org
+  
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+                                                                                
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+                                                                                
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+                                                                                
+   - Neither the name of the Music Player Daemon nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+                                                                                
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include "libmpdclient.h"
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <sys/param.h>
+#include <string.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <fcntl.h>
+
+#ifndef MPD_NO_IPV6
+#ifdef AF_INET6
+#define MPD_HAVE_IPV6
+#endif
+#endif
+
+#define COMMAND_LIST   1
+#define COMMAND_LIST_OK        2
+
+#ifdef MPD_HAVE_IPV6
+int mpd_ipv6Supported()
+{
+       int s;
+       s = socket(AF_INET6, SOCK_STREAM, 0);
+       if (s == -1)
+               return 0;
+       close(s);
+       return 1;
+}
+#endif
+
+
+char *mpd_sanitizeArg(const char *arg)
+{
+       size_t i;
+       int count = 0;
+       char *ret;
+
+       for (i = 0; i < strlen(arg); i++) {
+               if (arg[i] == '"' || arg[i] == '\\')
+                       count++;
+       }
+
+       ret = malloc(strlen(arg) + count + 1);
+
+       count = 0;
+       for (i = 0; i < strlen(arg) + 1; i++) {
+               if (arg[i] == '"' || arg[i] == '\\') {
+                       ret[i + count] = '\\';
+                       count++;
+               }
+               ret[i + count] = arg[i];
+       }
+
+       return ret;
+}
+
+mpd_ReturnElement *mpd_newReturnElement(const char *name,
+                                       const char *value)
+{
+       mpd_ReturnElement *ret = malloc(sizeof(mpd_ReturnElement));
+
+       ret->name = strdup(name);
+       ret->value = strdup(value);
+
+       return ret;
+}
+
+void mpd_freeReturnElement(mpd_ReturnElement * re)
+{
+       free(re->name);
+       free(re->value);
+       free(re);
+}
+
+void mpd_setConnectionTimeout(mpd_Connection * connection, float timeout)
+{
+       connection->timeout.tv_sec = (int) timeout;
+       connection->timeout.tv_usec = (int) (timeout * 1e6 -
+                                            connection->timeout.tv_sec *
+                                            1000000 + 0.5);
+}
+
+mpd_Connection *mpd_newConnection(const char *host, int port,
+                                 float timeout)
+{
+       int err;
+       struct hostent *he;
+       struct sockaddr *dest;
+#ifdef HAVE_SOCKLEN_T
+       socklen_t destlen;
+#else
+       int destlen;
+#endif
+       struct sockaddr_in sin;
+       char *rt;
+       char *output;
+       mpd_Connection *connection = malloc(sizeof(mpd_Connection));
+       struct timeval tv;
+       fd_set fds;
+#ifdef MPD_HAVE_IPV6
+       struct sockaddr_in6 sin6;
+#endif
+       strcpy(connection->buffer, "");
+       connection->buflen = 0;
+       connection->bufstart = 0;
+       strcpy(connection->errorStr, "");
+       connection->error = 0;
+       connection->doneProcessing = 0;
+       connection->commandList = 0;
+       connection->listOks = 0;
+       connection->doneListOk = 0;
+       connection->returnElement = NULL;
+
+       if (!(he = gethostbyname(host))) {
+               snprintf(connection->errorStr, MPD_BUFFER_MAX_LENGTH,
+                        "host \"%s\" not found", host);
+               connection->error = MPD_ERROR_UNKHOST;
+               return connection;
+       }
+
+       memset(&sin, 0, sizeof(struct sockaddr_in));
+       /*dest.sin_family = he->h_addrtype; */
+       sin.sin_family = AF_INET;
+       sin.sin_port = htons(port);
+#ifdef MPD_HAVE_IPV6
+       memset(&sin6, 0, sizeof(struct sockaddr_in6));
+       sin6.sin6_family = AF_INET6;
+       sin6.sin6_port = htons(port);
+#endif
+       switch (he->h_addrtype) {
+       case AF_INET:
+               memcpy((char *) &sin.sin_addr.s_addr, (char *) he->h_addr,
+                      he->h_length);
+               dest = (struct sockaddr *) &sin;
+               destlen = sizeof(struct sockaddr_in);
+               break;
+#ifdef MPD_HAVE_IPV6
+       case AF_INET6:
+               if (!mpd_ipv6Supported()) {
+                       strcpy(connection->errorStr,
+                              "no IPv6 suuport but a "
+                              "IPv6 address found\n");
+                       connection->error = MPD_ERROR_SYSTEM;
+                       return connection;
+               }
+               memcpy((char *) &sin6.sin6_addr.s6_addr,
+                      (char *) he->h_addr, he->h_length);
+               dest = (struct sockaddr *) &sin6;
+               destlen = sizeof(struct sockaddr_in6);
+               break;
+#endif
+       default:
+               strcpy(connection->errorStr,
+                      "address type is not IPv4 or " "IPv6\n");
+               connection->error = MPD_ERROR_SYSTEM;
+               return connection;
+               break;
+       }
+
+       if ((connection->sock =
+            socket(dest->sa_family, SOCK_STREAM, 0)) < 0) {
+               strcpy(connection->errorStr, "problems creating socket");
+               connection->error = MPD_ERROR_SYSTEM;
+               return connection;
+       }
+
+       mpd_setConnectionTimeout(connection, timeout);
+
+       /* connect stuff */
+       {
+               int flags = fcntl(connection->sock, F_GETFL, 0);
+               fcntl(connection->sock, F_SETFL, flags | O_NONBLOCK);
+
+               if (connect(connection->sock, dest, destlen) < 0
+                   && errno != EINPROGRESS) {
+                       snprintf(connection->errorStr,
+                                MPD_BUFFER_MAX_LENGTH,
+                                "problems connecting to \"%s\" on port"
+                                " %i", host, port);
+                       connection->error = MPD_ERROR_CONNPORT;
+                       return connection;
+               }
+       }
+
+       while (!(rt = strstr(connection->buffer, "\n"))) {
+               tv.tv_sec = connection->timeout.tv_sec;
+               tv.tv_usec = connection->timeout.tv_usec;
+               FD_ZERO(&fds);
+               FD_SET(connection->sock, &fds);
+               if ((err =
+                    select(connection->sock + 1, &fds, NULL, NULL,
+                           &tv)) == 1) {
+                       int readed;
+                       readed = recv(connection->sock,
+                                     &(connection->
+                                       buffer[connection->buflen]),
+                                     MPD_BUFFER_MAX_LENGTH -
+                                     connection->buflen, 0);
+                       if (readed <= 0) {
+                               snprintf(connection->errorStr,
+                                        MPD_BUFFER_MAX_LENGTH,
+                                        "problems getting a response from"
+                                        " \"%s\" on port %i", host, port);
+                               connection->error = MPD_ERROR_NORESPONSE;
+                               return connection;
+                       }
+                       connection->buflen += readed;
+                       connection->buffer[connection->buflen] = '\0';
+                       tv.tv_sec = connection->timeout.tv_sec;
+                       tv.tv_usec = connection->timeout.tv_usec;
+               } else if (err < 0) {
+                       switch (errno) {
+                       case EINTR:
+                               continue;
+                       default:
+                               snprintf(connection->errorStr,
+                                        MPD_BUFFER_MAX_LENGTH,
+                                        "problems connecting to \"%s\" on port"
+                                        " %i", host, port);
+                               connection->error = MPD_ERROR_CONNPORT;
+                               return connection;
+                       }
+               } else {
+                       snprintf(connection->errorStr,
+                                MPD_BUFFER_MAX_LENGTH,
+                                "timeout in attempting to get a response from"
+                                " \"%s\" on port %i", host, port);
+                       connection->error = MPD_ERROR_NORESPONSE;
+                       return connection;
+               }
+       }
+
+       *rt = '\0';
+       output = strdup(connection->buffer);
+       strcpy(connection->buffer, rt + 1);
+       connection->buflen = strlen(connection->buffer);
+
+       if (strncmp
+           (output, MPD_WELCOME_MESSAGE, strlen(MPD_WELCOME_MESSAGE))) {
+               free(output);
+               snprintf(connection->errorStr, MPD_BUFFER_MAX_LENGTH,
+                        "mpd not running on port %i on host \"%s\"", port,
+                        host);
+               connection->error = MPD_ERROR_NOTMPD;
+               return connection;
+       }
+
+       {
+               char *test;
+               char *version[3];
+               char *tmp = &output[strlen(MPD_WELCOME_MESSAGE)];
+               char *search = ".";
+               int i;
+
+               for (i = 0; i < 3; i++) {
+                       char *tok;
+                       if (i == 3)
+                               search = " ";
+                       version[i] = strtok_r(tmp, search, &tok);
+                       if (!version[i]) {
+                               free(output);
+                               snprintf(connection->errorStr,
+                                        MPD_BUFFER_MAX_LENGTH,
+                                        "error parsing version number at "
+                                        "\"%s\"",
+                                        &output[strlen
+                                                (MPD_WELCOME_MESSAGE)]);
+                               connection->error = MPD_ERROR_NOTMPD;
+                               return connection;
+                       }
+                       connection->version[i] =
+                           strtol(version[i], &test, 10);
+                       if (version[i] == test || *test != '\0') {
+                               free(output);
+                               snprintf(connection->errorStr,
+                                        MPD_BUFFER_MAX_LENGTH,
+                                        "error parsing version number at "
+                                        "\"%s\"",
+                                        &output[strlen
+                                                (MPD_WELCOME_MESSAGE)]);
+                               connection->error = MPD_ERROR_NOTMPD;
+                               return connection;
+                       }
+                       tmp = NULL;
+               }
+       }
+
+       free(output);
+
+       connection->doneProcessing = 1;
+
+       return connection;
+}
+
+void mpd_clearError(mpd_Connection * connection)
+{
+       connection->error = 0;
+       connection->errorStr[0] = '\0';
+}
+
+void mpd_closeConnection(mpd_Connection * connection)
+{
+       close(connection->sock);
+       if (connection->returnElement)
+               free(connection->returnElement);
+       free(connection);
+}
+
+void mpd_executeCommand(mpd_Connection * connection, char *command)
+{
+       int ret;
+       struct timeval tv;
+       fd_set fds;
+       char *commandPtr = command;
+       int commandLen = strlen(command);
+
+       if (!connection->doneProcessing && !connection->commandList) {
+               strcpy(connection->errorStr,
+                      "not done processing current command");
+               connection->error = 1;
+               return;
+       }
+
+       mpd_clearError(connection);
+
+       FD_ZERO(&fds);
+       FD_SET(connection->sock, &fds);
+       tv.tv_sec = connection->timeout.tv_sec;
+       tv.tv_usec = connection->timeout.tv_usec;
+
+       while ((ret =
+               select(connection->sock + 1, NULL, &fds, NULL, &tv) == 1)
+              || (ret == -1 && errno == EINTR)) {
+               ret =
+                   send(connection->sock, commandPtr, commandLen,
+                        MSG_DONTWAIT);
+               if (ret <= 0) {
+                       if (ret == EAGAIN || ret == EINTR)
+                               continue;
+                       snprintf(connection->errorStr,
+                                MPD_BUFFER_MAX_LENGTH,
+                                "problems giving command \"%s\"",
+                                command);
+                       connection->error = MPD_ERROR_SENDING;
+                       return;
+               } else {
+                       commandPtr += ret;
+                       commandLen -= ret;
+               }
+
+               if (commandLen <= 0)
+                       break;
+       }
+
+       if (commandLen > 0) {
+               perror("");
+               snprintf(connection->errorStr, MPD_BUFFER_MAX_LENGTH,
+                        "timeout sending command \"%s\"", command);
+               connection->error = MPD_ERROR_TIMEOUT;
+               return;
+       }
+
+       if (!connection->commandList)
+               connection->doneProcessing = 0;
+       else if (connection->commandList == COMMAND_LIST_OK) {
+               connection->listOks++;
+       }
+}
+
+void mpd_getNextReturnElement(mpd_Connection * connection)
+{
+       char *output = NULL;
+       char *rt = NULL;
+       char *name = NULL;
+       char *value = NULL;
+       fd_set fds;
+       struct timeval tv;
+       char *tok = NULL;
+       int readed;
+       char *bufferCheck = NULL;
+       int err;
+
+       if (connection->returnElement)
+               mpd_freeReturnElement(connection->returnElement);
+       connection->returnElement = NULL;
+
+       if (connection->doneProcessing || (connection->listOks &&
+                                          connection->doneListOk)) {
+               strcpy(connection->errorStr,
+                      "already done processing current command");
+               connection->error = 1;
+               return;
+       }
+
+       bufferCheck = connection->buffer + connection->bufstart;
+       while (connection->bufstart >= connection->buflen ||
+              !(rt = strstr(bufferCheck, "\n"))) {
+               if (connection->buflen >= MPD_BUFFER_MAX_LENGTH) {
+                       memmove(connection->buffer,
+                               connection->buffer +
+                               connection->bufstart,
+                               connection->buflen - connection->bufstart +
+                               1);
+                       bufferCheck -= connection->bufstart;
+                       connection->buflen -= connection->bufstart;
+                       connection->bufstart = 0;
+               }
+               if (connection->buflen >= MPD_BUFFER_MAX_LENGTH) {
+                       strcpy(connection->errorStr, "buffer overrun");
+                       connection->error = MPD_ERROR_BUFFEROVERRUN;
+                       connection->doneProcessing = 1;
+                       connection->doneListOk = 0;
+                       return;
+               }
+               bufferCheck += connection->buflen - connection->bufstart;
+               tv.tv_sec = connection->timeout.tv_sec;
+               tv.tv_usec = connection->timeout.tv_usec;
+               FD_ZERO(&fds);
+               FD_SET(connection->sock, &fds);
+               if ((err =
+                    select(connection->sock + 1, &fds, NULL, NULL,
+                           &tv) == 1)) {
+                       readed =
+                           recv(connection->sock,
+                                connection->buffer + connection->buflen,
+                                MPD_BUFFER_MAX_LENGTH -
+                                connection->buflen, MSG_DONTWAIT);
+                       if (readed < 0
+                           && (errno == EAGAIN || errno == EINTR)) {
+                               continue;
+                       }
+                       if (readed <= 0) {
+                               strcpy(connection->errorStr,
+                                      "connection" " closed");
+                               connection->error = MPD_ERROR_CONNCLOSED;
+                               connection->doneProcessing = 1;
+                               connection->doneListOk = 0;
+                               return;
+                       }
+                       connection->buflen += readed;
+                       connection->buffer[connection->buflen] = '\0';
+               } else if (err < 0 && errno == EINTR)
+                       continue;
+               else {
+                       strcpy(connection->errorStr, "connection timeout");
+                       connection->error = MPD_ERROR_TIMEOUT;
+                       connection->doneProcessing = 1;
+                       connection->doneListOk = 0;
+                       return;
+               }
+       }
+
+       *rt = '\0';
+       output = connection->buffer + connection->bufstart;
+       connection->bufstart = rt - connection->buffer + 1;
+
+       if (strcmp(output, "OK") == 0) {
+               if (connection->listOks > 0) {
+                       strcpy(connection->errorStr,
+                              "expected more list_OK's");
+                       connection->error = 1;
+               }
+               connection->listOks = 0;
+               connection->doneProcessing = 1;
+               connection->doneListOk = 0;
+               return;
+       }
+
+       if (strcmp(output, "list_OK") == 0) {
+               if (!connection->listOks) {
+                       strcpy(connection->errorStr,
+                              "got an unexpected list_OK");
+                       connection->error = 1;
+               } else {
+                       connection->doneListOk = 1;
+                       connection->listOks--;
+               }
+               return;
+       }
+
+       if (strncmp(output, "ACK", strlen("ACK")) == 0) {
+               char *test;
+               char *needle;
+               int val;
+
+               strcpy(connection->errorStr, output);
+               connection->error = MPD_ERROR_ACK;
+               connection->errorCode = MPD_ACK_ERROR_UNK;
+               connection->errorAt = MPD_ERROR_AT_UNK;
+               connection->doneProcessing = 1;
+               connection->doneListOk = 0;
+
+               needle = strchr(output, '[');
+               if (!needle)
+                       return;
+               val = strtol(needle + 1, &test, 10);
+               if (*test != '@')
+                       return;
+               connection->errorCode = val;
+               val = strtol(test + 1, &test, 10);
+               if (*test != ']')
+                       return;
+               connection->errorAt = val;
+               return;
+       }
+
+       name = strtok_r(output, ":", &tok);
+       if (name && (value = strtok_r(NULL, "", &tok)) && value[0] == ' ') {
+               connection->returnElement =
+                   mpd_newReturnElement(name, &(value[1]));
+       } else {
+               if (!name || !value) {
+                       snprintf(connection->errorStr,
+                                MPD_BUFFER_MAX_LENGTH,
+                                "error parsing: %s", output);
+               } else {
+                       snprintf(connection->errorStr,
+                                MPD_BUFFER_MAX_LENGTH,
+                                "error parsing: %s:%s", name, value);
+               }
+               connection->errorStr[MPD_BUFFER_MAX_LENGTH] = '\0';
+               connection->error = 1;
+       }
+}
+
+void mpd_finishCommand(mpd_Connection * connection)
+{
+       while (!connection->doneProcessing) {
+               if (connection->doneListOk)
+                       connection->doneListOk = 0;
+               mpd_getNextReturnElement(connection);
+       }
+}
+
+void mpd_finishListOkCommand(mpd_Connection * connection)
+{
+       while (!connection->doneProcessing && connection->listOks &&
+              !connection->doneListOk) {
+               mpd_getNextReturnElement(connection);
+       }
+}
+
+int mpd_nextListOkCommand(mpd_Connection * connection)
+{
+       mpd_finishListOkCommand(connection);
+       if (!connection->doneProcessing)
+               connection->doneListOk = 0;
+       if (connection->listOks == 0 || connection->doneProcessing)
+               return -1;
+       return 0;
+}
+
+void mpd_sendStatusCommand(mpd_Connection * connection)
+{
+       mpd_executeCommand(connection, "status\n");
+}
+
+mpd_Status *mpd_getStatus(mpd_Connection * connection)
+{
+       mpd_Status *status;
+
+       /*mpd_executeCommand(connection,"status\n");
+
+          if(connection->error) return NULL; */
+
+       if (connection->doneProcessing || (connection->listOks &&
+                                          connection->doneListOk)) {
+               return NULL;
+       }
+
+       if (!connection->returnElement)
+               mpd_getNextReturnElement(connection);
+
+       status = malloc(sizeof(mpd_Status));
+       status->volume = -1;
+       status->repeat = 0;
+       status->random = 0;
+       status->playlist = -1;
+       status->playlistLength = -1;
+       status->state = -1;
+       status->song = 0;
+       status->elapsedTime = 0;
+       status->totalTime = 0;
+       status->bitRate = 0;
+       status->sampleRate = 0;
+       status->bits = 0;
+       status->channels = 0;
+       status->crossfade = -1;
+       status->error = NULL;
+       status->updatingDb = 0;
+
+       if (connection->error) {
+               free(status);
+               return NULL;
+       }
+       while (connection->returnElement) {
+               mpd_ReturnElement *re = connection->returnElement;
+               if (strcmp(re->name, "volume") == 0) {
+                       status->volume = atoi(re->value);
+               } else if (strcmp(re->name, "repeat") == 0) {
+                       status->repeat = atoi(re->value);
+               } else if (strcmp(re->name, "random") == 0) {
+                       status->random = atoi(re->value);
+               } else if (strcmp(re->name, "playlist") == 0) {
+                       status->playlist = strtol(re->value, NULL, 10);
+               } else if (strcmp(re->name, "playlistlength") == 0) {
+                       status->playlistLength = atoi(re->value);
+               } else if (strcmp(re->name, "bitrate") == 0) {
+                       status->bitRate = atoi(re->value);
+               } else if (strcmp(re->name, "state") == 0) {
+                       if (strcmp(re->value, "play") == 0) {
+                               status->state = MPD_STATUS_STATE_PLAY;
+                       } else if (strcmp(re->value, "stop") == 0) {
+                               status->state = MPD_STATUS_STATE_STOP;
+                       } else if (strcmp(re->value, "pause") == 0) {
+                               status->state = MPD_STATUS_STATE_PAUSE;
+                       } else {
+                               status->state = MPD_STATUS_STATE_UNKNOWN;
+                       }
+               } else if (strcmp(re->name, "song") == 0) {
+                       status->song = atoi(re->value);
+               } else if (strcmp(re->name, "songid") == 0) {
+                       status->songid = atoi(re->value);
+               } else if (strcmp(re->name, "time") == 0) {
+                       char *tok;
+                       char *copy;
+                       char *temp;
+                       copy = strdup(re->value);
+                       temp = strtok_r(copy, ":", &tok);
+                       if (temp) {
+                               status->elapsedTime = atoi(temp);
+                               temp = strtok_r(NULL, "", &tok);
+                               if (temp)
+                                       status->totalTime = atoi(temp);
+                       }
+                       free(copy);
+               } else if (strcmp(re->name, "error") == 0) {
+                       status->error = strdup(re->value);
+               } else if (strcmp(re->name, "xfade") == 0) {
+                       status->crossfade = atoi(re->value);
+               } else if (strcmp(re->name, "updating_db") == 0) {
+                       status->updatingDb = atoi(re->value);
+               } else if (strcmp(re->name, "audio") == 0) {
+                       char *tok;
+                       char *copy;
+                       char *temp;
+                       copy = strdup(re->value);
+                       temp = strtok_r(copy, ":", &tok);
+                       if (temp) {
+                               status->sampleRate = atoi(temp);
+                               temp = strtok_r(NULL, ":", &tok);
+                               if (temp) {
+                                       status->bits = atoi(temp);
+                                       temp = strtok_r(NULL, "", &tok);
+                                       if (temp)
+                                               status->channels =
+                                                   atoi(temp);
+                               }
+                       }
+                       free(copy);
+               }
+
+               mpd_getNextReturnElement(connection);
+               if (connection->error) {
+                       free(status);
+                       return NULL;
+               }
+       }
+
+       if (connection->error) {
+               free(status);
+               return NULL;
+       } else if (status->state < 0) {
+               strcpy(connection->errorStr, "state not found");
+               connection->error = 1;
+               free(status);
+               return NULL;
+       }
+
+       return status;
+}
+
+void mpd_freeStatus(mpd_Status * status)
+{
+       if (status->error)
+               free(status->error);
+       free(status);
+}
+
+void mpd_sendStatsCommand(mpd_Connection * connection)
+{
+       mpd_executeCommand(connection, "stats\n");
+}
+
+mpd_Stats *mpd_getStats(mpd_Connection * connection)
+{
+       mpd_Stats *stats;
+
+       /*mpd_executeCommand(connection,"stats\n");
+
+          if(connection->error) return NULL; */
+
+       if (connection->doneProcessing || (connection->listOks &&
+                                          connection->doneListOk)) {
+               return NULL;
+       }
+
+       if (!connection->returnElement)
+               mpd_getNextReturnElement(connection);
+
+       stats = malloc(sizeof(mpd_Stats));
+       stats->numberOfArtists = 0;
+       stats->numberOfAlbums = 0;
+       stats->numberOfSongs = 0;
+       stats->uptime = 0;
+       stats->dbUpdateTime = 0;
+       stats->playTime = 0;
+       stats->dbPlayTime = 0;
+
+       if (connection->error) {
+               free(stats);
+               return NULL;
+       }
+       while (connection->returnElement) {
+               mpd_ReturnElement *re = connection->returnElement;
+               if (strcmp(re->name, "artists") == 0) {
+                       stats->numberOfArtists = atoi(re->value);
+               } else if (strcmp(re->name, "albums") == 0) {
+                       stats->numberOfAlbums = atoi(re->value);
+               } else if (strcmp(re->name, "songs") == 0) {
+                       stats->numberOfSongs = atoi(re->value);
+               } else if (strcmp(re->name, "uptime") == 0) {
+                       stats->uptime = strtol(re->value, NULL, 10);
+               } else if (strcmp(re->name, "db_update") == 0) {
+                       stats->dbUpdateTime = strtol(re->value, NULL, 10);
+               } else if (strcmp(re->name, "playtime") == 0) {
+                       stats->playTime = strtol(re->value, NULL, 10);
+               } else if (strcmp(re->name, "db_playtime") == 0) {
+                       stats->dbPlayTime = strtol(re->value, NULL, 10);
+               }
+
+               mpd_getNextReturnElement(connection);
+               if (connection->error) {
+                       free(stats);
+                       return NULL;
+               }
+       }
+
+       if (connection->error) {
+               free(stats);
+               return NULL;
+       }
+
+       return stats;
+}
+
+void mpd_freeStats(mpd_Stats * stats)
+{
+       free(stats);
+}
+
+void mpd_initSong(mpd_Song * song)
+{
+       song->file = NULL;
+       song->artist = NULL;
+       song->album = NULL;
+       song->track = NULL;
+       song->title = NULL;
+       song->name = NULL;
+       song->time = MPD_SONG_NO_TIME;
+       song->pos = MPD_SONG_NO_NUM;
+       song->id = MPD_SONG_NO_ID;
+}
+
+void mpd_finishSong(mpd_Song * song)
+{
+       if (song->file)
+               free(song->file);
+       if (song->artist)
+               free(song->artist);
+       if (song->album)
+               free(song->album);
+       if (song->title)
+               free(song->title);
+       if (song->track)
+               free(song->track);
+       if (song->name)
+               free(song->name);
+}
+
+mpd_Song *mpd_newSong()
+{
+       mpd_Song *ret = malloc(sizeof(mpd_Song));
+
+       mpd_initSong(ret);
+
+       return ret;
+}
+
+void mpd_freeSong(mpd_Song * song)
+{
+       mpd_finishSong(song);
+       free(song);
+}
+
+mpd_Song *mpd_songDup(mpd_Song * song)
+{
+       mpd_Song *ret = mpd_newSong();
+
+       if (song->file)
+               ret->file = strdup(song->file);
+       if (song->artist)
+               ret->artist = strdup(song->artist);
+       if (song->album)
+               ret->album = strdup(song->album);
+       if (song->title)
+               ret->title = strdup(song->title);
+       if (song->track)
+               ret->track = strdup(song->track);
+       if (song->name)
+               ret->name = strdup(song->name);
+       ret->time = song->time;
+       ret->pos = song->pos;
+       ret->id = song->id;
+
+       return ret;
+}
+
+void mpd_initDirectory(mpd_Directory * directory)
+{
+       directory->path = NULL;
+}
+
+void mpd_finishDirectory(mpd_Directory * directory)
+{
+       if (directory->path)
+               free(directory->path);
+}
+
+mpd_Directory *mpd_newDirectory()
+{
+       mpd_Directory *directory = malloc(sizeof(mpd_Directory));;
+
+       mpd_initDirectory(directory);
+
+       return directory;
+}
+
+void mpd_freeDirectory(mpd_Directory * directory)
+{
+       mpd_finishDirectory(directory);
+
+       free(directory);
+}
+
+mpd_Directory *mpd_directoryDup(mpd_Directory * directory)
+{
+       mpd_Directory *ret = mpd_newDirectory();
+
+       if (directory->path)
+               ret->path = strdup(directory->path);
+
+       return ret;
+}
+
+void mpd_initPlaylistFile(mpd_PlaylistFile * playlist)
+{
+       playlist->path = NULL;
+}
+
+void mpd_finishPlaylistFile(mpd_PlaylistFile * playlist)
+{
+       if (playlist->path)
+               free(playlist->path);
+}
+
+mpd_PlaylistFile *mpd_newPlaylistFile()
+{
+       mpd_PlaylistFile *playlist = malloc(sizeof(mpd_PlaylistFile));
+
+       mpd_initPlaylistFile(playlist);
+
+       return playlist;
+}
+
+void mpd_freePlaylistFile(mpd_PlaylistFile * playlist)
+{
+       mpd_finishPlaylistFile(playlist);
+       free(playlist);
+}
+
+mpd_PlaylistFile *mpd_playlistFileDup(mpd_PlaylistFile * playlist)
+{
+       mpd_PlaylistFile *ret = mpd_newPlaylistFile();
+
+       if (playlist->path)
+               ret->path = strdup(playlist->path);
+
+       return ret;
+}
+
+void mpd_initInfoEntity(mpd_InfoEntity * entity)
+{
+       entity->info.directory = NULL;
+}
+
+void mpd_finishInfoEntity(mpd_InfoEntity * entity)
+{
+       if (entity->info.directory) {
+               if (entity->type == MPD_INFO_ENTITY_TYPE_DIRECTORY) {
+                       mpd_freeDirectory(entity->info.directory);
+               } else if (entity->type == MPD_INFO_ENTITY_TYPE_SONG) {
+                       mpd_freeSong(entity->info.song);
+               } else if (entity->type ==
+                          MPD_INFO_ENTITY_TYPE_PLAYLISTFILE) {
+                       mpd_freePlaylistFile(entity->info.playlistFile);
+               }
+       }
+}
+
+mpd_InfoEntity *mpd_newInfoEntity()
+{
+       mpd_InfoEntity *entity = malloc(sizeof(mpd_InfoEntity));
+
+       mpd_initInfoEntity(entity);
+
+       return entity;
+}
+
+void mpd_freeInfoEntity(mpd_InfoEntity * entity)
+{
+       mpd_finishInfoEntity(entity);
+       free(entity);
+}
+
+void mpd_sendInfoCommand(mpd_Connection * connection, char *command)
+{
+       mpd_executeCommand(connection, command);
+}
+
+mpd_InfoEntity *mpd_getNextInfoEntity(mpd_Connection * connection)
+{
+       mpd_InfoEntity *entity = NULL;
+
+       if (connection->doneProcessing || (connection->listOks &&
+                                          connection->doneListOk)) {
+               return NULL;
+       }
+
+       if (!connection->returnElement)
+               mpd_getNextReturnElement(connection);
+
+       if (connection->returnElement) {
+               if (strcmp(connection->returnElement->name, "file") == 0) {
+                       entity = mpd_newInfoEntity();
+                       entity->type = MPD_INFO_ENTITY_TYPE_SONG;
+                       entity->info.song = mpd_newSong();
+                       entity->info.song->file =
+                           strdup(connection->returnElement->value);
+               } else
+                   if (strcmp
+                       (connection->returnElement->name,
+                        "directory") == 0) {
+                       entity = mpd_newInfoEntity();
+                       entity->type = MPD_INFO_ENTITY_TYPE_DIRECTORY;
+                       entity->info.directory = mpd_newDirectory();
+                       entity->info.directory->path =
+                           strdup(connection->returnElement->value);
+               } else
+                   if (strcmp(connection->returnElement->name, "playlist")
+                       == 0) {
+                       entity = mpd_newInfoEntity();
+                       entity->type = MPD_INFO_ENTITY_TYPE_PLAYLISTFILE;
+                       entity->info.playlistFile = mpd_newPlaylistFile();
+                       entity->info.playlistFile->path =
+                           strdup(connection->returnElement->value);
+               } else {
+                       connection->error = 1;
+                       strcpy(connection->errorStr,
+                              "problem parsing song info");
+                       return NULL;
+               }
+       } else
+               return NULL;
+
+       mpd_getNextReturnElement(connection);
+       while (connection->returnElement) {
+               mpd_ReturnElement *re = connection->returnElement;
+
+               if (strcmp(re->name, "file") == 0)
+                       return entity;
+               else if (strcmp(re->name, "directory") == 0)
+                       return entity;
+               else if (strcmp(re->name, "playlist") == 0)
+                       return entity;
+
+               if (entity->type == MPD_INFO_ENTITY_TYPE_SONG
+                   && strlen(re->value)) {
+                       if (!entity->info.song->artist
+                           && strcmp(re->name, "Artist") == 0) {
+                               entity->info.song->artist =
+                                   strdup(re->value);
+                       } else if (!entity->info.song->album
+                                  && strcmp(re->name, "Album") == 0) {
+                               entity->info.song->album =
+                                   strdup(re->value);
+                       } else if (!entity->info.song->title
+                                  && strcmp(re->name, "Title") == 0) {
+                               entity->info.song->title =
+                                   strdup(re->value);
+                       } else if (!entity->info.song->track
+                                  && strcmp(re->name, "Track") == 0) {
+                               entity->info.song->track =
+                                   strdup(re->value);
+                       } else if (!entity->info.song->name
+                                  && strcmp(re->name, "Name") == 0) {
+                               entity->info.song->name =
+                                   strdup(re->value);
+                       } else if (entity->info.song->time ==
+                                  MPD_SONG_NO_TIME
+                                  && strcmp(re->name, "Time") == 0) {
+                               entity->info.song->time = atoi(re->value);
+                       } else if (entity->info.song->pos ==
+                                  MPD_SONG_NO_NUM
+                                  && strcmp(re->name, "Pos") == 0) {
+                               entity->info.song->pos = atoi(re->value);
+                       } else if (entity->info.song->id == MPD_SONG_NO_ID
+                                  && strcmp(re->name, "Id") == 0) {
+                               entity->info.song->id = atoi(re->value);
+                       }
+               } else if (entity->type == MPD_INFO_ENTITY_TYPE_DIRECTORY) {
+               } else if (entity->type ==
+                          MPD_INFO_ENTITY_TYPE_PLAYLISTFILE) {
+               }
+
+               mpd_getNextReturnElement(connection);
+       }
+
+       return entity;
+}
+
+char *mpd_getNextReturnElementNamed(mpd_Connection * connection,
+                                   const char *name)
+{
+       if (connection->doneProcessing || (connection->listOks &&
+                                          connection->doneListOk)) {
+               return NULL;
+       }
+
+       mpd_getNextReturnElement(connection);
+       while (connection->returnElement) {
+               mpd_ReturnElement *re = connection->returnElement;
+
+               if (strcmp(re->name, name) == 0)
+                       return strdup(re->value);
+               mpd_getNextReturnElement(connection);
+       }
+
+       return NULL;
+}
+
+char *mpd_getNextArtist(mpd_Connection * connection)
+{
+       return mpd_getNextReturnElementNamed(connection, "Artist");
+}
+
+char *mpd_getNextAlbum(mpd_Connection * connection)
+{
+       return mpd_getNextReturnElementNamed(connection, "Album");
+}
+
+void mpd_sendPlaylistInfoCommand(mpd_Connection * connection, int songPos)
+{
+       char *string = malloc(strlen("playlistinfo") + 25);
+       sprintf(string, "playlistinfo \"%i\"\n", songPos);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendPlaylistIdCommand(mpd_Connection * connection, int id)
+{
+       char *string = malloc(strlen("playlistid") + 25);
+       sprintf(string, "playlistid \"%i\"\n", id);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+}
+
+void
+mpd_sendPlChangesCommand(mpd_Connection * connection, long long playlist)
+{
+       char *string = malloc(strlen("plchanges") + 25);
+       sprintf(string, "plchanges \"%lld\"\n", playlist);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendListallCommand(mpd_Connection * connection, const char *dir)
+{
+       char *sDir = mpd_sanitizeArg(dir);
+       char *string = malloc(strlen("listall") + strlen(sDir) + 5);
+       sprintf(string, "listall \"%s\"\n", sDir);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+       free(sDir);
+}
+
+void
+mpd_sendListallInfoCommand(mpd_Connection * connection, const char *dir)
+{
+       char *sDir = mpd_sanitizeArg(dir);
+       char *string = malloc(strlen("listallinfo") + strlen(sDir) + 5);
+       sprintf(string, "listallinfo \"%s\"\n", sDir);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+       free(sDir);
+}
+
+void mpd_sendLsInfoCommand(mpd_Connection * connection, const char *dir)
+{
+       char *sDir = mpd_sanitizeArg(dir);
+       char *string = malloc(strlen("lsinfo") + strlen(sDir) + 5);
+       sprintf(string, "lsinfo \"%s\"\n", sDir);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+       free(sDir);
+}
+
+void mpd_sendCurrentSongCommand(mpd_Connection * connection)
+{
+       mpd_executeCommand(connection, "currentsong\n");
+}
+
+void
+mpd_sendSearchCommand(mpd_Connection * connection, int table,
+                     const char *str)
+{
+       char st[10];
+       char *string;
+       char *sanitStr = mpd_sanitizeArg(str);
+       if (table == MPD_TABLE_ARTIST)
+               strcpy(st, "artist");
+       else if (table == MPD_TABLE_ALBUM)
+               strcpy(st, "album");
+       else if (table == MPD_TABLE_TITLE)
+               strcpy(st, "title");
+       else if (table == MPD_TABLE_FILENAME)
+               strcpy(st, "filename");
+       else {
+               connection->error = 1;
+               strcpy(connection->errorStr, "unknown table for search");
+               return;
+       }
+       string =
+           malloc(strlen("search") + strlen(sanitStr) + strlen(st) + 6);
+       sprintf(string, "search %s \"%s\"\n", st, sanitStr);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+       free(sanitStr);
+}
+
+void
+mpd_sendFindCommand(mpd_Connection * connection, int table,
+                   const char *str)
+{
+       char st[10];
+       char *string;
+       char *sanitStr = mpd_sanitizeArg(str);
+       if (table == MPD_TABLE_ARTIST)
+               strcpy(st, "artist");
+       else if (table == MPD_TABLE_ALBUM)
+               strcpy(st, "album");
+       else if (table == MPD_TABLE_TITLE)
+               strcpy(st, "title");
+       else {
+               connection->error = 1;
+               strcpy(connection->errorStr, "unknown table for find");
+               return;
+       }
+       string =
+           malloc(strlen("find") + strlen(sanitStr) + strlen(st) + 6);
+       sprintf(string, "find %s \"%s\"\n", st, sanitStr);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+       free(sanitStr);
+}
+
+void
+mpd_sendListCommand(mpd_Connection * connection, int table,
+                   const char *arg1)
+{
+       char st[10];
+       char *string;
+       if (table == MPD_TABLE_ARTIST)
+               strcpy(st, "artist");
+       else if (table == MPD_TABLE_ALBUM)
+               strcpy(st, "album");
+       else {
+               connection->error = 1;
+               strcpy(connection->errorStr, "unknown table for list");
+               return;
+       }
+       if (arg1) {
+               char *sanitArg1 = mpd_sanitizeArg(arg1);
+               string =
+                   malloc(strlen("list") + strlen(sanitArg1) +
+                          strlen(st) + 6);
+               sprintf(string, "list %s \"%s\"\n", st, sanitArg1);
+               free(sanitArg1);
+       } else {
+               string = malloc(strlen("list") + strlen(st) + 3);
+               sprintf(string, "list %s\n", st);
+       }
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendAddCommand(mpd_Connection * connection, const char *file)
+{
+       char *sFile = mpd_sanitizeArg(file);
+       char *string = malloc(strlen("add") + strlen(sFile) + 5);
+       sprintf(string, "add \"%s\"\n", sFile);
+       mpd_executeCommand(connection, string);
+       free(string);
+       free(sFile);
+}
+
+void mpd_sendDeleteCommand(mpd_Connection * connection, int songPos)
+{
+       char *string = malloc(strlen("delete") + 25);
+       sprintf(string, "delete \"%i\"\n", songPos);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendDeleteIdCommand(mpd_Connection * connection, int id)
+{
+       char *string = malloc(strlen("deleteid") + 25);
+       sprintf(string, "deleteid \"%i\"\n", id);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendSaveCommand(mpd_Connection * connection, const char *name)
+{
+       char *sName = mpd_sanitizeArg(name);
+       char *string = malloc(strlen("save") + strlen(sName) + 5);
+       sprintf(string, "save \"%s\"\n", sName);
+       mpd_executeCommand(connection, string);
+       free(string);
+       free(sName);
+}
+
+void mpd_sendLoadCommand(mpd_Connection * connection, const char *name)
+{
+       char *sName = mpd_sanitizeArg(name);
+       char *string = malloc(strlen("load") + strlen(sName) + 5);
+       sprintf(string, "load \"%s\"\n", sName);
+       mpd_executeCommand(connection, string);
+       free(string);
+       free(sName);
+}
+
+void mpd_sendRmCommand(mpd_Connection * connection, const char *name)
+{
+       char *sName = mpd_sanitizeArg(name);
+       char *string = malloc(strlen("rm") + strlen(sName) + 5);
+       sprintf(string, "rm \"%s\"\n", sName);
+       mpd_executeCommand(connection, string);
+       free(string);
+       free(sName);
+}
+
+void mpd_sendShuffleCommand(mpd_Connection * connection)
+{
+       mpd_executeCommand(connection, "shuffle\n");
+}
+
+void mpd_sendClearCommand(mpd_Connection * connection)
+{
+       mpd_executeCommand(connection, "clear\n");
+}
+
+void mpd_sendPlayCommand(mpd_Connection * connection, int songPos)
+{
+       char *string = malloc(strlen("play") + 25);
+       sprintf(string, "play \"%i\"\n", songPos);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendPlayIdCommand(mpd_Connection * connection, int id)
+{
+       char *string = malloc(strlen("playid") + 25);
+       sprintf(string, "playid \"%i\"\n", id);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendStopCommand(mpd_Connection * connection)
+{
+       mpd_executeCommand(connection, "stop\n");
+}
+
+void mpd_sendPauseCommand(mpd_Connection * connection, int pauseMode)
+{
+       char *string = malloc(strlen("pause") + 25);
+       sprintf(string, "pause \"%i\"\n", pauseMode);
+       mpd_executeCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendNextCommand(mpd_Connection * connection)
+{
+       mpd_executeCommand(connection, "next\n");
+}
+
+void mpd_sendMoveCommand(mpd_Connection * connection, int from, int to)
+{
+       char *string = malloc(strlen("move") + 25);
+       sprintf(string, "move \"%i\" \"%i\"\n", from, to);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendMoveIdCommand(mpd_Connection * connection, int id, int to)
+{
+       char *string = malloc(strlen("moveid") + 25);
+       sprintf(string, "moveid \"%i\" \"%i\"\n", id, to);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendSwapCommand(mpd_Connection * connection, int song1, int song2)
+{
+       char *string = malloc(strlen("swap") + 25);
+       sprintf(string, "swap \"%i\" \"%i\"\n", song1, song2);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendSwapIdCommand(mpd_Connection * connection, int id1, int id2)
+{
+       char *string = malloc(strlen("swapid") + 25);
+       sprintf(string, "swapid \"%i\" \"%i\"\n", id1, id2);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendSeekCommand(mpd_Connection * connection, int song, int time)
+{
+       char *string = malloc(strlen("seek") + 25);
+       sprintf(string, "seek \"%i\" \"%i\"\n", song, time);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendSeekIdCommand(mpd_Connection * connection, int id, int time)
+{
+       char *string = malloc(strlen("seekid") + 25);
+       sprintf(string, "seekid \"%i\" \"%i\"\n", id, time);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendUpdateCommand(mpd_Connection * connection, char *path)
+{
+       char *sPath = mpd_sanitizeArg(path);
+       char *string = malloc(strlen("update") + strlen(sPath) + 5);
+       sprintf(string, "update \"%s\"\n", sPath);
+       mpd_sendInfoCommand(connection, string);
+       free(string);
+       free(sPath);
+}
+
+int mpd_getUpdateId(mpd_Connection * connection)
+{
+       char *jobid;
+       int ret = 0;
+
+       jobid = mpd_getNextReturnElementNamed(connection, "updating_db");
+       if (jobid) {
+               ret = atoi(jobid);
+               free(jobid);
+       }
+
+       return ret;
+}
+
+void mpd_sendPrevCommand(mpd_Connection * connection)
+{
+       mpd_executeCommand(connection, "previous\n");
+}
+
+void mpd_sendRepeatCommand(mpd_Connection * connection, int repeatMode)
+{
+       char *string = malloc(strlen("repeat") + 25);
+       sprintf(string, "repeat \"%i\"\n", repeatMode);
+       mpd_executeCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendRandomCommand(mpd_Connection * connection, int randomMode)
+{
+       char *string = malloc(strlen("random") + 25);
+       sprintf(string, "random \"%i\"\n", randomMode);
+       mpd_executeCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendSetvolCommand(mpd_Connection * connection, int volumeChange)
+{
+       char *string = malloc(strlen("setvol") + 25);
+       sprintf(string, "setvol \"%i\"\n", volumeChange);
+       mpd_executeCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendVolumeCommand(mpd_Connection * connection, int volumeChange)
+{
+       char *string = malloc(strlen("volume") + 25);
+       sprintf(string, "volume \"%i\"\n", volumeChange);
+       mpd_executeCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendCrossfadeCommand(mpd_Connection * connection, int seconds)
+{
+       char *string = malloc(strlen("crossfade") + 25);
+       sprintf(string, "crossfade \"%i\"\n", seconds);
+       mpd_executeCommand(connection, string);
+       free(string);
+}
+
+void mpd_sendPasswordCommand(mpd_Connection * connection, const char *pass)
+{
+       char *sPass = mpd_sanitizeArg(pass);
+       char *string = malloc(strlen("password") + strlen(sPass) + 5);
+       sprintf(string, "password \"%s\"\n", sPass);
+       mpd_executeCommand(connection, string);
+       free(string);
+       free(sPass);
+}
+
+void mpd_sendCommandListBegin(mpd_Connection * connection)
+{
+       if (connection->commandList) {
+               strcpy(connection->errorStr,
+                      "already in command list mode");
+               connection->error = 1;
+               return;
+       }
+       connection->commandList = COMMAND_LIST;
+       mpd_executeCommand(connection, "command_list_begin\n");
+}
+
+void mpd_sendCommandListOkBegin(mpd_Connection * connection)
+{
+       if (connection->commandList) {
+               strcpy(connection->errorStr,
+                      "already in command list mode");
+               connection->error = 1;
+               return;
+       }
+       connection->commandList = COMMAND_LIST_OK;
+       mpd_executeCommand(connection, "command_list_ok_begin\n");
+       connection->listOks = 0;
+}
+
+void mpd_sendCommandListEnd(mpd_Connection * connection)
+{
+       if (!connection->commandList) {
+               strcpy(connection->errorStr, "not in command list mode");
+               connection->error = 1;
+               return;
+       }
+       connection->commandList = 0;
+       mpd_executeCommand(connection, "command_list_end\n");
+}
diff --git a/libmpdclient.h b/libmpdclient.h
new file mode 100644 (file)
index 0000000..0ccaf30
--- /dev/null
@@ -0,0 +1,507 @@
+/* libmpdclient
+   (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
+   This project's homepage is: http://www.musicpd.org
+  
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+                                                                                
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+                                                                                
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+                                                                                
+   - Neither the name of the Music Player Daemon nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+                                                                                
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef LIBMPDCLIENT_H
+#define LIBMPDCLIENT_H
+
+#include <sys/time.h>
+
+#define MPD_BUFFER_MAX_LENGTH  50000
+#define MPD_WELCOME_MESSAGE    "OK MPD "
+
+#define MPD_ERROR_TIMEOUT      10      /* timeout trying to talk to mpd */
+#define MPD_ERROR_SYSTEM       11      /* system error */
+#define MPD_ERROR_UNKHOST      12      /* unknown host */
+#define MPD_ERROR_CONNPORT     13      /* problems connecting to port on host */
+#define MPD_ERROR_NOTMPD       14      /* mpd not running on port at host */
+#define MPD_ERROR_NORESPONSE   15      /* no response on attempting to connect */
+#define MPD_ERROR_SENDING      16      /* error sending command */
+#define MPD_ERROR_CONNCLOSED   17      /* connection closed by mpd */
+#define MPD_ERROR_ACK          18      /* ACK returned! */
+#define MPD_ERROR_BUFFEROVERRUN        19      /* Buffer was overrun! */
+
+#define MPD_ACK_ERROR_UNK      -1
+#define MPD_ERROR_AT_UNK       -1
+
+#define MPD_ACK_ERROR_NOT_LIST                 1
+#define MPD_ACK_ERROR_ARG                      2
+#define MPD_ACK_ERROR_PASSWORD                 3
+#define MPD_ACK_ERROR_PERMISSION               4
+#define MPD_ACK_ERROR_UNKNOWN_CMD              5
+
+#define MPD_ACK_ERROR_NO_EXIST                 50
+#define MPD_ACK_ERROR_PLAYLIST_MAX             51
+#define MPD_ACK_ERROR_SYSTEM                   52
+#define MPD_ACK_ERROR_PLAYLIST_LOAD            53
+#define MPD_ACK_ERROR_UPDATE_ALREADY           54
+#define MPD_ACK_ERROR_PLAYER_SYNC              55
+#define MPD_ACK_ERROR_EXIST                    56
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* internal stuff don't touch this struct */
+       typedef struct _mpd_ReturnElement {
+               char *name;
+               char *value;
+       } mpd_ReturnElement;
+
+/* mpd_Connection
+ * holds info about connection to mpd
+ * use error, and errorStr to detect errors
+ */
+       typedef struct _mpd_Connection {
+               /* use this to check the version of mpd */
+               int version[3];
+               /* IMPORTANT, you want to get the error messages from here */
+               char errorStr[MPD_BUFFER_MAX_LENGTH + 1];
+               int errorCode;
+               int errorAt;
+               /* this will be set to MPD_ERROR_* if there is an error, 0 if not */
+               int error;
+               /* DON'T TOUCH any of the rest of this stuff */
+               int sock;
+               char buffer[MPD_BUFFER_MAX_LENGTH + 1];
+               int buflen;
+               int bufstart;
+               int doneProcessing;
+               int listOks;
+               int doneListOk;
+               int commandList;
+               mpd_ReturnElement *returnElement;
+               struct timeval timeout;
+       } mpd_Connection;
+
+/* mpd_newConnection
+ * use this to open a new connection
+ * you should use mpd_closeConnection, when your done with the connection,
+ * even if an error has occurred
+ * _timeout_ is the connection timeout period in seconds
+ */
+       mpd_Connection *mpd_newConnection(const char *host, int port,
+                                         float timeout);
+
+       void mpd_setConnectionTimeout(mpd_Connection * connection,
+                                     float timeout);
+
+/* mpd_closeConnection
+ * use this to close a connection and free'ing subsequent memory
+ */
+       void mpd_closeConnection(mpd_Connection * connection);
+
+/* mpd_clearError
+ * clears error
+ */
+       void mpd_clearError(mpd_Connection * connection);
+
+/* STATUS STUFF */
+
+/* use these with status.state to determine what state the player is in */
+#define MPD_STATUS_STATE_UNKNOWN       0
+#define MPD_STATUS_STATE_STOP          1
+#define MPD_STATUS_STATE_PLAY          2
+#define MPD_STATUS_STATE_PAUSE         3
+
+/* us this with status.volume to determine if mpd has volume support */
+#define MPD_STATUS_NO_VOLUME           -1
+
+/* mpd_Status
+ * holds info return from status command
+ */
+       typedef struct mpd_Status {
+               /* 0-100, or MPD_STATUS_NO_VOLUME when there is no volume support */
+               int volume;
+               /* 1 if repeat is on, 0 otherwise */
+               int repeat;
+               /* 1 if random is on, 0 otherwise */
+               int random;
+               /* playlist length */
+               int playlistLength;
+               /* playlist, use this to determine when the playlist has changed */
+               long long playlist;
+               /* use with MPD_STATUS_STATE_* to determine state of player */
+               int state;
+               /* crossfade setting in seconds */
+               int crossfade;
+               /* if a song is currently selected (always the case when state is
+                * PLAY or PAUSE), this is the position of the currently
+                * playing song in the playlist, beginning with 0
+                */
+               int song;
+               /* Song ID of the currently selected song */
+               int songid;
+               /* time in seconds that have elapsed in the currently playing/paused
+                * song
+                */
+               int elapsedTime;
+               /* length in seconds of the currently playing/paused song */
+               int totalTime;
+               /* current bit rate in kbs */
+               int bitRate;
+               /* audio sample rate */
+               unsigned int sampleRate;
+               /* audio bits */
+               int bits;
+               /* audio channels */
+               int channels;
+               /* 1 if mpd is updating, 0 otherwise */
+               int updatingDb;
+               /* error */
+               char *error;
+       } mpd_Status;
+
+       void mpd_sendStatusCommand(mpd_Connection * connection);
+
+/* mpd_getStatus
+ * returns status info, be sure to free it with mpd_freeStatus()
+ * call this after mpd_sendStatusCommand()
+ */
+       mpd_Status *mpd_getStatus(mpd_Connection * connection);
+
+/* mpd_freeStatus
+ * free's status info malloc'd and returned by mpd_getStatus
+ */
+       void mpd_freeStatus(mpd_Status * status);
+
+       typedef struct _mpd_Stats {
+               int numberOfArtists;
+               int numberOfAlbums;
+               int numberOfSongs;
+               unsigned long uptime;
+               unsigned long dbUpdateTime;
+               unsigned long playTime;
+               unsigned long dbPlayTime;
+       } mpd_Stats;
+
+       void mpd_sendStatsCommand(mpd_Connection * connection);
+
+       mpd_Stats *mpd_getStats(mpd_Connection * connection);
+
+       void mpd_freeStats(mpd_Stats * stats);
+
+/* SONG STUFF */
+
+#define MPD_SONG_NO_TIME       -1
+#define MPD_SONG_NO_NUM                -1
+#define MPD_SONG_NO_ID         -1
+
+/* mpd_Song
+ * for storing song info returned by mpd
+ */
+       typedef struct _mpd_Song {
+               /* filename of song */
+               char *file;
+               /* artist, maybe NULL if there is no tag */
+               char *artist;
+               /* title, maybe NULL if there is no tag */
+               char *title;
+               /* album, maybe NULL if there is no tag */
+               char *album;
+               /* track, maybe NULL if there is no tag */
+               char *track;
+               /* name, maybe NULL if there is no tag; it's the name of the current
+                * song, f.e. the icyName of the stream */
+               char *name;
+               /* length of song in seconds, check that it is not MPD_SONG_NO_TIME  */
+               int time;
+               /* if plchanges/playlistinfo/playlistid used, is the position of the 
+                * song in the playlist */
+               int pos;
+               /* song id for a song in the playlist */
+               int id;
+       } mpd_Song;
+
+/* mpd_newSong
+ * use to allocate memory for a new mpd_Song
+ * file, artist, etc all initialized to NULL
+ * if your going to assign values to file, artist, etc
+ * be sure to malloc or strdup the memory
+ * use mpd_freeSong to free the memory for the mpd_Song, it will also
+ * free memory for file, artist, etc, so don't do it yourself
+ */
+       mpd_Song *mpd_newSong();
+
+/* mpd_freeSong
+ * use to free memory allocated by mpd_newSong
+ * also it will free memory pointed to by file, artist, etc, so be careful
+ */
+       void mpd_freeSong(mpd_Song * song);
+
+/* mpd_songDup
+ * works like strDup, but for a mpd_Song
+ */
+       mpd_Song *mpd_songDup(mpd_Song * song);
+
+/* DIRECTORY STUFF */
+
+/* mpd_Directory
+ * used to store info fro directory (right now that just the path)
+ */
+       typedef struct _mpd_Directory {
+               char *path;
+       } mpd_Directory;
+
+/* mpd_newDirectory
+ * allocates memory for a new directory
+ * use mpd_freeDirectory to free this memory
+ */
+       mpd_Directory *mpd_newDirectory();
+
+/* mpd_freeDirectory
+ * used to free memory allocated with mpd_newDirectory, and it frees
+ * path of mpd_Directory, so be careful
+ */
+       void mpd_freeDirectory(mpd_Directory * directory);
+
+/* mpd_directoryDup
+ * works like strdup, but for mpd_Directory
+ */
+       mpd_Directory *mpd_directoryDup(mpd_Directory * directory);
+
+/* PLAYLISTFILE STUFF */
+
+/* mpd_PlaylistFile
+ * stores info about playlist file returned by lsinfo
+ */
+       typedef struct _mpd_PlaylistFile {
+               char *path;
+       } mpd_PlaylistFile;
+
+/* mpd_newPlaylistFile
+ * allocates memory for new mpd_PlaylistFile, path is set to NULL
+ * free this memory with mpd_freePlaylistFile
+ */
+       mpd_PlaylistFile *mpd_newPlaylistFile();
+
+/* mpd_freePlaylist
+ * free memory allocated for freePlaylistFile, will also free
+ * path, so be careful
+ */
+       void mpd_freePlaylistFile(mpd_PlaylistFile * playlist);
+
+/* mpd_playlistFileDup
+ * works like strdup, but for mpd_PlaylistFile
+ */
+       mpd_PlaylistFile *mpd_playlistFileDup(mpd_PlaylistFile * playlist);
+
+/* INFO ENTITY STUFF */
+
+/* the type of entity returned from one of the commands that generates info
+ * use in conjunction with mpd_InfoEntity.type
+ */
+#define MPD_INFO_ENTITY_TYPE_DIRECTORY         0
+#define MPD_INFO_ENTITY_TYPE_SONG              1
+#define MPD_INFO_ENTITY_TYPE_PLAYLISTFILE      2
+
+/* mpd_InfoEntity
+ * stores info on stuff returned info commands
+ */
+       typedef struct mpd_InfoEntity {
+               /* the type of entity, use with MPD_INFO_ENTITY_TYPE_* to determine
+                * what this entity is (song, directory, etc...)
+                */
+               int type;
+               /* the actual data you want, mpd_Song, mpd_Directory, etc */
+               union {
+                       mpd_Directory *directory;
+                       mpd_Song *song;
+                       mpd_PlaylistFile *playlistFile;
+               } info;
+       } mpd_InfoEntity;
+
+       mpd_InfoEntity *mpd_newInfoEntity();
+
+       void mpd_freeInfoEntity(mpd_InfoEntity * entity);
+
+/* INFO COMMANDS AND STUFF */
+
+/* use this function to loop over after calling Info/Listall functions */
+       mpd_InfoEntity *mpd_getNextInfoEntity(mpd_Connection * connection);
+
+/* fetches the currently seeletect song (the song referenced by status->song
+ * and status->songid*/
+       void mpd_sendCurrentSongCommand(mpd_Connection * connection);
+
+/* songNum of -1, means to display the whole list */
+       void mpd_sendPlaylistInfoCommand(mpd_Connection * connection,
+                                        int songNum);
+
+/* use this to get the changes in the playlist since version _playlist_ */
+       void mpd_sendPlChangesCommand(mpd_Connection * connection,
+                                     long long playlist);
+
+/* recursivel fetches all songs/dir/playlists in "dir* (no metadata is 
+ * returned) */
+       void mpd_sendListallCommand(mpd_Connection * connection,
+                                   const char *dir);
+
+/* same as sendListallCommand, but also metadata is returned */
+       void mpd_sendListallInfoCommand(mpd_Connection * connection,
+                                       const char *dir);
+
+/* non-recursive version of ListallInfo */
+       void mpd_sendLsInfoCommand(mpd_Connection * connection,
+                                  const char *dir);
+
+#define MPD_TABLE_ARTIST       0
+#define MPD_TABLE_ALBUM                1
+#define MPD_TABLE_TITLE                2
+#define MPD_TABLE_FILENAME     3
+
+       void mpd_sendSearchCommand(mpd_Connection * connection, int table,
+                                  const char *str);
+
+       void mpd_sendFindCommand(mpd_Connection * connection, int table,
+                                const char *str);
+
+/* LIST TAG COMMANDS */
+
+/* use this function fetch next artist entry, be sure to free the returned 
+ * string.  NULL means there are no more.  Best used with sendListArtists
+ */
+       char *mpd_getNextArtist(mpd_Connection * connection);
+
+       char *mpd_getNextAlbum(mpd_Connection * connection);
+
+/* list artist or albums by artist, arg1 should be set to the artist if
+ * listing albums by a artist, otherwise NULL for listing all artists or albums
+ */
+       void mpd_sendListCommand(mpd_Connection * connection, int table,
+                                const char *arg1);
+
+/* SIMPLE COMMANDS */
+
+       void mpd_sendAddCommand(mpd_Connection * connection,
+                               const char *file);
+
+       void mpd_sendDeleteCommand(mpd_Connection * connection,
+                                  int songNum);
+
+       void mpd_sendDeleteIdCommand(mpd_Connection * connection,
+                                    int songNum);
+
+       void mpd_sendSaveCommand(mpd_Connection * connection,
+                                const char *name);
+
+       void mpd_sendLoadCommand(mpd_Connection * connection,
+                                const char *name);
+
+       void mpd_sendRmCommand(mpd_Connection * connection,
+                              const char *name);
+
+       void mpd_sendShuffleCommand(mpd_Connection * connection);
+
+       void mpd_sendClearCommand(mpd_Connection * connection);
+
+/* use this to start playing at the beginning, useful when in random mode */
+#define MPD_PLAY_AT_BEGINNING  -1
+
+       void mpd_sendPlayCommand(mpd_Connection * connection, int songNum);
+
+       void mpd_sendPlayIdCommand(mpd_Connection * connection,
+                                  int songNum);
+
+       void mpd_sendStopCommand(mpd_Connection * connection);
+
+       void mpd_sendPauseCommand(mpd_Connection * connection,
+                                 int pauseMode);
+
+       void mpd_sendNextCommand(mpd_Connection * connection);
+
+       void mpd_sendPrevCommand(mpd_Connection * connection);
+
+       void mpd_sendMoveCommand(mpd_Connection * connection, int from,
+                                int to);
+
+       void mpd_sendMoveIdCommand(mpd_Connection * connection, int from,
+                                  int to);
+
+       void mpd_sendSwapCommand(mpd_Connection * connection, int song1,
+                                int song2);
+
+       void mpd_sendSwapIdCommand(mpd_Connection * connection, int song1,
+                                  int song2);
+
+       void mpd_sendSeekCommand(mpd_Connection * connection, int song,
+                                int time);
+
+       void mpd_sendSeekIdCommand(mpd_Connection * connection, int song,
+                                  int time);
+
+       void mpd_sendRepeatCommand(mpd_Connection * connection,
+                                  int repeatMode);
+
+       void mpd_sendRandomCommand(mpd_Connection * connection,
+                                  int randomMode);
+
+       void mpd_sendSetvolCommand(mpd_Connection * connection,
+                                  int volumeChange);
+
+/* WARNING: don't use volume command, its depreacted */
+       void mpd_sendVolumeCommand(mpd_Connection * connection,
+                                  int volumeChange);
+
+       void mpd_sendCrossfadeCommand(mpd_Connection * connection,
+                                     int seconds);
+
+       void mpd_sendUpdateCommand(mpd_Connection * connection,
+                                  char *path);
+
+/* returns the update job id, call this after a update command*/
+       int mpd_getUpdateId(mpd_Connection * connection);
+
+       void mpd_sendPasswordCommand(mpd_Connection * connection,
+                                    const char *pass);
+
+/* after executing a command, when your done with it to get its status
+ * (you want to check connection->error for an error)
+ */
+       void mpd_finishCommand(mpd_Connection * connection);
+
+/* command list stuff, use this to do things like add files very quickly */
+       void mpd_sendCommandListBegin(mpd_Connection * connection);
+
+       void mpd_sendCommandListOkBegin(mpd_Connection * connection);
+
+       void mpd_sendCommandListEnd(mpd_Connection * connection);
+
+/* advance to the next listOk 
+ * returns 0 if advanced to the next list_OK,
+ * returns -1 if it advanced to an OK or ACK */
+       int mpd_nextListOkCommand(mpd_Connection * connection);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/linux.c b/linux.c
new file mode 100644 (file)
index 0000000..a7cb3fe
--- /dev/null
+++ b/linux.c
@@ -0,0 +1,1002 @@
+#include "conky.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dirent.h>
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <sys/types.h>
+#include <sys/sysinfo.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+// #include <assert.h>
+#include <time.h>
+#include <proc/procps.h>
+#include <proc/readproc.h>
+#include "top.h"
+
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <linux/sockios.h>
+#include <net/if.h>
+#include <math.h>
+
+
+static struct sysinfo s_info;
+
+#define TEXT_BUFFER_SIZE (1024*4)
+
+static int show_nice_processes;
+
+void prepare_update()
+{
+}
+
+static void update_sysinfo()
+{
+       sysinfo(&s_info);
+
+       info.uptime = (double) s_info.uptime;
+
+       /* there was some problem with these */
+#if 0
+//     info.loadavg[0] = s_info.loads[0] / 100000.0f;
+       info.loadavg[1] = s_info.loads[1] / 100000.0f;
+       info.loadavg[2] = s_info.loads[2] / 100000.0f;
+       gkrelltop_process_find_top_three info.mask |= 1 << INFO_LOADAVG;
+#endif
+
+       info.procs = s_info.procs;
+
+       /* these aren't nice, no cache and should check kernel version for mem_unit */
+#if 0
+       info.memmax = s_info.totalram;
+       info.mem = s_info.totalram - s_info.freeram;
+       info.swapmax = s_info.totalswap;
+       info.swap = s_info.totalswap - s_info.swap;
+       info.mask |= 1 << INFO_MEM;
+#endif
+
+       info.mask |= (1 << INFO_UPTIME) | (1 << INFO_PROCS);
+}
+
+void update_uptime()
+{
+       /* prefers sysinfo() for uptime, I don't really know which one is better
+       * (=faster?) */
+#ifdef USE_PROC_UPTIME
+       static int rep;
+       FILE *fp = open_file("/proc/uptime", &rep);
+       if (!fp)
+               return 0;
+       fscanf(fp, "%lf", &info.uptime);
+       fclose(fp);
+
+       info.mask |= (1 << INFO_UPTIME);
+#else
+       update_sysinfo();
+#endif
+}
+
+/* these things are also in sysinfo except Buffers:, that's why I'm reading
+* them from proc */
+
+static FILE *meminfo_fp;
+
+void update_meminfo()
+{
+       static int rep;
+       /*  unsigned int a; */
+       char buf[256];
+
+       info.mem = info.memmax = info.swap = info.swapmax = info.bufmem =
+                       info.buffers = info.cached = 0;
+
+       if (meminfo_fp == NULL)
+               meminfo_fp = open_file("/proc/meminfo", &rep);
+       else
+               fseek(meminfo_fp, 0, SEEK_SET);
+       if (meminfo_fp == NULL)
+               return;
+
+       while (!feof(meminfo_fp)) {
+               if (fgets(buf, 255, meminfo_fp) == NULL)
+                       break;
+
+               if (strncmp(buf, "MemTotal:", 9) == 0) {
+                       sscanf(buf, "%*s %u", &info.memmax);
+               } else if (strncmp(buf, "MemFree:", 8) == 0) {
+                       sscanf(buf, "%*s %u", &info.mem);
+               } else if (strncmp(buf, "SwapTotal:", 10) == 0) {
+                       sscanf(buf, "%*s %u", &info.swapmax);
+               } else if (strncmp(buf, "SwapFree:", 9) == 0) {
+                       sscanf(buf, "%*s %u", &info.swap);
+               } else if (strncmp(buf, "Buffers:", 8) == 0) {
+                       sscanf(buf, "%*s %u", &info.buffers);
+               } else if (strncmp(buf, "Cached:", 7) == 0) {
+                       sscanf(buf, "%*s %u", &info.cached);
+               }
+       }
+
+       info.mem = info.memmax - info.mem;
+       info.swap = info.swapmax - info.swap;
+
+       info.bufmem = info.cached + info.buffers;
+
+       info.mask |= (1 << INFO_MEM) | (1 << INFO_BUFFERS);
+}
+
+static FILE *net_dev_fp;
+static FILE *net_wireless_fp;
+
+inline void update_net_stats()
+{
+       static int rep;
+       // FIXME: arbitrary size chosen to keep code simple.
+       int i, i2;
+       unsigned int curtmp1, curtmp2;
+       unsigned int k;
+       struct ifconf conf;
+
+
+       char buf[256];
+       double delta;
+
+       /* get delta */
+       delta = current_update_time - last_update_time;
+       if (delta <= 0.0001)
+               return;
+
+       /* open file and ignore first two lines */
+       if (net_dev_fp == NULL)
+               net_dev_fp = open_file("/proc/net/dev", &rep);
+       else
+               fseek(net_dev_fp, 0, SEEK_SET);
+       if (!net_dev_fp)
+               return;
+
+       fgets(buf, 255, net_dev_fp);    /* garbage */
+       fgets(buf, 255, net_dev_fp);    /* garbage (field names) */
+
+       /* read each interface */
+       for (i2 = 0; i2 < 16; i2++) {
+               struct net_stat *ns;
+               char *s, *p;
+               long long r, t, last_recv, last_trans;
+
+               if (fgets(buf, 255, net_dev_fp) == NULL)
+                       break;
+               p = buf;
+               while (isspace((int) *p))
+                       p++;
+
+               s = p;
+
+               while (*p && *p != ':')
+                       p++;
+               if (*p == '\0')
+                       continue;
+               *p = '\0';
+               p++;
+
+               ns = get_net_stat(s);
+               ns->up = 1;
+               last_recv = ns->recv;
+               last_trans = ns->trans;
+
+               sscanf(p,
+                      /* bytes packets errs drop fifo frame compressed multicast|bytes ... */
+                      "%Ld  %*d     %*d  %*d  %*d  %*d   %*d        %*d       %Ld",
+                      &r, &t);
+
+               /* if recv or trans is less than last time, an overflow happened */
+
+               if (r < ns->last_read_recv)
+                       ns->recv +=
+                                       ((long long) 4294967295U -
+                                       ns->last_read_recv) + r;
+               else
+                       ns->recv += (r - ns->last_read_recv);
+               ns->last_read_recv = r;
+
+               if (t < ns->last_read_trans)
+                       ns->trans +=
+                                       ((long long) 4294967295U -
+                                       ns->last_read_trans) + t;
+               else
+                       ns->trans += (t - ns->last_read_trans);
+               ns->last_read_trans = t;
+
+               /*** ip addr patch ***/
+
+               s = (char*)socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
+               
+               conf.ifc_buf = malloc(sizeof(struct ifreq) * 16);
+               
+               conf.ifc_len = sizeof(struct ifreq) * 16;
+
+               ioctl((long)s, SIOCGIFCONF, &conf);
+
+               for (k=0; k < conf.ifc_len / sizeof(struct ifreq); k++) {
+                       struct net_stat *ns;    
+                       ns = get_net_stat(((struct ifreq*)conf.ifc_buf)[k].ifr_ifrn.ifrn_name);
+                       ns->addr = ((struct ifreq*)conf.ifc_buf)[k].ifr_ifru.ifru_addr;
+               }
+
+               close((long)s);
+               
+               free(conf.ifc_buf);
+
+
+               /*** end ip addr patch ***/
+
+
+               /* calculate speeds */
+               ns->net_rec[0] = (ns->recv - last_recv) / delta;
+               ns->net_trans[0] = (ns->trans - last_trans) / delta;
+               curtmp1 = 0;
+               curtmp2 = 0;
+               // get an average
+               for (i = 0; (unsigned) i < info.net_avg_samples; i++) {
+                       curtmp1 += ns->net_rec[i];
+                       curtmp2 += ns->net_trans[i];
+               }
+               ns->recv_speed = curtmp1 / (double) info.net_avg_samples;
+               ns->trans_speed = curtmp2 / (double) info.net_avg_samples;
+               if (info.net_avg_samples > 1) {
+                       for (i = info.net_avg_samples; i > 1; i--) {
+                               ns->net_rec[i - 1] = ns->net_rec[i - 2];
+                               ns->net_trans[i - 1] =
+                                               ns->net_trans[i - 2];
+                       }
+               }
+
+
+
+       }
+
+       /* fclose(net_dev_fp); net_dev_fp = NULL; */
+}
+
+inline void update_wifi_stats() {
+       /** wireless stats patch by Bobby Beckmann **/
+       static int rep;
+       int i;
+       char buf[256];
+       /*open file and ignore first two lines       sorry, this code sucks ass right now, i'll clean it up later*/
+       if (net_wireless_fp == NULL)
+               net_wireless_fp = open_file("/proc/net/wireless", &rep);
+       else
+               fseek(net_wireless_fp, 0, SEEK_SET);
+       if (!net_wireless_fp) return;
+
+       fgets(buf, 255, net_wireless_fp); /* garbage */
+       fgets(buf, 255, net_wireless_fp); /* garbage (field names) */
+
+       /* read each interface */
+       for (i=0; i<16; i++) {
+               struct net_stat *ns;
+               char *s, *p;
+               int l, m, n;
+
+               if (fgets(buf, 255, net_wireless_fp) == NULL) break;
+               p = buf;
+               while (isspace((int) *p)) p++;
+
+               s = p;
+
+               while (*p && *p != ':') p++;
+               if (*p == '\0') continue;
+               *p = '\0';
+               p++;
+
+               ns = get_net_stat(s);
+
+               sscanf(p,
+                      "%*d   %d.  %d.  %d",
+                      &l,  &m,  &n);
+
+               ns->linkstatus = (int)(log(l) / log(92) * 100);
+       }
+
+       /*** end wireless patch ***/
+}
+
+int result;
+
+void update_total_processes()
+{
+       update_sysinfo();
+}
+
+static unsigned int cpu_user, cpu_system, cpu_nice;
+static double last_cpu_sum;
+static int clock_ticks;
+
+static FILE *stat_fp;
+
+inline static void update_stat()
+{
+       // FIXME: arbitrary size?
+       static double cpu_val[15];
+       static int rep;
+       char buf[256];
+       unsigned int i;
+       double curtmp;
+
+       if (stat_fp == NULL)
+               stat_fp = open_file("/proc/stat", &rep);
+       else
+               fseek(stat_fp, 0, SEEK_SET);
+       if (stat_fp == NULL)
+               return;
+
+       info.cpu_count = 0;
+
+       while (!feof(stat_fp)) {
+               if (fgets(buf, 255, stat_fp) == NULL)
+                       break;
+
+               if (strncmp(buf, "procs_running ", 14) == 0) {
+                       sscanf(buf, "%*s %d", &info.run_procs);
+                       info.mask |= (1 << INFO_RUN_PROCS);
+               } else if (strncmp(buf, "cpu ", 4) == 0) {
+                       sscanf(buf, "%*s %u %u %u", &cpu_user, &cpu_nice,
+                              &cpu_system);
+                       info.mask |= (1 << INFO_CPU);
+               } else if (strncmp(buf, "cpu", 3) == 0 && isdigit(buf[3])) {
+                       info.cpu_count++;
+               }
+       }
+
+       {
+               double delta;
+               delta = current_update_time - last_update_time;
+               if (delta <= 0.001)
+                       return;
+
+               if (clock_ticks == 0)
+                       clock_ticks = sysconf(_SC_CLK_TCK);
+               curtmp = 0;
+               cpu_val[0] =
+                               (cpu_user + cpu_nice + cpu_system -
+                               last_cpu_sum) / delta / (double) clock_ticks /
+                               info.cpu_count;
+               for (i = 0; i < info.cpu_avg_samples; i++)
+                       curtmp += cpu_val[i];
+               info.cpu_usage = curtmp / info.cpu_avg_samples;
+               last_cpu_sum = cpu_user + cpu_nice + cpu_system;
+               for (i = info.cpu_avg_samples; i > 1; i--)
+                       cpu_val[i - 1] = cpu_val[i - 2];
+
+       }
+
+// test code
+// this is for getting proc shit
+// pee pee
+// poo
+       //
+
+
+
+
+
+
+}
+
+void update_running_processes()
+{
+       update_stat();
+}
+
+void update_cpu_usage()
+{
+       update_stat();
+}
+
+void update_load_average()
+{
+#ifdef HAVE_GETLOADAVG
+       double v[3];
+       getloadavg(v, 3);
+       info.loadavg[0] = (float) v[0];
+       info.loadavg[1] = (float) v[1];
+       info.loadavg[2] = (float) v[2];
+#else
+       static int rep;
+       FILE *fp;
+
+       fp = open_file("/proc/loadavg", &rep);
+       if (!fp) {
+               v[0] = v[1] = v[2] = 0.0;
+               return;
+       }
+
+       fscanf(fp, "%f %f %f", &info.loadavg[0], &info.loadavg[1],
+              &info.loadavg[2]);
+
+       fclose(fp);
+#endif
+}
+
+
+static int no_dots(const struct dirent *d)
+{
+       if (d->d_name[0] == '.')
+               return 0;
+       return 1;
+}
+
+static int
+               get_first_file_in_a_directory(const char *dir, char *s, int *rep)
+{
+       struct dirent **namelist;
+       int i, n;
+
+       n = scandir(dir, &namelist, no_dots, alphasort);
+       if (n < 0) {
+               if (!rep || !*rep) {
+                       ERR("scandir for %s: %s", dir, strerror(errno));
+                       if (rep)
+                               *rep = 1;
+               }
+               return 0;
+       } else {
+               if (n == 0)
+                       return 0;
+
+               strncpy(s, namelist[0]->d_name, 255);
+               s[255] = '\0';
+
+               for (i = 0; i < n; i++)
+                       free(namelist[i]);
+               free(namelist);
+
+               return 1;
+       }
+}
+
+#define I2C_DIR "/sys/bus/i2c/devices/"
+
+int
+open_i2c_sensor(const char *dev, const char *type, int n, int *div,
+               char *devtype)
+{
+       char path[256];
+       char buf[64];
+       int fd;
+       int divfd;
+
+       /* if i2c device is NULL or *, get first */
+       if (dev == NULL || strcmp(dev, "*") == 0) {
+               static int rep;
+               if (!get_first_file_in_a_directory(I2C_DIR, buf, &rep))
+                       return -1;
+               dev = buf;
+       }
+
+       /* change vol to in */
+       if (strcmp(type, "vol") == 0)
+               type = "in";
+
+       if (strcmp(type, "tempf") == 0) {
+               snprintf(path, 255, I2C_DIR "%s/%s%d_input", dev, "temp", n);
+       }
+       else {
+               snprintf(path, 255, I2C_DIR "%s/%s%d_input", dev, type, n);
+       }
+       strcpy(devtype, path);
+
+       /* open file */
+       fd = open(path, O_RDONLY);
+       if (fd < 0)
+               ERR("can't open '%s': %s", path, strerror(errno));
+
+       if (strcmp(type, "in") == 0 || strcmp(type, "temp") == 0 || strcmp(type, "tempf") == 0)
+               *div = 1;
+       else
+               *div = 0;
+       /* fan does not use *_div as a read divisor */
+       if (strcmp("fan", type) == 0)
+               return fd;
+
+       /* test if *_div file exist, open it and use it as divisor */
+       if (strcmp(type, "tempf") == 0) {
+               snprintf(path, 255, I2C_DIR "%s/%s%d_div", "one", "two", n);
+       }
+       else {
+               snprintf(path, 255, I2C_DIR "%s/%s%d_div", dev, type, n);
+       }
+
+       divfd = open(path, O_RDONLY);
+       if (divfd > 0) {
+               /* read integer */
+               char divbuf[64];
+               unsigned int divn;
+               divn = read(divfd, divbuf, 63);
+               /* should read until n == 0 but I doubt that kernel will give these
+               * in multiple pieces. :) */
+               divbuf[divn] = '\0';
+               *div = atoi(divbuf);
+       }
+
+       close(divfd);
+
+       return fd;
+}
+
+double get_i2c_info(int *fd, int div, char *devtype, char *type)
+{
+       int val = 0;
+
+       if (*fd <= 0)
+               return 0;
+
+       lseek(*fd, 0, SEEK_SET);
+
+       /* read integer */
+       {
+               char buf[64];
+               unsigned int n;
+               n = read(*fd, buf, 63);
+               /* should read until n == 0 but I doubt that kernel will give these
+               * in multiple pieces. :) */
+               buf[n] = '\0';
+               val = atoi(buf);
+       }
+
+       close(*fd);
+       /* open file */
+       *fd = open(devtype, O_RDONLY);
+       if (*fd < 0)
+               ERR("can't open '%s': %s", devtype, strerror(errno));  
+       
+       /* My dirty hack for computing CPU value 
+       * Filedil, from forums.gentoo.org
+       */
+/*     if (strstr(devtype, "temp1_input") != NULL)
+       return -15.096+1.4893*(val / 1000.0); */
+       
+       
+       /* divide voltage and temperature by 1000 */
+       /* or if any other divisor is given, use that */
+       if (strcmp(type, "tempf") == 0) {
+               if (div > 1)
+                       return ((val / div + 40)*9.0/5)-40;
+               else if (div)
+                       return ((val / 1000.0 + 40)*9.0/5)-40;
+               else
+                       return ((val + 40)*9.0/5)-40;
+       }
+       else {
+               if (div > 1)
+                       return val / div;
+               else if (div)
+                       return val / 1000.0;
+               else
+                       return val;
+       }
+}
+
+#define ADT746X_FAN "/sys/devices/temperatures/cpu_fan_speed"
+
+static char *adt746x_fan_state;
+
+char *get_adt746x_fan()
+{
+       static int rep;
+       FILE *fp;
+
+       if (adt746x_fan_state == NULL) {
+               adt746x_fan_state = (char *) malloc(100);
+               assert(adt746x_fan_state != NULL);
+       }
+
+       fp = open_file(ADT746X_FAN, &rep);
+       if (!fp) {
+               strcpy(adt746x_fan_state,
+                      "No fan found! Hey, you don't have one?");
+               return adt746x_fan_state;
+       }
+       fscanf(fp, "%s", adt746x_fan_state);
+       fclose(fp);
+
+       return adt746x_fan_state;
+}
+
+#define ADT746X_CPU "/sys/devices/temperatures/cpu_temperature"
+
+static char *adt746x_cpu_state;
+
+char *get_adt746x_cpu()
+{
+       static int rep;
+       FILE *fp;
+
+       if (adt746x_cpu_state == NULL) {
+               adt746x_cpu_state = (char *) malloc(100);
+               assert(adt746x_cpu_state != NULL);
+       }
+
+       fp = open_file(ADT746X_CPU, &rep);
+       fscanf(fp, "%2s", adt746x_cpu_state);
+       fclose(fp);
+
+       return adt746x_cpu_state;
+}
+
+static char *frequency;
+
+char *get_freq()
+{
+       FILE *f;
+       char s[1000];
+       if (frequency == NULL) {
+               frequency = (char *) malloc(100);
+               assert(frequency != NULL);
+       }
+       //char frequency[10];
+       f = fopen("/proc/cpuinfo", "r");        //open the CPU information file
+       //if (!f)
+       //    return;
+       while (fgets(s, 1000, f) != NULL)       //read the file
+               if (strncmp(s, "cpu M", 5) == 0) {      //and search for the cpu mhz
+                       //printf("%s", strchr(s, ':')+2);
+               strcpy(frequency, strchr(s, ':') + 2);  //copy just the number
+               frequency[strlen(frequency) - 1] = '\0';        // strip \n
+               break;
+               }
+               fclose(f);
+               return frequency;
+}
+
+#define ACPI_FAN_DIR "/proc/acpi/fan/"
+
+static char *acpi_fan_state;
+
+char *get_acpi_fan()
+{
+       static int rep;
+       char buf[256];
+       char buf2[256];
+       FILE *fp;
+
+       if (acpi_fan_state == NULL) {
+               acpi_fan_state = (char *) malloc(100);
+               assert(acpi_fan_state != NULL);
+       }
+
+       /* yeah, slow... :/ */
+       if (!get_first_file_in_a_directory(ACPI_FAN_DIR, buf, &rep))
+               return "no fans?";
+
+       snprintf(buf2, 256, "%s%s/state", ACPI_FAN_DIR, buf);
+
+       fp = open_file(buf2, &rep);
+       if (!fp) {
+               strcpy(acpi_fan_state, "can't open fan's state file");
+               return acpi_fan_state;
+       }
+       fscanf(fp, "%*s %99s", acpi_fan_state);
+
+       return acpi_fan_state;
+}
+
+#define ACPI_AC_ADAPTER_DIR "/proc/acpi/ac_adapter/"
+
+static char *acpi_ac_adapter_state;
+
+char *get_acpi_ac_adapter()
+{
+       static int rep;
+       char buf[256];
+       char buf2[256];
+       FILE *fp;
+
+       if (acpi_ac_adapter_state == NULL) {
+               acpi_ac_adapter_state = (char *) malloc(100);
+               assert(acpi_ac_adapter_state != NULL);
+       }
+
+       /* yeah, slow... :/ */
+       if (!get_first_file_in_a_directory(ACPI_AC_ADAPTER_DIR, buf, &rep))
+               return "no ac_adapters?";
+
+       snprintf(buf2, 256, "%s%s/state", ACPI_AC_ADAPTER_DIR, buf);
+
+       fp = open_file(buf2, &rep);
+       if (!fp) {
+               strcpy(acpi_ac_adapter_state,
+                      "No ac adapter found.... where is it?");
+               return acpi_ac_adapter_state;
+       }
+       fscanf(fp, "%*s %99s", acpi_ac_adapter_state);
+       fclose(fp);
+
+       return acpi_ac_adapter_state;
+}
+
+/*
+/proc/acpi/thermal_zone/THRM/cooling_mode
+cooling mode:            active
+/proc/acpi/thermal_zone/THRM/polling_frequency
+<polling disabled>
+/proc/acpi/thermal_zone/THRM/state
+state:                   ok
+/proc/acpi/thermal_zone/THRM/temperature
+temperature:             45 C
+/proc/acpi/thermal_zone/THRM/trip_points
+critical (S5):           73 C
+passive:                 73 C: tc1=4 tc2=3 tsp=40 devices=0xcdf6e6c0
+*/
+
+#define ACPI_THERMAL_DIR "/proc/acpi/thermal_zone/"
+#define ACPI_THERMAL_FORMAT "/proc/acpi/thermal_zone/%s/temperature"
+
+int open_acpi_temperature(const char *name)
+{
+       char path[256];
+       char buf[64];
+       int fd;
+
+       if (name == NULL || strcmp(name, "*") == 0) {
+               static int rep;
+               if (!get_first_file_in_a_directory
+                                  (ACPI_THERMAL_DIR, buf, &rep))
+                       return -1;
+               name = buf;
+       }
+
+       snprintf(path, 255, ACPI_THERMAL_FORMAT, name);
+
+       fd = open(path, O_RDONLY);
+       if (fd < 0)
+               ERR("can't open '%s': %s", path, strerror(errno));
+
+       return fd;
+}
+
+static double last_acpi_temp;
+static double last_acpi_temp_time;
+
+double get_acpi_temperature(int fd)
+{
+       if (fd <= 0)
+               return 0;
+
+       /* don't update acpi temperature too often */
+       if (current_update_time - last_acpi_temp_time < 11.32) {
+               return last_acpi_temp;
+       }
+       last_acpi_temp_time = current_update_time;
+
+       /* seek to beginning */
+       lseek(fd, 0, SEEK_SET);
+
+       /* read */
+       {
+               char buf[256];
+               int n;
+               n = read(fd, buf, 255);
+               if (n < 0)
+                       ERR("can't read fd %d: %s", fd, strerror(errno));
+               else {
+                       buf[n] = '\0';
+                       sscanf(buf, "temperature: %lf", &last_acpi_temp);
+               }
+       }
+
+       return last_acpi_temp;
+}
+
+/*
+hipo@lepakko hipo $ cat /proc/acpi/battery/BAT1/info 
+present:                 yes
+design capacity:         4400 mAh
+last full capacity:      4064 mAh
+battery technology:      rechargeable
+design voltage:          14800 mV
+design capacity warning: 300 mAh
+design capacity low:     200 mAh
+capacity granularity 1:  32 mAh
+capacity granularity 2:  32 mAh
+model number:            02KT
+serial number:           16922
+battery type:            LION
+OEM info:                SANYO
+*/
+
+/*
+hipo@lepakko conky $ cat /proc/acpi/battery/BAT1/state
+present:                 yes
+capacity state:          ok
+charging state:          unknown
+present rate:            0 mA
+remaining capacity:      4064 mAh
+present voltage:         16608 mV
+*/
+
+/*
+2213<@jupet kellari ö> jupet@lagi-unstable:~$ cat /proc/apm 
+2213<@jupet kellari ö> 1.16 1.2 0x03 0x01 0xff 0x10 -1% -1 ?
+2213<@jupet kellari ö> (-1 ollee ei akkua kiinni, koska akku on pöydällä)
+2214<@jupet kellari ö> jupet@lagi-unstable:~$ cat /proc/apm 
+2214<@jupet kellari ö> 1.16 1.2 0x03 0x01 0x03 0x09 98% -1 ?
+
+2238<@jupet kellari ö> 1.16 1.2 0x03 0x00 0x00 0x01 100% -1 ? ilman verkkovirtaa
+2239<@jupet kellari ö> 1.16 1.2 0x03 0x01 0x00 0x01 99% -1 ? verkkovirralla
+
+2240<@jupet kellari ö> 1.16 1.2 0x03 0x01 0x03 0x09 100% -1 ? verkkovirralla ja monitori päällä
+2241<@jupet kellari ö> 1.16 1.2 0x03 0x00 0x00 0x01 99% -1 ? monitori päällä mutta ilman verkkovirtaa
+*/
+
+#define ACPI_BATTERY_BASE_PATH "/proc/acpi/battery"
+#define APM_PATH "/proc/apm"
+
+static FILE *acpi_bat_fp;
+static FILE *apm_bat_fp;
+
+static int acpi_last_full;
+
+static char last_battery_str[64];
+
+static double last_battery_time;
+
+void get_battery_stuff(char *buf, unsigned int n, const char *bat)
+{
+       static int rep, rep2;
+       char acpi_path[128];
+       snprintf(acpi_path, 127, ACPI_BATTERY_BASE_PATH "/%s/state", bat);
+
+       /* don't update battery too often */
+       if (current_update_time - last_battery_time < 29.5) {
+               snprintf(buf, n, "%s", last_battery_str);
+               return;
+       }
+       last_battery_time = current_update_time;
+
+       /* first try ACPI */
+
+       if (acpi_bat_fp == NULL && apm_bat_fp == NULL)
+               acpi_bat_fp = open_file(acpi_path, &rep);
+
+       if (acpi_bat_fp != NULL) {
+               int present_rate = -1;
+               int remaining_capacity = -1;
+               char charging_state[64];
+
+               /* read last full capacity if it's zero */
+               if (acpi_last_full == 0) {
+                       static int rep;
+                       char path[128];
+                       FILE *fp;
+                       snprintf(path, 127,
+                                ACPI_BATTERY_BASE_PATH "/%s/info", bat);
+                       fp = open_file(path, &rep);
+                       if (fp != NULL) {
+                               while (!feof(fp)) {
+                                       char b[256];
+                                       if (fgets(b, 256, fp) == NULL)
+                                               break;
+
+                                       if (sscanf
+                                                                              (b, "last full capacity: %d",
+                                                       &acpi_last_full) != 0)
+                                               break;
+                               }
+
+                               fclose(fp);
+                       }
+               }
+
+               fseek(acpi_bat_fp, 0, SEEK_SET);
+
+               strcpy(charging_state, "unknown");
+
+               while (!feof(acpi_bat_fp)) {
+                       char buf[256];
+                       if (fgets(buf, 256, acpi_bat_fp) == NULL)
+                               break;
+
+                       /* let's just hope units are ok */
+                       if (buf[0] == 'c')
+                               sscanf(buf, "charging state: %63s",
+                                      charging_state);
+                       else if (buf[0] == 'p')
+                               sscanf(buf, "present rate: %d",
+                                      &present_rate);
+                       else if (buf[0] == 'r')
+                               sscanf(buf, "remaining capacity: %d",
+                                      &remaining_capacity);
+               }
+
+               /* charging */
+               if (strcmp(charging_state, "charging") == 0) {
+                       if (acpi_last_full != 0 && present_rate > 0) {
+                               strcpy(last_battery_str, "charging ");
+                               format_seconds(last_battery_str + 9,
+                                              63 - 9,
+                                              (acpi_last_full -
+                                                              remaining_capacity) * 60 *
+                                                              60 / present_rate);
+                       } else if (acpi_last_full != 0
+                                                       && present_rate <= 0) {
+                                                               sprintf(last_battery_str, "charging %d%%",
+                                                                               remaining_capacity * 100 /
+                                                                               acpi_last_full);
+                                                       } else {
+                                                               strcpy(last_battery_str, "charging");
+                                                       }
+               }
+               /* discharging */
+               else if (strcmp(charging_state, "discharging") == 0) {
+                       if (present_rate > 0)
+                               format_seconds(last_battery_str, 63,
+                                              (remaining_capacity * 60 *
+                                                              60) / present_rate);
+                       else
+                               sprintf(last_battery_str,
+                                       "discharging %d%%",
+                                       remaining_capacity * 100 /
+                                                       acpi_last_full);
+               }
+               /* charged */
+               /* thanks to Lukas Zapletal <lzap@seznam.cz> */
+               else if (strcmp(charging_state, "charged") == 0) {
+                       if (acpi_last_full != 0 && remaining_capacity != acpi_last_full)
+                               sprintf(last_battery_str, "charged %d%%",
+                                       remaining_capacity * 100 / acpi_last_full);
+                       else
+                               strcpy(last_battery_str, "charged");
+               }
+               /* unknown, probably full / AC */
+               else {
+                       if (acpi_last_full != 0
+                                                && remaining_capacity != acpi_last_full)
+                               sprintf(last_battery_str, "unknown %d%%",
+                                       remaining_capacity * 100 /
+                                                       acpi_last_full);
+                       else
+                               strcpy(last_battery_str, "AC");
+               }
+       } else {
+               /* APM */
+               if (apm_bat_fp == NULL)
+                       apm_bat_fp = open_file(APM_PATH, &rep2);
+
+               if (apm_bat_fp != NULL) {
+                       int ac, status, flag, life;
+
+                       fscanf(apm_bat_fp,
+                              "%*s %*s %*x %x   %x       %x     %d%%",
+                              &ac, &status, &flag, &life);
+
+                       if (life == -1) {
+                               /* could check now that there is ac */
+                               snprintf(last_battery_str, 64, "AC");
+                       } else if (ac && life != 100) { /* could check that status==3 here? */
+                               snprintf(last_battery_str, 64,
+                                        "charging %d%%", life);
+                       } else {
+                               snprintf(last_battery_str, 64, "%d%%",
+                                        life);
+                       }
+
+                       /* it seemed to buffer it so file must be closed (or could use syscalls
+                       * directly but I don't feel like coding it now) */
+                       fclose(apm_bat_fp);
+                       apm_bat_fp = NULL;
+               }
+       }
+
+       snprintf(buf, n, "%s", last_battery_str);
+}
+
+void update_top()
+{
+       show_nice_processes = 1;
+       process_find_top(info.tops);
+}
diff --git a/mail.c b/mail.c
new file mode 100644 (file)
index 0000000..f98bc0b
--- /dev/null
+++ b/mail.c
@@ -0,0 +1,170 @@
+#include "conky.h"
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <dirent.h>
+
+char *current_mail_spool;
+
+static time_t last_mail_mtime;
+static double last_mail_update;
+
+void update_mail_count()
+{
+       struct stat buf;
+
+       if (current_mail_spool == NULL)
+               return;
+
+       /* TODO: use that fine file modification notify on Linux 2.4 */
+
+       /* don't check mail so often (9.5s is minimum interval) */
+       if (current_update_time - last_mail_update < 9.5)
+               return;
+       else
+               last_mail_update = current_update_time;
+
+       if (stat(current_mail_spool, &buf)) {
+               static int rep;
+               if (!rep) {
+                       ERR("can't stat %s: %s", current_mail_spool,
+                           strerror(errno));
+                       rep = 1;
+               }
+               return;
+       }
+#if HAVE_DIRENT_H
+       /* maildir format */
+       if (S_ISDIR(buf.st_mode)) {
+               DIR *dir;
+               char *dirname;
+               struct dirent *dirent;
+               info.mail_count = 0;
+               info.new_mail_count = 0;
+
+               dirname =
+                   (char *) malloc(sizeof(char) *
+                                   (strlen(current_mail_spool) + 5));
+               if (!dirname) {
+                       ERR("malloc");
+                       return;
+               }
+               strcpy(dirname, current_mail_spool);
+               strcat(dirname, "/");
+               /* checking the cur subdirectory */
+               strcat(dirname, "cur");
+
+               dir = opendir(dirname);
+               if (!dir) {
+                       ERR("cannot open directory");
+                       free(dirname);
+                       return;
+               }
+               dirent = readdir(dir);
+               while (dirent) {
+                       /* . and .. are skipped */
+                       if (dirent->d_name[0] != '.') {
+                               info.mail_count++;
+                       }
+                       dirent = readdir(dir);
+               }
+               closedir(dir);
+
+               dirname[strlen(dirname) - 3] = '\0';
+               strcat(dirname, "new");
+
+               dir = opendir(dirname);
+               if (!dir) {
+                       ERR("cannot open directory");
+                       free(dirname);
+                       return;
+               }
+               dirent = readdir(dir);
+               while (dirent) {
+                       /* . and .. are skipped */
+                       if (dirent->d_name[0] != '.') {
+                               info.new_mail_count++;
+                               info.mail_count++;
+                       }
+                       dirent = readdir(dir);
+               }
+               closedir(dir);
+
+               free(dirname);
+               return;
+       }
+#endif
+       /* mbox format */
+
+
+       if (buf.st_mtime != last_mail_mtime) {
+               /* yippee, modification time has changed, let's read mail count! */
+               static int rep;
+               FILE *fp;
+               int reading_status = 0;
+
+               /* could lock here but I don't think it's really worth it because
+                * this isn't going to write mail spool */
+
+               info.new_mail_count = 0;
+               info.mail_count = 0;
+
+               fp = open_file(current_mail_spool, &rep);
+               if (!fp)
+                       return;
+
+               /* NOTE: adds mail as new if there isn't Status-field at all */
+
+               while (!feof(fp)) {
+                       char buf[128];
+                       if (fgets(buf, 128, fp) == NULL)
+                               break;
+
+                       if (strncmp(buf, "From ", 5) == 0) {
+                               /* ignore MAILER-DAEMON */
+                               if (strncmp(buf + 5, "MAILER-DAEMON ", 14)
+                                   != 0) {
+                                       info.mail_count++;
+
+                                       if (reading_status)
+                                               info.new_mail_count++;
+                                       else
+                                               reading_status = 1;
+                               }
+                       } else {
+                               if (reading_status
+                                   && strncmp(buf, "X-Mozilla-Status:",
+                                              17) == 0) {
+                                       /* check that mail isn't already read */
+                                       if (strchr(buf + 21, '0'))
+                                               info.new_mail_count++;
+
+                                       reading_status = 0;
+                                       continue;
+                               }
+                               if (reading_status
+                                   && strncmp(buf, "Status:", 7) == 0) {
+                                       /* check that mail isn't already read */
+                                       if (strchr(buf + 7, 'R') == NULL)
+                                               info.new_mail_count++;
+
+                                       reading_status = 0;
+                                       continue;
+                               }
+                       }
+
+                       /* skip until \n */
+                       while (strchr(buf, '\n') == NULL && !feof(fp))
+                               fgets(buf, 128, fp);
+               }
+
+               fclose(fp);
+
+               if (reading_status)
+                       info.new_mail_count++;
+
+               last_mail_mtime = buf.st_mtime;
+       }
+}
diff --git a/metarinfo.c b/metarinfo.c
new file mode 100644 (file)
index 0000000..11bc4be
--- /dev/null
@@ -0,0 +1,155 @@
+#include "conky.h"
+#include <string.h>
+#include "ftp.h"
+#include <math.h>
+#include <pthread.h>
+#include "metarinfo.h"
+
+/* for threads */
+static int status = 0;
+
+
+int calculateRelativeHumidity(int temp, int dew) {
+       float rh = 0.0;
+       rh = 100.0 * powf ((112 - (0.1 * temp)+dew ) / (112 + (0.9 * temp)), 8);
+       return (int)rh;
+}
+
+int calculateWindChill(int temperatureC, int windKn) {
+       double windKmh = knTokph(windKn);
+       return (int)(13.112+0.6215*temperatureC - 11.37*powf(windKmh,.16) + 0.3965*temperatureC*powf(windKmh,.16) );
+}
+
+int knTokph(int knSpeed ){
+       return (knSpeed * 1.852);
+}
+
+const char *calculateWindDirectionString(int degree) {
+       if (degree < 22.5) {
+               return "North";
+       } else if (degree < 67.5){
+               return "Northeast";
+       } else if (degree < 112.5) {
+               return "East";
+       } else if (degree < 157.5) {
+               return "Southeast";
+       } else if (degree < 202.5){
+               return "South";
+       } else if (degree < 247.5) {
+               return "Southwest";
+       } else if (degree < 292.5) {
+               return "West";
+       } else if (degree < 337.5){
+               return "Northwest";
+       } else {
+               return "North";
+       }
+}
+const char*calculateShortWindDirectionString(int degree){
+       if (degree < 22.5) {
+               return "N";
+       } else if (degree < 67.5){
+               return "NE";
+       } else if (degree < 112.5) {
+               return "E";
+       } else if (degree < 157.5) {
+               return "SE";
+       } else if (degree < 202.5){
+               return "S";
+       } else if (degree < 247.5) {
+               return "SW";
+       } else if (degree < 292.5) {
+               return "W";
+       } else if (degree < 337.5){
+               return "NW";
+       } else {
+               return "N";
+       }
+}
+
+void ftpData(void *userData, const char *data, int len)
+{
+
+       if (len <= 0)
+               return;
+
+       if ( data != NULL ){
+               line = strdup(data);
+       }
+}
+
+
+void *fetch_ftp( ) {
+               // try three times if it fails
+       int tries = 0;
+       do {
+               if (tries > 0) {
+                       /* this happens too often, so i'll leave it commented fprintf(stderr, "METAR update failed for some reason, retry %i\n", tries); */
+                       sleep(15); /* give it some time in case the server is busy or down */
+               }
+               tries++;
+               if ( strlen(metar_station) != 8 ){
+                       fprintf(stderr,"You didn't supply a valid station code\n");     
+                       return;
+               }
+               if (metar_server == NULL)
+                       metar_server = strdup("weather.noaa.gov");
+               if (metar_path == NULL)
+                       metar_path = strdup("/data/observations/metar/stations");
+               
+               int res;
+               initFtp();
+               res = connectFtp(metar_server, 0);
+               if (res < 0) {
+                       fprintf(stderr, "Couldn't connect to %s\n", metar_server);
+                       return;
+               }
+               res = changeFtpDirectory(metar_path);
+               if (res < 0) {
+                       fprintf(stderr, "Metar update failed (couldn't CWD to %s)\n", metar_path);
+                       disconnectFtp();
+                       return;
+               }
+               if (res == 0) {
+                       fprintf(stderr,
+                               "Metar update failed\n");
+                       return;
+               }
+               if (getFtp(ftpData, NULL, metar_station) < 0) {
+                       fprintf(stderr, "Failed to get file %s\n", metar_station);
+               }
+               
+               disconnectFtp();
+               if ( line != NULL ){
+                       dcdNetMETAR(line, &data);
+                       free(line);
+                       line = NULL;
+                       ftp_ok = 1;
+                       metar_worked = 1;
+               }
+               else {
+                       ftp_ok = 0;
+       }
+
+       } while (ftp_ok == 0 && tries < 3);
+       status = 1;
+}
+
+static pthread_t thread1;
+
+void update_metar() {
+       int  iret1;
+       if (!status) {
+       status = 2;
+               iret1 = pthread_create( &thread1, NULL, fetch_ftp, NULL);
+       }
+       else if (status == 2) { /* thread is still running.  what else can we do? */
+               return;
+       }
+       else {
+               pthread_join( thread1, NULL);
+               status = 2;
+               iret1 = pthread_create( &thread1, NULL, fetch_ftp, NULL);
+       }
+       
+}
diff --git a/metarinfo.h b/metarinfo.h
new file mode 100644 (file)
index 0000000..02b72ba
--- /dev/null
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+int calculateRelativeHumidity(int, int);
+int calculateWindChill(int, int);
+int knTokph(int);
+const char *calculateWindDirectionString(int);
+const char *calculateShortWindDirectionString(int);
+
+char *line          = NULL;
+char *metar_station = NULL;
+char *metar_server  = NULL;
+char *metar_path    = NULL;
+char ftp_ok         = 0;
+char metar_worked   = 0;
+
+Decoded_METAR data;
diff --git a/missing b/missing
new file mode 100644 (file)
index 0000000..22e101a
--- /dev/null
+++ b/missing
@@ -0,0 +1,198 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright (C) 1996, 1997, 2001, 2002 Free Software Foundation, Inc.
+# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# 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.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.in; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+case "$1" in
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing - GNU libit 0.0"
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+  aclocal*)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acinclude.m4' or \`$configure_ac'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`$configure_ac'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acconfig.h' or \`$configure_ac'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' $configure_ac`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case "$f" in
+      *:*) touch_files="$touch_files "`echo "$f" |
+                                      sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`$configure_ac'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+          sed 's/\.am$/.in/' |
+          while read f; do touch "$f"; done
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.y)
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.c
+           fi
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.h
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f y.tab.h ]; then
+       echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+       echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.l)
+           SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" lex.yy.c
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+       echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  makeinfo)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+    fi
+    touch $file
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+         system.  You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequirements for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
diff --git a/mixer.c b/mixer.c
new file mode 100644 (file)
index 0000000..7f03cc6
--- /dev/null
+++ b/mixer.c
@@ -0,0 +1,75 @@
+#include "conky.h"
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#ifdef HAVE_LINUX_SOUNDCARD_H
+#include <linux/soundcard.h>
+#else
+#include <sys/soundcard.h>
+#endif                         /* HAVE_LINUX_SOUNDCARD_H */
+
+#define MIXER_DEV "/dev/mixer"
+
+static int mixer_fd;
+static const char *devs[] = SOUND_DEVICE_NAMES;
+
+int mixer_init(const char *name)
+{
+       unsigned int i;
+
+       if (name == 0 || name[0] == '\0')
+               name = "vol";
+
+       /* open mixer */
+       if (mixer_fd <= 0) {
+               mixer_fd = open(MIXER_DEV, O_RDONLY);
+               if (mixer_fd == -1) {
+                       ERR("can't open %s: %s", MIXER_DEV,
+                           strerror(errno));
+                       return -1;
+               }
+       }
+
+       for (i = 0; i < sizeof(devs) / sizeof(const char *); i++) {
+               if (strcasecmp(devs[i], name) == 0) {
+                       return i;
+               }
+       }
+
+       return -1;
+}
+
+static int mixer_get(int i)
+{
+       static char rep = 0;
+       int val = -1;
+
+       if (ioctl(mixer_fd, MIXER_READ(i), &val) == -1) {
+               if (!rep)
+                       ERR("mixer ioctl: %s", strerror(errno));
+               rep = 1;
+               return 0;
+       }
+       rep = 0;
+
+       return val;
+}
+
+int mixer_get_avg(int i)
+{
+       int v = mixer_get(i);
+       return ((v >> 8) + (v & 0xFF)) / 2;
+}
+
+int mixer_get_left(int i)
+{
+       return mixer_get(i) >> 8;
+}
+
+int mixer_get_right(int i)
+{
+       return mixer_get(i) & 0xFF;
+}
diff --git a/mkinstalldirs b/mkinstalldirs
new file mode 100644 (file)
index 0000000..6b3b5fc
--- /dev/null
@@ -0,0 +1,40 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+# $Id$
+
+errstatus=0
+
+for file
+do
+   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+   shift
+
+   pathcomp=
+   for d
+   do
+     pathcomp="$pathcomp$d"
+     case "$pathcomp" in
+       -* ) pathcomp=./$pathcomp ;;
+     esac
+
+     if test ! -d "$pathcomp"; then
+        echo "mkdir $pathcomp"
+
+        mkdir "$pathcomp" || lasterr=$?
+
+        if test ! -d "$pathcomp"; then
+         errstatus=$lasterr
+        fi
+     fi
+
+     pathcomp="$pathcomp/"
+   done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
diff --git a/mldonkey.c b/mldonkey.c
new file mode 100644 (file)
index 0000000..c52d135
--- /dev/null
@@ -0,0 +1,432 @@
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <netdb.h>
+#include <fcntl.h>
+#include <arpa/inet.h>
+#include "conky.h"
+
+int64 buf_to_int(char *buf, int pos, int size);
+void int_to_buf(int64 i, char *buf, int pos, int size);
+
+#define BUF16_TO_INT(buf, pos) buf_to_int((buf), (pos), 2)
+#define BUF32_TO_INT(buf, pos) buf_to_int((buf), (pos), 4)
+#define BUF64_TO_INT(buf, pos) buf_to_int((buf), (pos), 8)
+
+#define INT_TO_BUF16(i, buf, pos) int_to_buf((i), (buf), (pos), 2)
+#define INT_TO_BUF32(i, buf, pos) int_to_buf((i), (buf), (pos), 4)
+#define INT_TO_BUF64(i, buf, pos) int_to_buf((i), (buf), (pos), 8)
+
+mldonkey_info mlinfo;
+mldonkey_config mlconfig;
+
+/* Call this function to update the information about mldonkey.
+ * Note that the function will not reconnect to mldonkey if the
+ * pointer to the mldonkey_config has not changed. As it uses static
+ * data, it cannot be used in a multithreaded env.
+ * Returns 1 if connected and info filled, 0 if connected but not filled,
+ * -1 otherwise. */
+
+enum to_gui {
+  CoreProtocol, /* 0 */
+  Options_info,
+  RESERVED2,
+  DefineSearches,
+  Result_info,
+  Search_result,
+  Search_waiting,
+  File_info,
+  File_downloaded,
+  File_availability,
+  File_source, /* 10 */
+  Server_busy,
+  Server_user,
+  Server_state,
+  Server_info,
+  Client_info,
+  Client_state,
+  Client_friend,
+  Client_file,
+  Console,
+  Network_info, /* 20 */
+  User_info,
+  Room_info,
+  Room_message,
+  Room_add_user,
+  Client_stats,
+  Server_info_v2,
+  MessageFromClient,
+  ConnectedServers,
+  DownloadFiles,
+  DownloadedFiles, /* 30 */
+  Room_info_v2,
+  Room_remove_user,
+  Shared_file_info,
+  Shared_file_upload,
+  Shared_file_unshared,
+  Add_section_option,
+  Client_stats_v2,
+  Add_plugin_option,
+  Client_stats_v3,
+  File_info_v2,      /* 40 */
+  DownloadFiles_v2,
+  DownloadedFiles_v2,
+  File_info_v3,
+  DownloadFiles_v3,
+  DownloadedFiles_v3,
+  File_downloaded_v2,
+  BadPassword,
+  Shared_file_info_v2,
+  Client_stats_v4, /* 49 */
+};
+
+#define MLDONKEY_DISCONNECTED   0
+#define MLDONKEY_CONNECTING     1
+#define MLDONKEY_AUTHENTICATING 2
+#define MLDONKEY_CONNECTED      3
+
+#define MAX_MESSAGE_LEN 65000
+static int write_pos = 0;
+static char write_buf[MAX_MESSAGE_LEN];
+static char read_buf[MAX_MESSAGE_LEN];
+static int read_pos;
+static int mldonkey_sock = -1;
+static int mldonkey_state = MLDONKEY_DISCONNECTED;
+static mldonkey_config *old_config = NULL;
+
+/* int64 ------------------------------ */
+
+int64 buf_to_int(char *buf, int pos, int size)
+{
+    int i;
+    int64 res = 0;
+
+    for(i = 0; i < size; i++){
+        res += (buf[pos + i] & 0xFF) << (8 * i);
+    }
+    return res;
+}
+
+void int_to_buf(int64 i, char *buf, int pos, int size)
+{
+    int j;
+
+    for(j = 0; j < size; j++){
+        buf[pos + j] = (i & (-1)) >> (8 * j);
+    }
+}
+
+/* Write operations --------------------- */
+
+void init_message()
+{ write_pos = 0; }
+
+void write_int8(int code)
+{
+  write_buf[write_pos++] = code;
+}
+
+void write_opcode(int code)
+{
+  write_buf[write_pos++] = code;
+}
+
+void write_int16(int code)
+{
+  INT_TO_BUF16(code, write_buf, write_pos);
+  write_pos += 2;
+}
+
+void write_int32(int code)
+{
+  INT_TO_BUF32(code, write_buf, write_pos);
+  write_pos += 4;
+}
+
+void write_int64(int64 code)
+{
+  INT_TO_BUF64(code, write_buf, write_pos);
+  write_pos += 8;
+}
+
+void write_string(char *str)
+{
+  if(str == NULL){
+    write_int16(0);
+  } else {
+    int len = strlen(str);
+    write_int16(len);
+    memcpy((void *) (write_buf + write_pos), (void *) str, (size_t) len);
+    write_pos += len;
+  }
+}
+
+
+int write_message(char *mtype)
+{
+  char header[4];
+
+  INT_TO_BUF32(write_pos, header, 0);
+  if(4 != write(mldonkey_sock, header, 4) ||
+      write_pos != write(mldonkey_sock,(void *)write_buf,(size_t)write_pos)){
+    ERR("Error in transmitting %s\n",mtype);
+    write_pos = 0;
+
+    /* Immediatly close the connection */
+    close(mldonkey_sock);
+    mldonkey_state = MLDONKEY_DISCONNECTED;
+    mldonkey_sock = -1;
+    return -1;
+  } else {
+    write_pos = 0;
+    return 0;
+  }
+}
+
+
+/* Read operations ----------------------------*/
+
+int read_int8()
+{
+  return read_buf[read_pos++];
+}
+
+int read_int16()
+{
+  int i = BUF16_TO_INT(read_buf, read_pos);
+  read_pos += 2;
+  return i;
+}
+
+int read_int32()
+{
+  int i = BUF32_TO_INT(read_buf, read_pos);
+  read_pos += 4;
+  return i;
+}
+
+int64 read_int64()
+{
+  int64 i = BUF64_TO_INT(read_buf, read_pos);
+  read_pos += 8;
+  return i;
+}
+
+char* read_string()
+{
+  char *buf;
+  int len;
+
+  len = BUF16_TO_INT(read_buf, read_pos);
+  read_pos += 2;
+
+  buf = (char *) malloc((size_t) len+1);
+  memmove(read_buf + read_pos, buf, len);
+  buf[len] = 0;
+  read_pos += len;
+
+  return buf;
+}
+
+/* protocol impl. ----------------------------- */
+
+void close_sock();
+
+/* This function returns the number of messages read, 0 if it blocks,
+-1 on error. */
+int cut_messages(int reinit)
+{
+  int nread;
+  static int toread = 0;
+  static int pos = 0;
+
+  if(reinit){
+    toread = 0;
+    pos = 0;
+    read_pos = 0;
+    return 0;
+  }
+
+  while(1){
+    if(toread == 0){
+      nread = read(mldonkey_sock, read_buf+pos,4-pos);
+      if(nread <= 0){
+        if(errno == EAGAIN) {
+          return 0;
+        } else {
+          close_sock();
+          pos = 0; toread = 0; return -1; }
+      }
+      pos += nread;
+      if(pos == 4){
+        toread = BUF32_TO_INT(read_buf,0);
+        pos = 0;
+      }
+    } else {
+      nread = read(mldonkey_sock, read_buf+pos, toread - pos);
+      if(nread <= 0){
+       if(errno == EAGAIN) return 0; else {
+          pos = 0; toread = 0;
+          close_sock();
+          return -1; }
+      }
+      pos += nread;
+      if(pos == toread){
+        /* We have one message !!! */
+        int old_pos = pos;
+        read_pos = 0;
+        pos = 0;
+        toread = 0;
+
+        return old_pos;
+      }
+    }
+  }
+}
+
+void close_sock()
+{
+  old_config = NULL;
+  if(mldonkey_sock >= 0) close(mldonkey_sock);
+  mldonkey_sock = -1;
+  mldonkey_state = MLDONKEY_DISCONNECTED;
+  cut_messages(1);
+}
+
+int mldonkey_connect(mldonkey_config *config)
+{      
+  if(config != old_config){
+    struct sockaddr_in sa;
+    int retcode;
+    close_sock();
+
+
+    old_config=config;
+    /* resolve hostname */
+    memset(&sa, 0, sizeof(sa));
+
+    if(config->mldonkey_hostname == NULL)
+      config->mldonkey_hostname = "127.0.0.1";
+    if(config->mldonkey_hostname[0] >= '0' &&
+        config->mldonkey_hostname[0] <= '9'){
+      #ifdef HAS_INET_ATON
+      if (inet_aton(config->mldonkey_hostname, &sa.sin_addr) == 0) return -1;
+      #else
+
+      sa.sin_addr.s_addr = inet_addr(config->mldonkey_hostname);
+      if (sa.sin_addr.s_addr == (unsigned int) -1) return -1;
+      #endif
+
+    } else {
+      struct hostent * hp;
+      hp = gethostbyname(config->mldonkey_hostname);
+      if (hp == (struct hostent *) NULL) return -1;
+      sa.sin_addr.s_addr = (unsigned long)hp->h_addr_list[0];
+    }
+
+    sa.sin_port = htons(config->mldonkey_port);
+    sa.sin_family = AF_INET;
+
+    if ((mldonkey_sock = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
+      ERR("Opening socket");
+      close_sock();
+      return -1;
+    }
+
+    if( connect(mldonkey_sock, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
+      if (errno != EAGAIN &&
+          errno != EINTR &&
+          errno != EINPROGRESS &&
+          errno != EWOULDBLOCK) {
+//        ERR("Connection failed");
+        close_sock();
+        return -1;
+      }
+    }
+
+    retcode = fcntl(mldonkey_sock, F_GETFL, 0);
+    if (retcode == -1 ||
+        fcntl(mldonkey_sock, F_SETFL, retcode | O_NONBLOCK) == -1){
+      return -1;
+    }
+
+
+    mldonkey_state = MLDONKEY_CONNECTING;
+    return 0;
+  }
+
+  return 0;
+}
+
+int mldonkey_can_read()
+{
+  return cut_messages(0);
+}
+
+int mldonkey_info_message(mldonkey_info *info)
+{
+  int opcode = read_int16();
+
+  switch(opcode){
+
+    case CoreProtocol :
+    init_message();
+
+    write_int16(0); /* GUI protocol */
+    write_int32(10); /* Version 10 ! */
+    write_message("GuiProtocol");
+
+    write_int16(47); /* GUI protocol */
+
+    write_int16(1);
+    write_int32(1);
+    write_int8(1);
+    write_message("GuiExtensions");
+
+    init_message();
+    write_int16(5); /* Password */
+    write_string(old_config->mldonkey_password);
+    write_message("Password");
+
+    break;
+
+    case BadPassword :
+    ERR("Bad Password\n");
+    close_sock();
+    break;
+
+    case Client_stats:
+    case Client_stats_v2:
+    case Client_stats_v3:
+    ERR("Client stats format too old...\n");
+    break;
+
+    case Client_stats_v4:
+    mldonkey_state = MLDONKEY_CONNECTED;
+
+    info->upload_counter = read_int64();
+    info->download_counter = read_int64();
+    info->shared_counter = read_int64();
+    info->nshared_files = read_int32();
+    info->tcp_upload_rate = read_int32();
+    info->tcp_download_rate = read_int32();
+    info->udp_upload_rate = read_int32();
+    info->udp_download_rate = read_int32();
+    info->ndownloading_files = read_int32();
+    info->ndownloaded_files = read_int32();
+
+    break;
+  }
+
+  return 0;
+}
+
+int get_mldonkey_status(mldonkey_config *config, mldonkey_info *info)
+{
+  if( mldonkey_connect(config) >= 0){
+    while(mldonkey_can_read() > 0){
+      mldonkey_info_message(info);
+    }
+  }
+  return mldonkey_state;
+}
diff --git a/mpd.c b/mpd.c
new file mode 100644 (file)
index 0000000..2f83714
--- /dev/null
+++ b/mpd.c
@@ -0,0 +1,119 @@
+#include "conky.h"
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "libmpdclient.h"
+
+
+void update_mpd()
+{
+       struct information *current_info = &info;
+       current_info->conn =
+           mpd_newConnection(current_info->mpd.host,
+                             current_info->mpd.port, 10);
+       if (current_info->conn->error) {
+               //fprintf(stderr, "%s\n", current_info->conn->errorStr);
+               mpd_closeConnection(current_info->conn);
+               return;
+       }
+
+       mpd_Status * status;
+       mpd_InfoEntity *entity;
+       mpd_sendCommandListOkBegin(current_info->conn);
+       mpd_sendStatusCommand(current_info->conn);
+       mpd_sendCurrentSongCommand(current_info->conn);
+       mpd_sendCommandListEnd(current_info->conn);
+       if ((status = mpd_getStatus(current_info->conn)) == NULL) {
+               //fprintf(stderr, "%s\n", current_info->conn->errorStr);
+               mpd_closeConnection(current_info->conn);
+               return;
+       }
+       current_info->mpd.volume = status->volume;
+       //if (status->error)
+               //printf("error: %s\n", status->error);
+
+       if(status->state == MPD_STATUS_STATE_PLAY)
+       {
+               current_info->mpd.status = "Playing";
+       }
+       if(status->state == MPD_STATUS_STATE_STOP)
+       {
+               current_info->mpd.status = "Stopped";
+       }
+       if(status->state == MPD_STATUS_STATE_PAUSE)
+       {
+               current_info->mpd.status = "Paused";
+       }
+       if(status->state == MPD_STATUS_STATE_UNKNOWN)
+       {
+               current_info->mpd.status = "Unknown";
+       }
+       if(status->state == MPD_STATUS_STATE_PLAY || 
+                 status->state == MPD_STATUS_STATE_PAUSE) {
+               current_info->mpd.bitrate = status->bitRate;
+               current_info->mpd.progress = (float)status->elapsedTime/status->totalTime;
+                 }
+
+
+       if (current_info->conn->error) {
+               //fprintf(stderr, "%s\n", current_info->conn->errorStr);
+               mpd_closeConnection(current_info->conn);
+               return;
+       }
+
+       mpd_nextListOkCommand(current_info->conn);
+
+       while ((entity = mpd_getNextInfoEntity(current_info->conn))) {
+               mpd_Song * song = entity->info.song;
+               if (entity->type != MPD_INFO_ENTITY_TYPE_SONG) {
+                       mpd_freeInfoEntity(entity);
+                       continue;
+               }
+
+               if(current_info->mpd.artist == NULL)
+                       current_info->mpd.artist = malloc(TEXT_BUFFER_SIZE);
+               if(current_info->mpd.album == NULL)
+                       current_info->mpd.album = malloc(TEXT_BUFFER_SIZE);
+               if(current_info->mpd.title == NULL)
+                       current_info->mpd.title = malloc(TEXT_BUFFER_SIZE);
+               if (song->artist) {
+                       strcpy(current_info->mpd.artist, song->artist);
+               }
+               else {
+                       strcpy(current_info->mpd.artist, "Unknown");
+               }
+               if (song->album) {
+                       strcpy(current_info->mpd.album, song->album);
+               }
+               else {
+                       strcpy(current_info->mpd.album, "Unknown");
+               }
+               if (song->title) {
+                       strcpy(current_info->mpd.title, song->title);
+               }
+               else {
+                       strcpy(current_info->mpd.title, "Unknown");
+               }
+               if (entity != NULL) {
+                       mpd_freeInfoEntity(entity);
+               }
+       }
+       if (entity != NULL) {
+               mpd_freeInfoEntity(entity);
+       }
+               
+       if (current_info->conn->error) {
+               //fprintf(stderr, "%s\n", current_info->conn->errorStr);
+               mpd_closeConnection(current_info->conn);
+               return;
+       }
+
+       mpd_finishCommand(current_info->conn);
+       if (current_info->conn->error) {
+               //fprintf(stderr, "%s\n", current_info->conn->errorStr);
+               mpd_closeConnection(current_info->conn);
+               return;
+       }
+       mpd_freeStatus(status);
+       mpd_closeConnection(current_info->conn);
+}
diff --git a/netbsd.c b/netbsd.c
new file mode 100644 (file)
index 0000000..6e4fcbf
--- /dev/null
+++ b/netbsd.c
@@ -0,0 +1,356 @@
+/* NetBSD port */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <time.h>
+#include <unistd.h>
+#include <err.h>
+#include <limits.h>
+#include <paths.h>
+
+#include <kvm.h>
+#include <nlist.h>
+
+#include <sys/time.h>
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/user.h>
+#include <sys/socket.h>
+#include <sys/swap.h>
+#include <sys/sched.h>
+#include <sys/envsys.h>
+
+#include <net/if.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <machine/param.h>
+
+#include "conky.h"
+
+
+static kvm_t *kd = NULL;
+int kd_init = 0, nkd_init = 0;
+u_int32_t sensvalue;
+char errbuf[_POSIX2_LINE_MAX];
+
+static int init_kvm(void)
+{
+       if (kd_init)
+               return 0;
+
+       kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf);
+       if (kd == NULL) {
+               (void) warnx("cannot kvm_openfiles: %s", errbuf);
+               return -1;
+       }
+       kd_init = 1;
+       return 0;
+}
+
+static int swapmode(int *retavail, int *retfree)
+{
+       int n;
+       struct swapent *sep;
+
+       *retavail = 0;
+       *retfree = 0;
+
+       n = swapctl(SWAP_NSWAP, 0, 0);
+
+       if (n < 1) {
+               (void) warn("could not get swap information");
+               return 0;
+       }
+
+       sep = (struct swapent *) malloc(n * (sizeof(*sep)));
+
+       if (sep == NULL) {
+               (void) warn("memory allocation failed");
+               return 0;
+       }
+
+       if (swapctl(SWAP_STATS, (void *) sep, n) < n) {
+               (void) warn("could not get swap stats");
+               return 0;
+       }
+       for (; n > 0; n--) {
+               *retavail += (int) dbtob(sep[n - 1].se_nblks);
+               *retfree +=
+                   (int) dbtob(sep[n - 1].se_nblks - sep[n - 1].se_inuse);
+       }
+       *retavail = (int) (*retavail / 1024);
+       *retfree = (int) (*retfree / 1024);
+
+       return 1;
+}
+
+
+void prepare_update()
+{
+}
+
+void update_uptime()
+{
+       int mib[2] = { CTL_KERN, KERN_BOOTTIME };
+       struct timeval boottime;
+       time_t now;
+       int size = sizeof(boottime);
+
+       if ((sysctl(mib, 2, &boottime, &size, NULL, 0) != -1)
+           && (boottime.tv_sec != 0)) {
+               (void) time(&now);
+               info.uptime = now - boottime.tv_sec;
+       } else {
+               (void) warn("could not get uptime");
+               info.uptime = 0;
+       }
+}
+
+
+void update_meminfo()
+{
+       int mib[] = { CTL_VM, VM_UVMEXP2 };
+       int total_pages, inactive_pages, free_pages;
+       int swap_avail, swap_free;
+       const int pagesize = getpagesize();
+       struct uvmexp_sysctl uvmexp;
+       size_t size = sizeof(uvmexp);
+
+       info.memmax = info.mem = 0;
+       info.swapmax = info.swap = 0;
+
+
+       if (sysctl(mib, 2, &uvmexp, &size, NULL, 0) < 0) {
+               warn("could not get memory info");
+               return;
+       }
+
+       total_pages = uvmexp.npages;
+       free_pages = uvmexp.free;
+       inactive_pages = uvmexp.inactive;
+
+       info.memmax = (total_pages * pagesize) >> 10;
+       info.mem =
+           ((total_pages - free_pages - inactive_pages) * pagesize) >> 10;
+
+       if (swapmode(&swap_avail, &swap_free) >= 0) {
+               info.swapmax = swap_avail;
+               info.swap = (swap_avail - swap_free);
+       }
+}
+
+void update_net_stats()
+{
+       int i;
+       double delta;
+       struct ifnet ifnet;
+       struct ifnet_head ifhead;       /* interfaces are in a tail queue */
+       u_long ifnetaddr;
+       static struct nlist namelist[] = {
+               {"_ifnet"},
+               {NULL},
+       };
+       static kvm_t *nkd;
+
+       if (!nkd_init) {
+               nkd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
+               if (nkd == NULL) {
+                       (void) warnx("cannot kvm_openfiles: %s", errbuf);
+                       (void)
+                           warnx
+                           ("maybe you need to setgid kmem this program?");
+                       return;
+               } else if (kvm_nlist(nkd, namelist) != 0) {
+                       (void) warn("cannot kvm_nlist");
+                       return;
+               } else
+                       nkd_init = 1;
+       }
+
+       if (kvm_read(nkd, (u_long) namelist[0].n_value, (void *) &ifhead,
+                    sizeof(ifhead)) < 0) {
+               (void) warn("cannot kvm_read");
+               return;
+       }
+
+       /* get delta */
+       delta = current_update_time - last_update_time;
+       if (delta <= 0.0001)
+               return;
+
+       for (i = 0, ifnetaddr = (u_long) ifhead.tqh_first;
+            ifnet.if_list.tqe_next && i < 16;
+            ifnetaddr = (u_long) ifnet.if_list.tqe_next, i++) {
+
+               struct net_stat *ns;
+               long long last_recv, last_trans;
+
+               (void) kvm_read(nkd, (u_long) ifnetaddr, (void *) &ifnet,
+                               sizeof(ifnet));
+               ns = get_net_stat(ifnet.if_xname);
+               ns->up = 1;
+               last_recv = ns->recv;
+               last_trans = ns->trans;
+
+               if (ifnet.if_ibytes < ns->last_read_recv)
+                       ns->recv +=
+                           ((long long) 4294967295U -
+                            ns->last_read_recv) + ifnet.if_ibytes;
+               else
+                       ns->recv += (ifnet.if_ibytes - ns->last_read_recv);
+
+               ns->last_read_recv = ifnet.if_ibytes;
+
+               if (ifnet.if_obytes < ns->last_read_trans)
+                       ns->trans +=
+                           ((long long) 4294967295U -
+                            ns->last_read_trans) + ifnet.if_obytes;
+               else
+                       ns->trans +=
+                           (ifnet.if_obytes - ns->last_read_trans);
+
+               ns->last_read_trans = ifnet.if_obytes;
+
+               ns->recv += (ifnet.if_ibytes - ns->last_read_recv);
+               ns->last_read_recv = ifnet.if_ibytes;
+               ns->trans += (ifnet.if_obytes - ns->last_read_trans);
+               ns->last_read_trans = ifnet.if_obytes;
+
+               ns->recv_speed = (ns->recv - last_recv) / delta;
+               ns->trans_speed = (ns->trans - last_trans) / delta;
+       }
+}
+
+void update_total_processes()
+{
+       /* It's easier to use kvm here than sysctl */
+
+       int n_processes;
+
+       info.procs = 0;
+
+       if (init_kvm() < 0)
+               return;
+       else
+               kvm_getproc2(kd, KERN_PROC_ALL, 0,
+                            sizeof(struct kinfo_proc2), &n_processes);
+
+       info.procs = n_processes;
+}
+
+void update_running_processes()
+{
+       struct kinfo_proc2 *p;
+       int n_processes;
+       int i, cnt = 0;
+
+       info.run_procs = 0;
+
+       if (init_kvm() < 0)
+               return;
+       else {
+               p = kvm_getproc2(kd, KERN_PROC_ALL, 0,
+                                sizeof(struct kinfo_proc2), &n_processes);
+               for (i = 0; i < n_processes; i++)
+                       if (p[i].p_stat == LSRUN || p[i].p_stat == LSIDL ||
+                           p[i].p_stat == LSONPROC)
+                               cnt++;
+       }
+
+       info.run_procs = cnt;
+}
+
+struct cpu_load_struct {
+       unsigned long load[5];
+};
+
+struct cpu_load_struct fresh = {
+       {0, 0, 0, 0, 0}
+};
+
+long cpu_used, oldtotal, oldused;
+
+void update_cpu_usage()
+{
+       long used, total;
+       static u_int64_t cp_time[CPUSTATES];
+       size_t len = sizeof(cp_time);
+
+       info.cpu_usage = 0;
+
+       if (sysctlbyname("kern.cp_time", &cp_time, &len, NULL, 0) < 0)
+               (void) warn("cannot get kern.cp_time");
+
+
+       fresh.load[0] = cp_time[CP_USER];
+       fresh.load[1] = cp_time[CP_NICE];
+       fresh.load[2] = cp_time[CP_SYS];
+       fresh.load[3] = cp_time[CP_IDLE];
+       fresh.load[4] = cp_time[CP_IDLE];
+
+       used = fresh.load[0] + fresh.load[1] + fresh.load[2];
+       total =
+           fresh.load[0] + fresh.load[1] + fresh.load[2] + fresh.load[3];
+
+       if ((total - oldtotal) != 0)
+               info.cpu_usage =
+                   ((double) (used - oldused)) / (double) (total -
+                                                           oldtotal);
+       else
+               info.cpu_usage = 0;
+
+       oldused = used;
+       oldtotal = total;
+
+}
+
+double get_i2c_info(int *fd, int div, char *devtype)
+{
+       return -1;
+}
+
+void update_load_average()
+{
+       double v[3];
+       getloadavg(v, 3);
+
+       info.loadavg[0] = (float) v[0];
+       info.loadavg[1] = (float) v[1];
+       info.loadavg[2] = (float) v[2];
+}
+
+double get_acpi_temperature(int fd)
+{
+       return -1;
+}
+
+void get_battery_stuff(char *buf, unsigned int n, const char *bat)
+{
+}
+
+int
+open_i2c_sensor(const char *dev, const char *type, int n, int *div,
+               char *devtype)
+{
+       return -1;
+}
+
+int open_acpi_temperature(const char *name)
+{
+       return -1;
+}
+
+char *get_acpi_ac_adapter(void)
+{
+       return "N/A";
+}
+
+char *get_acpi_fan()
+{
+       return "N/A";
+}
diff --git a/seti.c b/seti.c
new file mode 100644 (file)
index 0000000..1c8a8d5
--- /dev/null
+++ b/seti.c
@@ -0,0 +1,103 @@
+#include "conky.h"
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+char *seti_dir = NULL;
+
+//Need to code for BOINC, because the old SETI@Home does not use xml to store data.
+//Perhaps in the .conkyrc file there could be an option for BOINC or old SETI.
+
+/*static float seti_get_float (FILE *fp, const char *name)
+{
+  char buffer[80];
+  char *token;
+
+  while (!feof(fp) && !ferror (fp))
+  {
+    fgets(buffer, 80, fp);
+    token = strtok(buffer, ">");
+
+    if (strcmp(token, name) == 0)
+    {
+      token = strtok(NULL, "<");
+      if ( token != NULL )
+        return atof (token);
+      break;
+    }
+  }
+  return 0.0f;
+}*/
+
+float seti_get_data(FILE * fp, const char *name)
+{
+       char token[1000];
+       char buffer[1000];
+       float data;
+
+       while (fgets(token, 1000, fp) != NULL)  //read the file
+               if (strncmp(token, name, strlen(name)) == 0) {  //and search for the data in name
+                       strcpy(buffer, strchr(token, '=') + 1); //copy just the number
+                       break;
+               }
+       data = atof(buffer);
+       return data;
+}
+
+void update_seti()
+{
+       if (seti_dir == NULL)
+               return;
+
+       char filename[80];
+
+       struct information *current_info = &info;
+
+       current_info->seti_prog = current_info->seti_credit = 0.0f;
+
+       /* read total user credit */
+
+       /*FILE *fp = fopen(filename, "r");
+          if (!fp)
+          return;
+
+          seti_credit = seti_get_float(fp, "<user_total_credit");
+
+          fclose (fp); */
+
+       snprintf(filename, 80, "%s/user_info.sah", seti_dir);
+
+       FILE *fp = fopen(filename, "r");
+
+       if (!fp) {
+               return;
+       }
+
+       current_info->seti_credit = seti_get_data(fp, "nresults");
+
+       fclose(fp);
+
+       /* read current progress */
+
+       /*snprintf(filename, 80, "%s/slots/0/state.sah", seti_dir);
+          fp = fopen(filename, "r");
+          if (!fp)
+          return;
+
+          seti_prog = seti_get_float(fp, "<prog");
+
+          fclose (fp);
+
+          snprintf(filename, 80, "%s/slots/0/init_data.xml", seti_dir); */
+
+       snprintf(filename, 80, "%s/state.sah", seti_dir);
+
+       fp = fopen(filename, "r");
+       if (!fp)
+               return;
+
+       current_info->seti_prog = seti_get_data(fp, "prog");
+
+       fclose(fp);
+
+}
diff --git a/solaris.c b/solaris.c
new file mode 100644 (file)
index 0000000..3854336
--- /dev/null
+++ b/solaris.c
@@ -0,0 +1,52 @@
+/* doesn't work, feel free to finish this */
+#include "conky.h"
+#include <kstat.h>
+
+static kstat_ctl_t *kstat;
+static int kstat_updated;
+
+static void update_kstat()
+{
+       if (kstat == NULL) {
+               kstat = kstat_open();
+               if (kstat == NULL) {
+                       ERR("can't open kstat: %s", strerror(errno));
+               }
+       }
+
+       if (kstat_chain_update(kstat) == -1) {
+               perror("kstat_chain_update");
+               return;
+       }
+}
+
+void prepare_update()
+{
+       kstat_updated = 0;
+}
+
+double get_uptime()
+{
+       kstat_t *ksp;
+
+       update_kstat();
+
+       ksp = kstat_lookup(kstat, "unix", -1, "system_misc");
+       if (ksp != NULL) {
+               if (kstat_read(kstat, ksp, NULL) >= 0) {
+                       kstat_named_t *knp;
+                       knp =
+                           (kstat_named_t *) kstat_data_lookup(ksp,
+                                                               "boot_time");
+                       if (knp != NULL) {
+                               return get_time() -
+                                   (double) knp->value.ui32;
+                       }
+               }
+       }
+}
+
+void update_meminfo()
+{
+       /* TODO */
+}
diff --git a/top.c b/top.c
new file mode 100644 (file)
index 0000000..3667334
--- /dev/null
+++ b/top.c
@@ -0,0 +1,477 @@
+#include "top.h"
+
+static regex_t *exclusion_expression = 0;
+static unsigned int g_time = 0;
+static int previous_total = 0;
+static struct process *first_process = 0;
+
+static struct process *find_process(pid_t pid)
+{
+       struct process *p = first_process;
+       while (p) {
+               if (p->pid == pid)
+                       return p;
+               p = p->next;
+       }
+       return 0;
+}
+
+/*
+ * Create a new process object and insert it into the process list
+ */
+static struct process *new_process(int p)
+{
+       struct process *process;
+       process = malloc(sizeof(struct process));
+
+       /*
+        * Do stitching necessary for doubly linked list
+        */
+       process->name = 0;
+       process->previous = 0;
+       process->next = first_process;
+       if (process->next)
+               process->next->previous = process;
+       first_process = process;
+
+       process->pid = p;
+       process->time_stamp = 0;
+       process->previous_user_time = INT_MAX;
+       process->previous_kernel_time = INT_MAX;
+       process->counted = 1;
+
+/*    process_find_name(process);*/
+
+       return process;
+}
+
+/******************************************/
+/* Functions                              */
+/******************************************/
+
+static int process_parse_stat(struct process *);
+static int update_process_table(void);
+static int calculate_cpu(struct process *);
+static void process_cleanup(void);
+static void delete_process(struct process *);
+/*inline void draw_processes(void);*/
+static int calc_cpu_total(void);
+static void calc_cpu_each(int);
+void process_find_top(struct process **);
+
+
+/******************************************/
+/* Extract information from /proc         */
+/******************************************/
+
+/*
+ * These are the guts that extract information out of /proc.
+ * Anyone hoping to port wmtop should look here first.
+ */
+static int process_parse_stat(struct process *process)
+{
+       struct information *cur;
+       cur = &info;
+       char line[BUFFER_LEN], filename[BUFFER_LEN], procname[BUFFER_LEN];
+       int ps;
+       int user_time, kernel_time;
+       int rc;
+       char *r, *q;
+       char deparenthesised_name[BUFFER_LEN];
+       int endl;
+       int nice_val;
+
+       snprintf(filename, sizeof(filename), PROCFS_TEMPLATE,
+                process->pid);
+
+       ps = open(filename, O_RDONLY);
+       if (ps < 0)
+               /*
+               * The process must have finished in the last few jiffies!
+               */
+               return 1;
+
+       /*
+       * Mark process as up-to-date.
+       */
+       process->time_stamp = g_time;
+
+       rc = read(ps, line, sizeof(line));
+       close(ps);
+       if (rc < 0)
+               return 1;
+
+       /*
+       * Extract cpu times from data in /proc filesystem
+       */
+       rc = sscanf(line,
+                   "%*s %s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %d %d %*s %*s %*s %d %*s %*s %*s %d %d",
+                   procname, &process->user_time, &process->kernel_time,
+                   &nice_val, &process->vsize, &process->rss);
+       if (rc < 5)
+               return 1;
+       /*
+       * Remove parentheses from the process name stored in /proc/ under Linux...
+       */
+       r = procname + 1;
+       /* remove any "kdeinit: " */
+       if (r == strstr(r, "kdeinit")) {
+               snprintf(filename, sizeof(filename),
+                        PROCFS_CMDLINE_TEMPLATE, process->pid);
+
+               ps = open(filename, O_RDONLY);
+               if (ps < 0)
+                       /*
+                       * The process must have finished in the last few jiffies!
+                       */
+                       return 1;
+
+               endl = read(ps, line, sizeof(line));
+               close(ps);
+
+               /* null terminate the input */
+               line[endl] = 0;
+               /* account for "kdeinit: " */
+               if ((char *) line == strstr(line, "kdeinit: "))
+                       r = ((char *) line) + 9;
+               else
+                       r = (char *) line;
+
+               q = deparenthesised_name;
+               /* stop at space */
+               while (*r && *r != ' ')
+                       *q++ = *r++;
+               *q = 0;
+       } else {
+               q = deparenthesised_name;
+               while (*r && *r != ')')
+                       *q++ = *r++;
+               *q = 0;
+       }
+       
+       if (process->name)
+               free(process->name);
+       process->name = strdup(deparenthesised_name);
+       process->rss *= getpagesize();
+       
+       if(!cur->memmax)
+               update_total_processes();
+       
+       process->totalmem = ( (float) process->rss / cur->memmax ) / 10;
+
+       if (process->previous_user_time == INT_MAX)
+               process->previous_user_time = process->user_time;
+       if (process->previous_kernel_time == INT_MAX)
+               process->previous_kernel_time = process->kernel_time;
+
+       /* store the difference of the user_time */
+       user_time = process->user_time - process->previous_user_time;
+       kernel_time = process->kernel_time - process->previous_kernel_time;
+
+       /* backup the process->user_time for next time around */
+       process->previous_user_time = process->user_time;
+       process->previous_kernel_time = process->kernel_time;
+
+       /* store only the difference of the user_time here... */
+       process->user_time = user_time;
+       process->kernel_time = kernel_time;
+
+
+       return 0;
+}
+
+/******************************************/
+/* Update process table                   */
+/******************************************/
+
+static int update_process_table()
+{
+       DIR *dir;
+       struct dirent *entry;
+
+       if (!(dir = opendir("/proc")))
+               return 1;
+
+       ++g_time;
+
+       /*
+        * Get list of processes from /proc directory
+        */
+       while ((entry = readdir(dir))) {
+               pid_t pid;
+
+               if (!entry) {
+                       /*
+                        * Problem reading list of processes
+                        */
+                       closedir(dir);
+                       return 1;
+               }
+
+               if (sscanf(entry->d_name, "%d", &pid) > 0) {
+                       struct process *p;
+                       p = find_process(pid);
+                       if (!p)
+                               p = new_process(pid);
+
+                       /* compute each process cpu usage */
+                       calculate_cpu(p);
+               }
+       }
+
+       closedir(dir);
+
+       return 0;
+}
+
+/******************************************/
+/* Get process structure for process pid  */
+/******************************************/
+
+/*
+ * This function seems to hog all of the CPU time. I can't figure out why - it
+ * doesn't do much.
+ */
+static int calculate_cpu(struct process *process)
+{
+       int rc;
+
+       /* compute each process cpu usage by reading /proc/<proc#>/stat */
+       rc = process_parse_stat(process);
+       if (rc)
+               return 1;
+       /*rc = process_parse_statm(process);
+       if (rc)
+       return 1;*/
+
+       /*
+        * Check name against the exclusion list
+        */
+       if (process->counted && exclusion_expression
+           && !regexec(exclusion_expression, process->name, 0, 0, 0))
+       process->counted = 0;
+
+       return 0;
+}
+
+/******************************************/
+/* Strip dead process entries             */
+/******************************************/
+
+static void process_cleanup()
+{
+
+       struct process *p = first_process;
+       while (p) {
+               struct process *current = p;
+
+#if defined(PARANOID)
+               assert(p->id == 0x0badfeed);
+#endif                         /* defined(PARANOID) */
+
+               p = p->next;
+               /*
+                * Delete processes that have died
+                */
+               if (current->time_stamp != g_time)
+                       delete_process(current);
+       }
+}
+
+/******************************************/
+/* Destroy and remove a process           */
+/******************************************/
+
+static void delete_process(struct process *p)
+{
+#if defined(PARANOID)
+       assert(p->id == 0x0badfeed);
+
+       /*
+        * Ensure that deleted processes aren't reused.
+        */
+       p->id = 0x007babe;
+#endif                         /* defined(PARANOID) */
+
+       /*
+        * Maintain doubly linked list.
+        */
+       if (p->next)
+               p->next->previous = p->previous;
+       if (p->previous)
+               p->previous->next = p->next;
+       else
+               first_process = p->next;
+
+       if (p->name)
+               free(p->name);
+       free(p);
+}
+
+/******************************************/
+/* Calculate cpu total                    */
+/******************************************/
+
+static int calc_cpu_total()
+{
+       int total, t;
+       int rc;
+       int ps;
+       char line[BUFFER_LEN];
+       int cpu, nice, system, idle;
+
+       ps = open("/proc/stat", O_RDONLY);
+       rc = read(ps, line, sizeof(line));
+       close(ps);
+       if (rc < 0)
+               return 0;
+       sscanf(line, "%*s %d %d %d %d", &cpu, &nice, &system, &idle);
+       total = cpu + nice + system + idle;
+
+       t = total - previous_total;
+       previous_total = total;
+
+       if (t < 0)
+               t = 0;
+
+       return t;
+}
+
+/******************************************/
+/* Calculate each processes cpu           */
+/******************************************/
+
+inline static void calc_cpu_each(int total)
+{
+       struct process *p = first_process;
+       while (p) {
+               /*p->amount = total ?
+                   (100.0 * (float) (p->user_time + p->kernel_time) /
+                    total) : 0;*/
+                    p->amount = (100.0 * (p->user_time + p->kernel_time) / total);
+
+/*             if (p->amount > 100)
+                    p->amount = 0;*/
+               p = p->next;
+       }
+}
+
+/******************************************/
+/* Find the top processes                 */
+/******************************************/
+
+/*
+ * Result is stored in decreasing order in best[0-9].
+ */
+
+static struct process **sorttmp;
+
+inline void process_find_top(struct process **best)
+{
+       struct process *pr;
+       if (sorttmp == NULL) {
+               sorttmp = malloc(sizeof(struct process)*10);
+               assert(sorttmp != NULL);
+       }
+       int total;
+       int i, max;
+
+       total = calc_cpu_total();       /* calculate the total of the processor */
+
+       update_process_table(); /* update the table with process list */
+       calc_cpu_each(total);   /* and then the percentage for each task */
+       process_cleanup();      /* cleanup list from exited processes */
+
+       /*
+        * this is really ugly,
+        * not to mention probably not too efficient.
+        * the main problem is that there could be any number of processes,
+        * however we have to use a fixed size for the "best" array.
+        * right now i can't think of a better way to do this,
+        * although i'm sure there is one.
+        * Perhaps just using a linked list would be more effecient?
+        * I'm too fucking lazy to do that right now.
+        */
+       pr = first_process;
+       i = 0;
+       while(pr) {
+               if(i<300 && pr->counted) {
+                       sorttmp[i] = pr;
+                       i++;
+               }
+               else if (i>299) {
+                       /*ERR("too many processes, you will get innaccurate results from top");*/
+                       break;
+               }
+               pr = pr->next;
+       }
+       max = i;
+       if(top_sort_cpu) {
+       for(i=0;i<max-1;i++)
+       {
+               while (sorttmp[i+1]->amount > sorttmp[i]->amount)
+               {
+                       pr = sorttmp[i];
+                       sorttmp[i] = sorttmp[i+1];
+                       sorttmp[i+1] = pr;
+                       if (i>0)
+                               i--;
+                       else
+                               break;
+               }
+
+       }
+       for(i=max;i>1;i--);
+       {
+               while (sorttmp[i]->amount > sorttmp[i-1]->amount)
+               {
+                       pr = sorttmp[i];
+                       sorttmp[i] = sorttmp[i-1];
+                       sorttmp[i-1] = pr;
+                       if (i<max)
+                               i++;
+                       else
+                               break;
+               }
+       }
+       for(i=0;i<10;i++)
+       {
+               best[i] = sorttmp[i];
+
+       }
+       }
+       else {
+               for(i=0;i<max-1;i++)
+               {
+                       while (sorttmp[i+1]->totalmem > sorttmp[i]->totalmem)
+                       {
+                               pr = sorttmp[i];
+                               sorttmp[i] = sorttmp[i+1];
+                               sorttmp[i+1] = pr;
+                               if (i>0)
+                                       i--;
+                               else
+                                       break;
+                       }
+
+               }
+               for(i=max;i>1;i--);
+               {
+                       while (sorttmp[i]->totalmem > sorttmp[i-1]->totalmem)
+                       {
+                               pr = sorttmp[i];
+                               sorttmp[i] = sorttmp[i-1];
+                               sorttmp[i-1] = pr;
+                               if (i<max)
+                                       i++;
+                               else
+                                       break;
+                       }
+               }
+               for(i=0;i<10;i++)
+               {
+                       best[i] = sorttmp[i];
+
+               }
+       }
+}
diff --git a/top.h b/top.h
new file mode 100644 (file)
index 0000000..0fa3820
--- /dev/null
+++ b/top.h
@@ -0,0 +1,84 @@
+/*
+ * top.c a slightly modified wmtop.c -- copied from the WindowMaker and gkrelltop
+ * 
+ * Modified by Brenden Matthews
+ *
+ * Modified by Adi Zaimi
+ *
+ * Derived by Dan Piponi dan@tanelorn.demon.co.uk
+ * http://www.tanelorn.demon.co.uk
+ * http://wmtop.sourceforge.net 
+ * from code originally contained in wmsysmon by Dave Clark 
+(clarkd@skynet.ca)
+ * This software is licensed through the GNU General Public License.
+ */
+
+/*
+ * Ensure there's an operating system defined. There is *no* default
+ * because every OS has it's own way of revealing CPU/memory usage.
+ * compile with gcc -DOS ...
+ */
+
+/******************************************/
+/* Includes                               */
+/******************************************/
+
+#include "conky.h"
+#define CPU_THRESHHOLD   0     /* threshhold for the cpu diff to appear */
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+#include <dirent.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <math.h>
+#include <assert.h>
+#include <limits.h>
+#include <errno.h>
+#include <signal.h>
+
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+
+#include <regex.h>
+
+/******************************************/
+/* Defines                                */
+/******************************************/
+
+
+/*
+ * XXX: I shouldn't really use this BUFFER_LEN variable but scanf is so
+ * lame and it'll take me a while to write a replacement.
+ */
+#define BUFFER_LEN 1024
+
+#define PROCFS_TEMPLATE "/proc/%d/stat"
+#define PROCFS_TEMPLATE_MEM "/proc/%d/statm"
+#define PROCFS_CMDLINE_TEMPLATE "/proc/%d/cmdline"
+
+
+/******************************************/
+/* Globals                                */
+/******************************************/
+
+
+
+
+
+
+
+/******************************************/
+/* Process class                          */
+/******************************************/
+
+/*
+ * Pointer to head of process list
+ */
+void process_find_top(struct process **);
diff --git a/x11.c b/x11.c
new file mode 100644 (file)
index 0000000..5877a58
--- /dev/null
+++ b/x11.c
@@ -0,0 +1,334 @@
+#include "conky.h"
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+#ifdef XFT
+#include <X11/Xft/Xft.h>
+#endif
+
+#ifdef XDBE
+int use_xdbe;
+#endif
+
+#ifdef XFT
+int use_xft;
+#endif
+
+/* some basic X11 stuff */
+Display *display;
+int display_width;
+int display_height;
+int screen;
+
+/* workarea from _NET_WORKAREA, this is where window / text is aligned */
+int workarea[4];
+
+/* Window stuff */
+struct conky_window window;
+
+/* local prototypes */
+static void update_workarea();
+static Window find_window_to_draw();
+static Window find_subwindow(Window win, int w, int h);
+
+/* X11 initializer */
+void init_X11()
+{
+       if ((display = XOpenDisplay(0)) == NULL)
+               CRIT_ERR("can't open display: %s", XDisplayName(0));
+
+       screen = DefaultScreen(display);
+       display_width = DisplayWidth(display, screen);
+       display_height = DisplayHeight(display, screen);
+
+       update_workarea();
+}
+
+static void update_workarea()
+{
+       Window root = RootWindow(display, screen);
+       unsigned long nitems, bytes;
+       unsigned char *buf = NULL;
+       Atom type;
+       int format;
+
+       /* default work area is display */
+       workarea[0] = 0;
+       workarea[1] = 0;
+       workarea[2] = display_width;
+       workarea[3] = display_height;
+
+       /* get current desktop */
+       if (XGetWindowProperty(display, root, ATOM(_NET_CURRENT_DESKTOP),
+                              0, 1, False, XA_CARDINAL, &type, &format,
+                              &nitems, &bytes, &buf) == Success
+           && type == XA_CARDINAL && nitems > 0) {
+
+               //Currently unused 
+               /*  long desktop = * (long *) buf; */
+
+               XFree(buf);
+               buf = 0;
+
+       }
+
+       if (buf) {
+               XFree(buf);
+               buf = 0;
+       }
+}
+
+static Window find_window_to_draw()
+{
+       Atom type;
+       int format, i;
+       unsigned long nitems, bytes;
+       unsigned int n;
+       Window root = RootWindow(display, screen);
+       Window win = root;
+       Window troot, parent, *children;
+       unsigned char *buf = NULL;
+
+       /* some window managers set __SWM_VROOT to some child of root window */
+
+       XQueryTree(display, root, &troot, &parent, &children, &n);
+       for (i = 0; i < (int) n; i++) {
+               if (XGetWindowProperty
+                   (display, children[i], ATOM(__SWM_VROOT), 0, 1, False,
+                    XA_WINDOW, &type, &format, &nitems, &bytes,
+                    &buf) == Success && type == XA_WINDOW) {
+                       win = *(Window *) buf;
+                       XFree(buf);
+                       XFree(children);
+                       fprintf(stderr,
+                               "Conky: drawing to window from __SWM_VROOT property\n");
+                       return win;
+               }
+
+               if (buf) {
+                       XFree(buf);
+                       buf = 0;
+               }
+       }
+       XFree(children);
+
+       /* get subwindows from root */
+       win = find_subwindow(root, -1, -1);
+
+       update_workarea();
+
+       win = find_subwindow(win, workarea[2], workarea[3]);
+
+       if (buf) {
+               XFree(buf);
+               buf = 0;
+       }
+
+       if (win != root)
+               fprintf(stderr,
+                       "Conky: drawing to subwindow of root window (%lx)\n",
+                       win);
+       else
+               fprintf(stderr, "Conky: drawing to root window\n");
+
+       return win;
+}
+
+/* sets background to ParentRelative for the Window and all parents */
+void set_transparent_background(Window win)
+{
+       Window parent = win;
+       unsigned int i;
+
+       for (i = 0; i < 16 && parent != RootWindow(display, screen); i++) {
+               Window r, *children;
+               unsigned int n;
+
+               XSetWindowBackgroundPixmap(display, parent,
+                                          ParentRelative);
+
+               XQueryTree(display, parent, &r, &parent, &children, &n);
+               XFree(children);
+       }
+
+       XClearWindow(display, win);
+}
+
+void init_window(int own_window, int w, int h)
+{
+       /* There seems to be some problems with setting transparent background (on
+        * fluxbox this time). It doesn't happen always and I don't know why it
+        * happens but I bet the bug is somewhere here. */
+#ifdef OWN_WINDOW
+       if (own_window) {
+               /* looks like root pixmap isn't needed for anything */
+               {
+                       XSetWindowAttributes attrs;
+                       XClassHint class_hints;
+
+                       /* just test color */
+                       attrs.background_pixel = get_x11_color("green");
+
+                       window.window = XCreateWindow(display, RootWindow(display, screen), window.x, window.y, w, h, 0, CopyFromParent,        /* depth */
+                                                     CopyFromParent,   /* class */
+                                                     CopyFromParent,   /* visual */
+                                                     CWBackPixel, &attrs);
+
+                       class_hints.res_class = "conky";
+                       class_hints.res_name = "conky";
+                       XSetClassHint(display, window.window,
+                                     &class_hints);
+
+                       set_transparent_background(window.window);
+
+                       XStoreName(display, window.window, "conky");
+
+                       XClearWindow(display, window.window);
+
+                       XMoveWindow(display, window.window, window.x,
+                                   window.y);
+               }
+
+               {
+                       /* turn off decorations */
+                       Atom a =
+                           XInternAtom(display, "_MOTIF_WM_HINTS", True);
+                       if (a != None) {
+                               long prop[5] = { 2, 0, 0, 0, 0 };
+                               XChangeProperty(display, window.window, a,
+                                               a, 32, PropModeReplace,
+                                               (unsigned char *) prop, 5);
+                       }
+
+                       /* set window sticky (to all desktops) */
+                       a = XInternAtom(display, "_NET_WM_DESKTOP", True);
+                       if (a != None) {
+                               long prop = 0xFFFFFFFF;
+                               XChangeProperty(display, window.window, a,
+                                               XA_CARDINAL, 32,
+                                               PropModeReplace,
+                                               (unsigned char *) &prop,
+                                               1);
+                       }
+               }
+
+               XMapWindow(display, window.window);
+       } else
+#endif
+               /* root / desktop window */
+       {
+               XWindowAttributes attrs;
+
+               if (!window.window)
+                       window.window = find_window_to_draw();
+
+               if (XGetWindowAttributes(display, window.window, &attrs)) {
+                       window.width = attrs.width;
+                       window.height = attrs.height;
+               }
+       }
+
+       /* Drawable is same as window. This may be changed by double buffering. */
+       window.drawable = window.window;
+
+#ifdef XDBE
+       if (use_xdbe) {
+               int major, minor;
+               if (!XdbeQueryExtension(display, &major, &minor)) {
+                       use_xdbe = 0;
+               } else {
+                       window.back_buffer =
+                           XdbeAllocateBackBufferName(display,
+                                                      window.window,
+                                                      XdbeBackground);
+                       if (window.back_buffer != None) {
+                               window.drawable = window.back_buffer;
+                               fprintf(stderr,
+                                       "Conky: drawing to double buffer\n");
+                       } else
+                               use_xdbe = 0;
+               }
+               if (!use_xdbe)
+                       ERR("failed to set up double buffer");
+       }
+       if (!use_xdbe)
+               fprintf(stderr, "Conky: drawing to single buffer\n");
+#endif
+
+       XFlush(display);
+
+       /* set_transparent_background() must be done after double buffer stuff? */
+#ifdef OWN_WINDOW
+       if (own_window) {
+               set_transparent_background(window.window);
+               XClearWindow(display, window.window);
+       }
+#endif
+
+       XSelectInput(display, window.window, ExposureMask
+#ifdef OWN_WINDOW
+                    | (own_window
+                       ? (StructureNotifyMask | PropertyChangeMask) : 0)
+#endif
+           );
+}
+
+static Window find_subwindow(Window win, int w, int h)
+{
+       unsigned int i, j;
+       Window troot, parent, *children;
+       unsigned int n;
+
+       /* search subwindows with same size as display or work area */
+
+       for (i = 0; i < 10; i++) {
+               XQueryTree(display, win, &troot, &parent, &children, &n);
+
+               for (j = 0; j < n; j++) {
+                       XWindowAttributes attrs;
+
+                       if (XGetWindowAttributes
+                           (display, children[j], &attrs)) {
+                               /* Window must be mapped and same size as display or work space */
+                               if (attrs.map_state != 0 &&
+                                   ((attrs.width == display_width
+                                     && attrs.height == display_height)
+                                    || (attrs.width == w
+                                        && attrs.height == h))) {
+                                       win = children[j];
+                                       break;
+                               }
+                       }
+               }
+
+               XFree(children);
+               if (j == n)
+                       break;
+       }
+
+       return win;
+}
+
+long get_x11_color(const char *name)
+{
+   XColor color;
+       color.pixel = 0;
+          if (!XParseColor(display, DefaultColormap(display, screen), name, &color)) {
+                    ERR("can't parse X color '%s'", name);
+                    return 0xFF00FF;
+       }
+       if (!XAllocColor
+           (display, DefaultColormap(display, screen), &color))
+               ERR("can't allocate X color '%s'", name);
+
+       return (long) color.pixel;
+}
+
+void create_gc()
+{
+       XGCValues values;
+       values.graphics_exposures = 0;
+       values.function = GXcopy;
+       window.gc = XCreateGC(display, window.drawable,
+                             GCFunction | GCGraphicsExposures, &values);
+}